4 Replies Latest reply on Oct 22, 2011 9:28 AM by Balamurugan C

    ManagedTopicPublisher - javax.jms.IllegalStateException: Only allowed one session per connection.

    John Gilbert Apprentice

      Has anyone seen this error?


      14:33:46,437 ERROR [JmsSessionFactoryImpl] could not create session
      javax.jms.IllegalStateException: Only allowed one session per connection. See the J2EE spec, e.g. J2EE1.4 Section 6.6
              at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.allocateConnection(JmsSessionFactoryImpl.java:380)
              at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createTopicSession(JmsSessionFactoryImpl.java:167)
              at org.jboss.seam.jms.TopicSession.create(TopicSession.java:38)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
              at org.jboss.seam.Component.callComponentMethod(Component.java:2201)
              at org.jboss.seam.Component.callCreateMethod(Component.java:2124)
              at org.jboss.seam.Component.newInstance(Component.java:2084)
              at org.jboss.seam.Component.getInstance(Component.java:1978)
              at org.jboss.seam.Component.getInstance(Component.java:1940)
              at org.jboss.seam.Component.getInstance(Component.java:1934)
              at org.jboss.seam.Component.getInstance(Component.java:1914)
              at org.jboss.seam.Component.getInstance(Component.java:1909)
              at org.jboss.seam.jms.TopicSession.instance(TopicSession.java:55)
              at org.jboss.seam.jms.ManagedTopicPublisher.create(ManagedTopicPublisher.java:53)
      



      It appears to be related to this configuration in the jms-ra.rar:


            <outbound-resourceadapter>
               <connection-definition>
                  <managedconnectionfactory-class>org.jboss.resource.adapter.jms.JmsManagedConnectionFactory</managedconnectionfactory-class>
      
      ...
      
                  <config-property>
                    <config-property-name>Strict</config-property-name>
                      <config-property-type>java.lang.Boolean</config-property-type>
                      <config-property-value>true</config-property-value>
                  </config-property>
      




      Basically, I have an MDB on a queue that will publish zero or more messages to a topic.
      This is ok because all the messages are published in the same event scope. However, there can be more than 1 instance of the MDB pulling messages off the queue, which means there are concurrent event scopes creating sessions off the single application scoped topic connection, which is when the exception occurs.


      It looks like there are 3 options:



      1. change the jms-ra.rar setting. probably not a good idea...

      2. limit my MDB to a pool of 1. bad for throughput performance...

      3. make the topic connection event scoped as well. not great for performance either...




      No. 3 is probably the safest option. What has anyone else done?