I have been trying to use outbound connections but when I try to send a message from a standalone app using a JmsTemplate, the send thread blocks forever. What is it that I am doing wrong?
 
Thanks,
 
Richard Maher
 
 
The code:
 
 
public class TestMessagingConfiguartion extends TestCase {
    /**
     * Logger for this class
     */
    private static final Logger logger = Logger.getLogger(TestMessagingConfiguartion.class);
 
    public void testSender() {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                new String[] { "common-messaging.xml" });
        JmsTemplate jmsTemplate = (JmsTemplate) context.getBean("outJmsTemplate");
        jmsTemplate.convertAndSend("test.queue", "bla bla bla...");
        logger.error("sent");
    }
}
 
 
The configuration:
 

<!--

|| JCA configuration for outbound messages

-->

 

<bean id="transactionContextManager" class="org.jencks.factory.TransactionContextManagerFactoryBean" />

<bean id="userTransaction" class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">

<property name="userTransaction" ref="userTransaction" />

</bean>

<!--

###### JCA ######

-->

<bean id="transactionSupport" class="org.jencks.factory.NoTransactionFactoryBean">

</bean>

<bean id="poolingSupport" class="org.jencks.factory.SinglePoolFactoryBean">

<property name="maxSize">

<value>2</value>

</property>

<property name="minSize">

<value>1</value>

</property>

<property name="blockingTimeoutMilliseconds">

<value>60</value>

</property>

<property name="idleTimeoutMinutes">

<value>60</value>

</property>

<property name="matchOne">

<value>true</value>

</property>

<property name="matchAll">

<value>true</value>

</property>

<property name="selectOneAssumeMatch">

<value>true</value>

</property>

</bean>

<bean id="connectionManager" class="org.jencks.factory.ConnectionManagerFactoryBean">

<property name="transactionSupport">

<ref local="transactionSupport" />

</property>

<property name="poolingSupport">

<ref local="poolingSupport" />

</property>

</bean>

<!--

###### JMS ######

-->

<bean id="jmsManagedConnectionFactory" class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">

<property name="resourceAdapter">

<ref local="activeMQResourceAdapter" />

</property>

</bean>

<bean id="jmsConnectionFactory2" class="org.springframework.jca.support.LocalConnectionFactoryBean">

<property name="managedConnectionFactory">

<ref local="jmsManagedConnectionFactory" />

</property>

<property name="connectionManager">

<ref local="connectionManager" />

</property>

</bean>

 

<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">

</bean>

 

<!-- A JmsTemplate used to send outgoing messages -->

<bean id="outJmsTemplate" class="org.springframework.jms.core.JmsTemplate">

<property name="connectionFactory" ref="jmsConnectionFactory" />

</bean>

 

And the stack:

Thread [main] (Suspended)
 Object.wait(long) line: not available [native method]
 CountDownLatch(Object).wait() line: 474
 CountDownLatch.await() line: 173
 WireFormatNegotiator.oneway(Command) line: 61
 MutexTransport.oneway(Command) line: 44
 ResponseCorrelator.asyncRequest(Command) line: 62
 ResponseCorrelator.request(Command) line: 67
 ActiveMQConnection.syncSendPacket(Command) line: 1067
 ActiveMQConnection.ensureConnectionInfoSent() line: 1118
 ActiveMQConnection.createSession(boolean, int) line: 250
 ManagedConnectionProxy.createSessionProxy(boolean, int) line: 115
 ManagedConnectionProxy.createSession(boolean, int) line: 105
 JmsTemplate.createSession(Connection) line: 771
 JmsTemplate.execute(SessionCallback, boolean) line: 424
 JmsTemplate.send(String, MessageCreator) line: 486
 JmsTemplate.convertAndSend(String, Object) line: 552
 TestMessagingConfiguartion.testSender() line: 18
 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
 NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
 Method.invoke(Object, Object...) line: 585
 TestMessagingConfiguartion(TestCase).runTest() line: 154
 TestMessagingConfiguartion(TestCase).runBare() line: 127
 TestResult$1.protect() line: 106
 TestResult.runProtected(Test, Protectable) line: 124
 TestResult.run(TestCase) line: 109
 TestMessagingConfiguartion(TestCase).run(TestResult) line: 118
 RemoteTestRunner.runTests(String[], String) line: 478
 RemoteTestRunner.run() line: 344
 RemoteTestRunner.main(String[]) line: 196

 

Reply via email to