Seam messaging JMS - Topic session closed
giomiano Nov 30, 2009 4:05 PMI am trying to write a proof-of-concept app to use Jboss messaging service.
But i get the following expection while trying to publish a message to the topic
(no erros during server startup - jboss 4.2.3GA - Seam 2.2)
Any idea ?
javax.jms.IllegalStateException: The session is closed 09:47:27,318 ERROR [STDERR] at org.jboss.mq.SpySession.checkClosed(SpySession.java:1149) 09:47:27,318 ERROR [STDERR] at org.jboss.mq.SpySession.createObjectMessage(SpySession.java:280)
components.xml looks like this
<component name="topicPublisher" class="org.jboss.seam.jms.ManagedTopicPublisher"> <property name="topicJndiName">topic/chatroomTopic</property> </component> <component class="org.jboss.seam.remoting.messaging.SubscriptionRegistry" installed="true"> <property name="allowedTopics">chatroomTopic</property> </component>
my test-jms-service.xml like this
<server> <mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=chatroomTopic"> <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends> <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends> <attribute name="SecurityConf"> <security> <role name="guest" read="true" write="true"/> <role name="publisher" read="true" write="true" create="false"/> <role name="durpublisher" read="true" write="true" create="true"/> </security> </attribute> </mbean> </server>
and my seam bean (@Scope(ScopeType.SESSION)):
@In(create=true) private transient TopicPublisher topicPublisher; @In(create=true) private transient TopicSession topicSession;
and my send method
try{ topicPublisher.publish( topicSession.createObjectMessage(d) ); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Cannot publish msg :" + d.getData()); }
Many thanks,
Gio