You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Eugeny N Dzhurinsky <bo...@redwerk.com> on 2008/08/05 10:10:35 UTC
Starting Jetty to serve blobs with embedded broker
Hello, all!
Could somebody please advice how can I start the embedded Jetty server when
starting ActiveMQ from the application using embedded brokers?
I need to serve blobs, and looks like the default Jetty server is not started
when broker is created, thus blobs aren't uploaded and BlobMessage.getInputStream()
returns null.
Thank you in advance!
--
Eugene N Dzhurinsky
Re: Starting Jetty to serve blobs with embedded broker
Posted by Eugeny N Dzhurinsky <bo...@redwerk.com>.
On Wed, Aug 06, 2008 at 03:46:20PM +0200, Dejan Bosanac wrote:
> Hi Eugeny,
>
> try adding something like
>
> <dependency>
> <groupId>org.mortbay.jetty</groupId>
> <version>6.1.2</version>
> <artifactId>jetty</artifactId>
> </dependency>
>
> to your dependencies.
Hello, Dejan!
Thank you for advice, I was able to find out the problem, and the complete
list of dependencies needed to start the broker with jetty support is:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-xbean</artifactId>
<version>6.1.11</version>
</dependency>
with these dependencies ActiveMQ is being started just fine and jetty accepts
HTTP connections as well. Thank you all for your help!
--
Eugene N Dzhurinsky
Re: Starting Jetty to serve blobs with embedded broker
Posted by Dejan Bosanac <de...@ttmsolutions.com>.
Hi Eugeny,
try adding something like
<dependency>
<groupId>org.mortbay.jetty</groupId>
<version>6.1.2</version>
<artifactId>jetty</artifactId>
</dependency>
to your dependencies.
--
Dejan Bosanac
http://www.ttmsolutions.com - get a free ActiveMQ user guide
http://www.scriptinginjava.net
Eugeny N Dzhurinsky wrote:
> On Wed, Aug 06, 2008 at 02:24:00PM +0300, Eugeny N Dzhurinsky wrote:
>
>> 0 [main] INFO org.apache.xbean.spring.context.ResourceXmlApplicationContext - Refreshing org.apache.xbean.spring.context.ResourceXmlApplicationContext@4a63d8: display name [org.apache.xbean.spring.context.ResourceXmlApplicationContext@4a63d8]; startup date [Wed Aug 06 14:19:13 EEST 2008]; root of context hierarchy
>> 152 [main] INFO org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader - Loading XML bean definitions from class path resource [activemq.xml]
>> Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://mortbay.com/schemas/jjettyetty/1.0
>>
>
> Sorry, I missed it, the actual exception is
>
> 185 [main] INFO org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader - Loading XML bean definitions from class path resource [activemq.xml]
> Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://mortbay.com/schemas/jetty/1.0
> at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:277)
> at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:155)
> at org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)
>
>
Re: Starting Jetty to serve blobs with embedded broker
Posted by Eugeny N Dzhurinsky <bo...@redwerk.com>.
On Wed, Aug 06, 2008 at 02:24:00PM +0300, Eugeny N Dzhurinsky wrote:
> 0 [main] INFO org.apache.xbean.spring.context.ResourceXmlApplicationContext - Refreshing org.apache.xbean.spring.context.ResourceXmlApplicationContext@4a63d8: display name [org.apache.xbean.spring.context.ResourceXmlApplicationContext@4a63d8]; startup date [Wed Aug 06 14:19:13 EEST 2008]; root of context hierarchy
> 152 [main] INFO org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader - Loading XML bean definitions from class path resource [activemq.xml]
> Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://mortbay.com/schemas/jjettyetty/1.0
Sorry, I missed it, the actual exception is
185 [main] INFO org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader - Loading XML bean definitions from class path resource [activemq.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://mortbay.com/schemas/jetty/1.0
at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:277)
at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:155)
at org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)
--
Eugene N Dzhurinsky
Re: Starting Jetty to serve blobs with embedded broker
Posted by Eugeny N Dzhurinsky <bo...@redwerk.com>.
On Tue, Aug 05, 2008 at 06:10:20AM -0700, Joe Fernandez wrote:
>
> Hi Eugeny,
>
> You can try starting the embedded broker with a brokerURL that specifies a
> config file, and have the config file include a <> element.
>
> With this brokerURL the cfg file must be in the application???s CLASSPATH.
> vm://localbroker?brokerConfig=xbean:activemq.xml
>
> With this one, you're specifying an absolute path to the cfg file.
> vm://localbroker?brokerConfig=xbean:file:C:/tmp/activemq.xml
Hello, Joe!
Thank you for quick reply, however things are not clear for me :)
Looks like the way I am creating the broker is incorrect:
final BrokerService broker = BrokerFactory.createBroker(new URI(
"xbean:activemq.xml"));
Gives the error:
0 [main] INFO org.apache.xbean.spring.context.ResourceXmlApplicationContext - Refreshing org.apache.xbean.spring.context.ResourceXmlApplicationContext@4a63d8: display name [org.apache.xbean.spring.context.ResourceXmlApplicationContext@4a63d8]; startup date [Wed Aug 06 14:19:13 EEST 2008]; root of context hierarchy
152 [main] INFO org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader - Loading XML bean definitions from class path resource [activemq.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://mortbay.com/schemas/jjettyetty/1.0
at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:277)
and the activemq.xml file looks like
<beans>
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker brokerName="broker0" xmlns="http://activemq.org/config/1.0">
<managementContext>
<managementContext connectorPort="1599"
jmxDomainName="org.apache.activemq"/>
</managementContext>
<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost:1235" />
</transportConnectors>
</broker>
<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
<connectors>
<nioConnector port="8161" />
</connectors>
<handlers>
<webAppContext contextPath="/admin"
resourceBase="webapps/admin" logUrlOnStart="true" />
<webAppContext contextPath="/demo"
resourceBase="webapps/demo" logUrlOnStart="true" />
<webAppContext contextPath="/fileserver"
resourceBase="webapps/fileserver" logUrlOnStart="true" />
</handlers>
</jetty>
</beans>
Did I miss some dependency on Jetty?
I am using Maven to build and execute the test application, and I specified the dependencies as below
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-optional</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
<version>3.4</version>
</dependency>
Thank you in advance!
--
Eugene N Dzhurinsky
Re: Starting Jetty to serve blobs with embedded broker
Posted by Joe Fernandez <jo...@ttmsolutions.com>.
Hi Eugeny,
You can try starting the embedded broker with a brokerURL that specifies a
config file, and have the config file include a <jetty> element.
With this brokerURL the cfg file must be in the application’s CLASSPATH.
vm://localbroker?brokerConfig=xbean:activemq.xml
With this one, you're specifying an absolute path to the cfg file.
vm://localbroker?brokerConfig=xbean:file:C:/tmp/activemq.xml
Here's an example file with the <jetty> element.
<beans>
<!-- Allows us to use system properties as variables in this configuration
file -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker brokerName="broker0" xmlns="http://activemq.org/config/1.0">
<managementContext>
<managementContext connectorPort="1599"
jmxDomainName="org.apache.activemq"/>
</managementContext>
<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost:61616" />
</transportConnectors>
</broker>
<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
<connectors>
<nioConnector port="8161" />
</connectors>
<handlers>
<webAppContext contextPath="/admin"
resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
<webAppContext contextPath="/demo"
resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
<webAppContext contextPath="/fileserver"
resourceBase="${activemq.base}/webapps/fileserver" logUrlOnStart="true" />
</handlers>
</jetty>
</beans>
Hope this helps.
Joe
http://www.ttmsolutions.com - get a free ActiveMQ user guide
Eugeny N Dzhurinsky-2 wrote:
>
> Hello, all!
>
> Could somebody please advice how can I start the embedded Jetty server
> when
> starting ActiveMQ from the application using embedded brokers?
>
> I need to serve blobs, and looks like the default Jetty server is not
> started
> when broker is created, thus blobs aren't uploaded and
> BlobMessage.getInputStream()
> returns null.
>
> Thank you in advance!
>
> --
> Eugene N Dzhurinsky
>
>
--
View this message in context: http://www.nabble.com/Starting-Jetty-to-serve-blobs-with-embedded-broker-tp18826446p18830817.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.