I'm trying, for the first time, to connect an application to ActiveMQ the proper way under Tomcat, using JNDI Resources. Not having much luck so far. I'm stuck on the message
There seems to be an associated message:javax.jms.JMSException: The transport is not running.
In server.xml I define the following JNDI resources:java.io.IOException: Unknown data type: 105
at org.apache.activemq.openwire.OpenWireFormat.doUnma rshal(OpenWireFormat.java:342)
at org.apache.activemq.openwire.OpenWireFormat.unmars hal(OpenWireFormat.java:273)
at org.apache.activemq.transport.tcp.TcpTransport.rea dCommand(TcpTransport.java:156)
at org.apache.activemq.transport.tcp.TcpTransport.run (TcpTransport.java:136)
Then I bring them in the applicationcontext.xml as:Code:<Resource auth="Container" description="JMS Connection factory" name="jms/ConnectionFactory" type="org.apache.activemq.ActiveMQConnectionFactory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://ccdwaretest:7676" clientID="OCSRelay" useEmbeddedBroker="false" userName="guest" password="guest" /> <Resource name="jms/ocsTopic" auth="Container" type="org.apache.activemq.command.ActiveMQTopic" description="my Topic" factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="OCS_RELAYED"/>
My first try was without the transaction manager, but I got essentially the same error, it just happens on sending the message rather that trying to start a transaction.Code:<jee:jndi-lookup id="jmsConnectionFactory" jndi-name="jms/ConnectionFactory" resource-ref="true" proxy-interface="javax.jms.ConnectionFactory"/> <bean id="transactionManager" class="org.springframework.jms.connection.JmsTransactionManager" p:connectionFactory-ref="jmsConnectionFactory"/> <jee:jndi-lookup id="ocsTopic" jndi-name="jms/ocsTopic" resource-ref="true" proxy-interface="javax.jms.Topic"/> <tx:annotation-driven/>
Here's the code:
The broker on dcdwaretest is up and running, and I've used it without problems using the fsContext method of setting parameters.Code:@Transactional public class OCSPublishSMSImpl implements OCSPublish { private ConnectionFactory connectionFactory; private Destination ocsTopic; public void publishOcsMessage(final String xml, final Map<String, String> properties) { JmsTemplate template = new JmsTemplate(connectionFactory); template.setPubSubDomain(true); ProducerCallback process = new ProducerCallback() { public Object doInJms(Session sn, MessageProducer mp) throws JMSException { Message msg = sn.createTextMessage(xml); for (Map.Entry<String, String> prop : properties.entrySet()) { msg.setStringProperty(prop.getKey(), prop.getValue()); } mp.send(msg); return null; } }; template.execute(ocsTopic, process); }


Reply With Quote
