You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by cristisor <cr...@yahoo.com> on 2012/10/24 14:44:37 UTC

DefaultMessageListenerContainer start failure on remote connection

Hello,

I have a contextFactory and a topic inside a Tomee+ container and I'm trying
to access them remotely, from an application located outside of the
container but running in the same VM.
remote application context.xml:

	<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
		<property name="environment">
			<props>
				<prop
key="java.naming.factory.initial">org.apache.openejb.client.RemoteInitialContextFactory</prop>
				<prop
key="java.naming.provider.url">http://localhost:8080/tomee/ejb</prop>
				<prop key="java.naming.security.principal">tomee</prop>
				<prop key="java.naming.security.credentials">tomee</prop>
			</props>
		</property>
	</bean>
	
	<bean id="connectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
	    <property name="jndiTemplate" ref="jndiTemplate"/>
	    <property name="jndiName" value="jms/connectionFactory"/>
	    <property name="resourceRef" value="true" />
	</bean>
	
	<bean id="cachingConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
	    <property name="targetConnectionFactory" ref="connectionFactory"/>
	    <property name="sessionCacheSize" value="3"/>
	</bean>

	<bean id="destinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
	    <property name="jndiTemplate" ref="jndiTemplate"/>
	    <property name="cache" value="true"/>
	    <property name="fallbackToDynamicDestination" value="false"/>
	</bean>
	
	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="cachingConnectionFactory"/>
		<property name="destinationResolver" ref="destinationResolver"/>
	</bean>
	
	<bean id="messageListener"
class="org.publisher.listener.QueueMessageListener">
		<constructor-arg name="jmsTemplate" ref="jmsTemplate"></constructor-arg>
		<constructor-arg name="queueName"
value="java:comp/env/jms/queue1"></constructor-arg>
	</bean>
	
	<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
	    <property name="connectionFactory" ref="connectionFactory"/>
	    <property name="destinationResolver" ref="destinationResolver"/>
	    <property name="concurrentConsumers" value="1" />
	    <property name="destinationName" value="jms/topic1Node3"/>
	    <property name="messageListener" ref="messageListener" />
	    <property name="sessionAcknowledgeModeName" value="AUTO_ACKNOWLEDGE"/>
	    <property name="pubSubDomain" value="true"></property>
	</bean>

I set the following parameters when running the application:
-DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616
-DResource/javax.jms.Topic=topic:org.apache.activemq.command.ActiveMQTopic:jms/topic1Node3

When running the application I get the following log:

635  [main] DEBUG
org.springframework.context.support.DefaultLifecycleProcessor  - Starting
bean 'jmsContainer' of type [class
org.springframework.jms.listener.DefaultMessageListenerContainer]
778  [main] DEBUG
org.springframework.jms.listener.DefaultMessageListenerContainer  -
Established shared JMS Connection
778  [main] DEBUG
org.springframework.jms.listener.DefaultMessageListenerContainer  - Resumed
paused task:
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker@4aab7165
10782 [main] DEBUG
org.springframework.jms.listener.DefaultMessageListenerContainer  -
Connection start failed - relying on listeners to perform recovery
javax.jms.JMSException: Wire format negotiation timeout: peer did not send
his wire format.
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
	at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1395)
	at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1481)
	at
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:516)
	at
org.springframework.jms.listener.AbstractJmsListeningContainer.startSharedConnection(AbstractJmsListeningContainer.java:441)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer.startSharedConnection(DefaultMessageListenerContainer.java:776)
	at
org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:291)
	at
org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:264)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer.start(DefaultMessageListenerContainer.java:561)
	at
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:167)
	at
org.springframework.context.support.DefaultLifecycleProcessor.access$1(DefaultLifecycleProcessor.java:154)
	at
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:339)
	at
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143)
	at
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:108)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:926)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at org.publisher.main.Main.main(Main.java:9)
Caused by: java.io.IOException: Wire format negotiation timeout: peer did
not send his wire format.
	at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:98)
	at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
	at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
	at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
	at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1366)
	... 17 more
10785 [main] DEBUG
org.springframework.context.support.DefaultLifecycleProcessor  -
Successfully started bean 'jmsContainer'

If I switch from:
-DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:*tcp://localhost:61616*
-DResource/javax.jms.Topic=topic:org.apache.activemq.command.ActiveMQTopic:jms/topic1Node3
to:
-DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:*vm://localhost:61616*
-DResource/javax.jms.Topic=topic:org.apache.activemq.command.ActiveMQTopic:jms/topic1Node3
the application works ok and makes the lookup with success.

Here is the resource declaration in tomee.xml:
	<Resource id="JMSAdapter" type="ActiveMQResourceAdapter">
		BrokerXmlConfig=broker:(tcp://localhost:61616)?persistent=false
	</Resource>

	<Resource id="jms/connectionFactory" type="javax.jms.ConnectionFactory">
		ResourceAdapter = JMSAdapter
	</Resource>

	<Resource id="jms/topic1Node3" type="javax.jms.Topic">
		destination = Topic1Node3
	</Resource>

Can anyone tell me why there is a difference between "vm://" and "tcp://"?

Thank you.



--
View this message in context: http://activemq.2283324.n4.nabble.com/DefaultMessageListenerContainer-start-failure-on-remote-connection-tp4658159.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: DefaultMessageListenerContainer start failure on remote connection

Posted by cristisor <cr...@yahoo.com>.
Hello,

You were right, the broker probably doesn't start correctly. I'm writing the
new JMSAdapter:
<Resource id="JMSAdapter" type="ActiveMQResourceAdapter">
	BrokerXmlConfig =
broker:(tcp://localhost:61616)?persistent=false&amp;useJmx=true
	ServerUrl = tcp://localhost:61616
	Datasource = 
</Resource>



--
View this message in context: http://activemq.2283324.n4.nabble.com/DefaultMessageListenerContainer-start-failure-on-remote-connection-tp4658159p4658224.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: DefaultMessageListenerContainer start failure on remote connection

Posted by Christian Posta <ch...@gmail.com>.
I think what's happening is when you use the VM connector, an in-memory
broker is starting up for your client. But when you're expecting the tcp
connector to be available, it will fail because it's not actually available
(the broker didn't start properly). Take a look at the config I mentioned
for your other post (
http://activemq.2283324.n4.nabble.com/Web-console-Exception-No-broker-is-found-at-any-of-the-1-configured-urls-td4657842.html)
and that should help the broker come up properly.
Cheers

On Wed, Oct 24, 2012 at 6:07 AM, cristisor <cr...@yahoo.com> wrote:

> I'm just starting with Tomee+/ActiveMQ and I have no idea regarding the
> transports in my broker config. Are you talking about this:
> BrokerXmlConfig=broker:(tcp://localhost:61616)?persistent=false ?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/DefaultMessageListenerContainer-start-failure-on-remote-connection-tp4658159p4658164.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog

Re: DefaultMessageListenerContainer start failure on remote connection

Posted by cristisor <cr...@yahoo.com>.
I'm just starting with Tomee+/ActiveMQ and I have no idea regarding the
transports in my broker config. Are you talking about this:
BrokerXmlConfig=broker:(tcp://localhost:61616)?persistent=false ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/DefaultMessageListenerContainer-start-failure-on-remote-connection-tp4658159p4658164.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: DefaultMessageListenerContainer start failure on remote connection

Posted by Christian Posta <ch...@gmail.com>.
the vm:// protocol can be used for inter-JVM interaction with the broker
(note, you don't need a port number there just vm://<brokerName> )

http://activemq.apache.org/vm-transport-reference.html

The tcp:// protocol uses the tcp stack for communication with the broker:
http://activemq.apache.org/tcp-transport-reference.html

How did you set up the transports in your broker's config?


On Wed, Oct 24, 2012 at 5:44 AM, cristisor <cr...@yahoo.com> wrote:

> Hello,
>
> I have a contextFactory and a topic inside a Tomee+ container and I'm
> trying
> to access them remotely, from an application located outside of the
> container but running in the same VM.
> remote application context.xml:
>
>         <bean id="jndiTemplate"
> class="org.springframework.jndi.JndiTemplate">
>                 <property name="environment">
>                         <props>
>                                 <prop
>
> key="java.naming.factory.initial">org.apache.openejb.client.RemoteInitialContextFactory</prop>
>                                 <prop
> key="java.naming.provider.url">http://localhost:8080/tomee/ejb</prop>
>                                 <prop
> key="java.naming.security.principal">tomee</prop>
>                                 <prop
> key="java.naming.security.credentials">tomee</prop>
>                         </props>
>                 </property>
>         </bean>
>
>         <bean id="connectionFactory"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>             <property name="jndiTemplate" ref="jndiTemplate"/>
>             <property name="jndiName" value="jms/connectionFactory"/>
>             <property name="resourceRef" value="true" />
>         </bean>
>
>         <bean id="cachingConnectionFactory"
> class="org.springframework.jms.connection.CachingConnectionFactory">
>             <property name="targetConnectionFactory"
> ref="connectionFactory"/>
>             <property name="sessionCacheSize" value="3"/>
>         </bean>
>
>         <bean id="destinationResolver"
>
> class="org.springframework.jms.support.destination.JndiDestinationResolver">
>             <property name="jndiTemplate" ref="jndiTemplate"/>
>             <property name="cache" value="true"/>
>             <property name="fallbackToDynamicDestination" value="false"/>
>         </bean>
>
>         <bean id="jmsTemplate"
> class="org.springframework.jms.core.JmsTemplate">
>                 <property name="connectionFactory"
> ref="cachingConnectionFactory"/>
>                 <property name="destinationResolver"
> ref="destinationResolver"/>
>         </bean>
>
>         <bean id="messageListener"
> class="org.publisher.listener.QueueMessageListener">
>                 <constructor-arg name="jmsTemplate"
> ref="jmsTemplate"></constructor-arg>
>                 <constructor-arg name="queueName"
> value="java:comp/env/jms/queue1"></constructor-arg>
>         </bean>
>
>         <bean id="jmsContainer"
> class="org.springframework.jms.listener.DefaultMessageListenerContainer">
>             <property name="connectionFactory" ref="connectionFactory"/>
>             <property name="destinationResolver"
> ref="destinationResolver"/>
>             <property name="concurrentConsumers" value="1" />
>             <property name="destinationName" value="jms/topic1Node3"/>
>             <property name="messageListener" ref="messageListener" />
>             <property name="sessionAcknowledgeModeName"
> value="AUTO_ACKNOWLEDGE"/>
>             <property name="pubSubDomain" value="true"></property>
>         </bean>
>
> I set the following parameters when running the application:
>
> -DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616
>
> -DResource/javax.jms.Topic=topic:org.apache.activemq.command.ActiveMQTopic:jms/topic1Node3
>
> When running the application I get the following log:
>
> 635  [main] DEBUG
> org.springframework.context.support.DefaultLifecycleProcessor  - Starting
> bean 'jmsContainer' of type [class
> org.springframework.jms.listener.DefaultMessageListenerContainer]
> 778  [main] DEBUG
> org.springframework.jms.listener.DefaultMessageListenerContainer  -
> Established shared JMS Connection
> 778  [main] DEBUG
> org.springframework.jms.listener.DefaultMessageListenerContainer  - Resumed
> paused task:
>
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker@4aab7165
> 10782 [main] DEBUG
> org.springframework.jms.listener.DefaultMessageListenerContainer  -
> Connection start failed - relying on listeners to perform recovery
> javax.jms.JMSException: Wire format negotiation timeout: peer did not send
> his wire format.
>         at
>
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
>         at
>
> org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1395)
>         at
>
> org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1481)
>         at
> org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:516)
>         at
>
> org.springframework.jms.listener.AbstractJmsListeningContainer.startSharedConnection(AbstractJmsListeningContainer.java:441)
>         at
>
> org.springframework.jms.listener.DefaultMessageListenerContainer.startSharedConnection(DefaultMessageListenerContainer.java:776)
>         at
>
> org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:291)
>         at
>
> org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:264)
>         at
>
> org.springframework.jms.listener.DefaultMessageListenerContainer.start(DefaultMessageListenerContainer.java:561)
>         at
>
> org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:167)
>         at
>
> org.springframework.context.support.DefaultLifecycleProcessor.access$1(DefaultLifecycleProcessor.java:154)
>         at
>
> org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:339)
>         at
>
> org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143)
>         at
>
> org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:108)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:926)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
>         at
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
>         at
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
>         at org.publisher.main.Main.main(Main.java:9)
> Caused by: java.io.IOException: Wire format negotiation timeout: peer did
> not send his wire format.
>         at
>
> org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:98)
>         at
> org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
>         at
>
> org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
>         at
>
> org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
>         at
>
> org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1366)
>         ... 17 more
> 10785 [main] DEBUG
> org.springframework.context.support.DefaultLifecycleProcessor  -
> Successfully started bean 'jmsContainer'
>
> If I switch from:
>
> -DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:*tcp://localhost:61616*
>
> -DResource/javax.jms.Topic=topic:org.apache.activemq.command.ActiveMQTopic:jms/topic1Node3
> to:
>
> -DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:*vm://localhost:61616*
>
> -DResource/javax.jms.Topic=topic:org.apache.activemq.command.ActiveMQTopic:jms/topic1Node3
> the application works ok and makes the lookup with success.
>
> Here is the resource declaration in tomee.xml:
>         <Resource id="JMSAdapter" type="ActiveMQResourceAdapter">
>
> BrokerXmlConfig=broker:(tcp://localhost:61616)?persistent=false
>         </Resource>
>
>         <Resource id="jms/connectionFactory"
> type="javax.jms.ConnectionFactory">
>                 ResourceAdapter = JMSAdapter
>         </Resource>
>
>         <Resource id="jms/topic1Node3" type="javax.jms.Topic">
>                 destination = Topic1Node3
>         </Resource>
>
> Can anyone tell me why there is a difference between "vm://" and "tcp://"?
>
> Thank you.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/DefaultMessageListenerContainer-start-failure-on-remote-connection-tp4658159.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog