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.

Reply via email to