javax.jms.JMSException: Invalid transaction id
kennethc Aug 13, 2002 7:14 AMHello ,
I am attempting to publish a message from my session bean to a client. However the following exception is thrown :
javax.jms.JMSException: Invalid transaction id.
at org.jboss.mq.SpyXAResourceManager.addMessage(SpyXAResourceManager.java:76)
at org.jboss.mq.SpySession.sendMessage(SpySession.java:396)
Here is the contents of my ejb-jar.xml file :
<ejb-jar>
<enterprise-beans>
<display-name>FirstEJB</display-name>
<ejb-name>First</ejb-name>
com.stardeveloper.ejb.session.FirstHome
com.stardeveloper.ejb.session.First
<ejb-class>com.stardeveloper.ejb.session.FirstEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
A Topic ConnectionFactory
<res-ref-name>jms/MyTopicConnection</res-ref-name>
<res-type>javax.jms.TopicConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
A Topic
<res-ref-name>jms/TopicName</res-ref-name>
<res-type>javax.jms.Topic</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<ejb-name>First</ejb-name>
<method-name>*</method-name>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<security-role>
Users
<role-name>users</role-name>
</security-role>
</assembly-descriptor>
</ejb-jar>
The contents of jboss.xml are :
false
<resource-managers>
<resource-manager>
<res-name>topicfactoryref</res-name>
<res-jndi-name>java:/JmsXA</res-jndi-name>
</resource-manager>
<resource-manager>
<res-name>topicref</res-name>
<res-jndi-name>topic/testTopic</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<ejb-name>First</ejb-name>
<jndi-name>ejb/First</jndi-name>
<configuration-name>Standard Stateless SessionBean</configuration-name>
<resource-ref>
<res-ref-name>jms/MyTopicConnection</res-ref-name>
<resource-name>topicfactoryref</resource-name>
</resource-ref>
<resource-ref>
<res-ref-name>jms/TopicName</res-ref-name>
<resource-name>topicref</resource-name>
</resource-ref>
</enterprise-beans>
An finally here is the bean code for sending a message :
private static final String CONNECTION_JNDI =
"java:comp/env/jms/MyTopicConnection";
private static final String TOPIC_JNDI = "java:comp/env/jms/TopicName";
// Lookup the topic
topic = (Topic)context.lookup(TOPIC_JNDI);
// Lookup the connection factory
TopicConnectionFactory factory =
(TopicConnectionFactory)context.lookup(CONNECTION_JNDI);
topicConnection = factory.createTopicConnection();
TopicPublisher topicPublisher = null;
TextMessage message = null;
// Create a session
topicSession = topicConnection.createTopicSession(true,
Session.AUTO_ACKNOWLEDGE);
// Create a publisher
topicPublisher = topicSession.createPublisher(topic);
// Create a message
message = topicSession.createTextMessage();
message.setText(msg);
// Publish it
System.out.println("Publishing message " + msg);
topicPublisher.publish(message);
} catch (JMSException ex) {
In the jboss.jcml file I placed the following line:
I would really appreciate any help,
Thank,
Ken.