You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by dajevu <jd...@hireright.com> on 2006/05/17 23:38:07 UTC

Using servicemix-jms

Hi,

I'm attempting to get an example of servicemix-jms working. My
servicemix.xml file follows:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0" 
	xmlns:jms="http://servicemix.apache.org/jms/1.0"
	xmlns:amq="http://activemq.org/config/1.0"
	xmlns:test="http://test">
	
	<!-- the JBI container -->
	<sm:container id="jbi" embedded="true" useMBeanServer="true"
createMBeanServer="true" dumpStats="true" statsInterval="10"
depends-on="jndi,broker">
		<sm:activationSpecs>
			
			<!-- START SNIPPET: lightweight -->
			<sm:activationSpec>
				<sm:component>
					<jms:component>
						<jms:endpoints>
							<jms:endpoint service="test:MyConsumerService"
								endpoint="myConsumer"
								role="consumer" 
								defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
								destinationStyle="queue"
								jmsProviderDestinationName="queue/A"
								jndiConnectionFactoryName="jms/ConnectionFactory" />
								
							<jms:endpoint service="test:MyProviderService"
								endpoint="myProvider"
								role="provider" 
								destinationStyle="queue"
								jmsProviderDestinationName="queue/A"
								connectionFactory="#connectionFactory" />
						</jms:endpoints>
					</jms:component>
				</sm:component>
			</sm:activationSpec>
			<!-- END SNIPPET: lightweight -->
			
			<sm:activationSpec service="test:MyConsumerService"
endpoint="myConsumer">
				<sm:component>
					<bean class="org.apache.servicemix.components.util.EchoComponent" />
				</sm:component>
			</sm:activationSpec>
			
		</sm:activationSpecs>
	</sm:container>
	
	<bean id="jndi" 
		class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" 
		factory-method="makeInitialContext"
		singleton="true">
		<property name="entries">
			<map>
				<entry key="jms/ConnectionFactory" value-ref="connectionFactory" />
			</map>
		</property>
	</bean>
	
	<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL" value="tcp://localhost:61216" />
	</bean>
	
	<amq:broker id="broker" persistent="false" depends-on="jndi" >
		
		<amq:transportConnectors>
			<amq:transportConnector uri="tcp://localhost:61216" />
		</amq:transportConnectors>
		
	</amq:broker>
	
</beans>

When I attempt to start it, I get back an error:

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'jbi' defined in file
[C:\workspace-servicemix3\ats-tester\servicemix-test.xml]: Initialization of
bean failed; nested exception is javax.jbi.JBIException: Error calling start
javax.jbi.JBIException: Error calling start
	at org.apache.servicemix.common.BaseLifeCycle.start(BaseLifeCycle.java:200)
	at
org.apache.servicemix.jbi.framework.ComponentMBeanImpl.doStart(ComponentMBeanImpl.java:285)
	at
org.apache.servicemix.jbi.framework.ComponentRegistry.setInitialRunningStateFromStart(ComponentRegistry.java:143)
	at
org.apache.servicemix.jbi.framework.ComponentRegistry.start(ComponentRegistry.java:70)
	at org.apache.servicemix.jbi.framework.Registry.start(Registry.java:110)
	at
org.apache.servicemix.jbi.container.JBIContainer.start(JBIContainer.java:532)2006-05-17
14:32:24,750 [main           ] INFO  VMTransportFactory             -
Shutting down VM connectors for broker: localhost
2006-05-17 14:32:24,750 [main           ] INFO  BrokerService                 
- ActiveMQ JMS Message Broker (localhost) stopped:
org.apache.activemq.broker.BrokerService$2@6c1a82
Caught: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'jbi' defined in file
[C:\workspace-servicemix3\ats-tester\servicemix-test.xml]: Initialization of
bean failed; nested exception is javax.jbi.JBIException: Error calling start

	at
org.apache.servicemix.jbi.container.SpringJBIContainer.afterPropertiesSet(SpringJBIContainer.java:78)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
	at
org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:149)
	at
org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:48)
	at org.apache.servicemix.Main.main(Main.java:74)
Caused by: javax.naming.NameNotFoundException: jms/ConnectionFactory
	at
org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:214)
	at javax.naming.InitialContext.lookup(InitialContext.java:351)
	at
org.apache.servicemix.jms.AbstractJmsProcessor.start(AbstractJmsProcessor.java:51)
	at org.apache.servicemix.soap.SoapEndpoint.activate(SoapEndpoint.java:296)
	at org.apache.servicemix.common.ServiceUnit.start(ServiceUnit.java:45)
	at
org.apache.servicemix.jms.JmsSpringComponent$LifeCycle.doStart(JmsSpringComponent.java:99)
	at org.apache.servicemix.common.BaseLifeCycle.start(BaseLifeCycle.java:192)
	... 15 more

Any ideas what might be causing this? I believe my classpath is setup
correctly. If I comment out the consumer, it will start.

Thanks,

jeff
--
View this message in context: http://www.nabble.com/Using-servicemix-jms-t1639310.html#a4439955
Sent from the ServiceMix - User forum at Nabble.com.


Re: Using servicemix-jms

Posted by Guillaume Nodet <gn...@gmail.com>.
You should either
  * use the connectionFactory on the consumer (as done on the provider)
  * set the jndi system properties
         System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
SpringInitialContextFactory.class.getName());
         or configure them at the needed location (-Dxxx, jndi.properties,
etc)

Cheers,
Guillaume Nodet

On 5/17/06, dajevu <jd...@hireright.com> wrote:
>
>
> Hi,
>
> I'm attempting to get an example of servicemix-jms working. My
> servicemix.xml file follows:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:sm="http://servicemix.apache.org/config/1.0"
>         xmlns:jms="http://servicemix.apache.org/jms/1.0"
>         xmlns:amq="http://activemq.org/config/1.0"
>         xmlns:test="http://test">
>
>         <!-- the JBI container -->
>         <sm:container id="jbi" embedded="true" useMBeanServer="true"
> createMBeanServer="true" dumpStats="true" statsInterval="10"
> depends-on="jndi,broker">
>                 <sm:activationSpecs>
>
>                         <!-- START SNIPPET: lightweight -->
>                         <sm:activationSpec>
>                                 <sm:component>
>                                         <jms:component>
>                                                 <jms:endpoints>
>                                                         <jms:endpoint
> service="test:MyConsumerService"
>
>                                                                 endpoint="myConsumer"
>
>                                                                 role="consumer"
>
>                                                                 defaultMep="
> http://www.w3.org/2004/08/wsdl/in-out"
>
>                                                                 destinationStyle="queue"
>
>                                                                 jmsProviderDestinationName="queue/A"
>                                                                 jndiConnectionFactoryName="jms/ConnectionFactory"
> />
>
>                                                         <jms:endpoint
> service="test:MyProviderService"
>
>                                                                 endpoint="myProvider"
>
>                                                                 role="provider"
>
>                                                                 destinationStyle="queue"
>
>                                                                 jmsProviderDestinationName="queue/A"
>                                                                 connectionFactory="#connectionFactory"
> />
>                                                 </jms:endpoints>
>                                         </jms:component>
>                                 </sm:component>
>                         </sm:activationSpec>
>                         <!-- END SNIPPET: lightweight -->
>
>                         <sm:activationSpec
> service="test:MyConsumerService"
> endpoint="myConsumer">
>                                 <sm:component>
>                                         <bean class="
> org.apache.servicemix.components.util.EchoComponent" />
>                                 </sm:component>
>                         </sm:activationSpec>
>
>                 </sm:activationSpecs>
>         </sm:container>
>
>         <bean id="jndi"
>                 class="
> org.apache.xbean.spring.jndi.SpringInitialContextFactory"
>                 factory-method="makeInitialContext"
>                 singleton="true">
>                 <property name="entries">
>                         <map>
>                                 <entry key="jms/ConnectionFactory"
> value-ref="connectionFactory" />
>                         </map>
>                 </property>
>         </bean>
>
>         <bean id="connectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>                 <property name="brokerURL" value="tcp://localhost:61216"
> />
>         </bean>
>
>         <amq:broker id="broker" persistent="false" depends-on="jndi" >
>
>                 <amq:transportConnectors>
>                         <amq:transportConnector
> uri="tcp://localhost:61216" />
>                 </amq:transportConnectors>
>
>         </amq:broker>
>
> </beans>
>
> When I attempt to start it, I get back an error:
>
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'jbi' defined in file
> [C:\workspace-servicemix3\ats-tester\servicemix-test.xml]: Initialization
> of
> bean failed; nested exception is javax.jbi.JBIException: Error calling
> start
> javax.jbi.JBIException: Error calling start
>         at org.apache.servicemix.common.BaseLifeCycle.start(
> BaseLifeCycle.java:200)
>         at
> org.apache.servicemix.jbi.framework.ComponentMBeanImpl.doStart(
> ComponentMBeanImpl.java:285)
>         at
>
> org.apache.servicemix.jbi.framework.ComponentRegistry.setInitialRunningStateFromStart
> (ComponentRegistry.java:143)
>         at
> org.apache.servicemix.jbi.framework.ComponentRegistry.start(
> ComponentRegistry.java:70)
>         at org.apache.servicemix.jbi.framework.Registry.start(
> Registry.java:110)
>         at
> org.apache.servicemix.jbi.container.JBIContainer.start(JBIContainer.java
> :532)2006-05-17
> 14:32:24,750 [main           ] INFO  VMTransportFactory             -
> Shutting down VM connectors for broker: localhost
> 2006-05-17 14:32:24,750 [main           ] INFO  BrokerService
> - ActiveMQ JMS Message Broker (localhost) stopped:
> org.apache.activemq.broker.BrokerService$2@6c1a82
> Caught: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'jbi' defined in file
> [C:\workspace-servicemix3\ats-tester\servicemix-test.xml]: Initialization
> of
> bean failed; nested exception is javax.jbi.JBIException: Error calling
> start
>
>         at
> org.apache.servicemix.jbi.container.SpringJBIContainer.afterPropertiesSet(
> SpringJBIContainer.java:78)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods
> (AbstractAutowireCapableBeanFactory.java:1059)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean
> (AbstractAutowireCapableBeanFactory.java:363)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> AbstractBeanFactory.java:226)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> AbstractBeanFactory.java:147)
>         at
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons
> (DefaultListableBeanFactory.java:275)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(
> AbstractApplicationContext.java:320)
>         at
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(
> FileSystemXmlApplicationContext.java:149)
>         at
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(
> FileSystemXmlApplicationContext.java:48)
>         at org.apache.servicemix.Main.main(Main.java:74)
> Caused by: javax.naming.NameNotFoundException: jms/ConnectionFactory
>         at
> org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:214)
>         at javax.naming.InitialContext.lookup(InitialContext.java:351)
>         at
> org.apache.servicemix.jms.AbstractJmsProcessor.start(
> AbstractJmsProcessor.java:51)
>         at org.apache.servicemix.soap.SoapEndpoint.activate(
> SoapEndpoint.java:296)
>         at org.apache.servicemix.common.ServiceUnit.start(ServiceUnit.java
> :45)
>         at
> org.apache.servicemix.jms.JmsSpringComponent$LifeCycle.doStart(
> JmsSpringComponent.java:99)
>         at org.apache.servicemix.common.BaseLifeCycle.start(
> BaseLifeCycle.java:192)
>         ... 15 more
>
> Any ideas what might be causing this? I believe my classpath is setup
> correctly. If I comment out the consumer, it will start.
>
> Thanks,
>
> jeff
> --
> View this message in context:
> http://www.nabble.com/Using-servicemix-jms-t1639310.html#a4439955
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet