1 Reply Latest reply on Jan 29, 2013 9:36 AM by Akhbar Falafel

    Only allowed one session per connection. See the J2EE spec, e.g. J2EE1.4 Section 6.6

    Andy Stone Newbie
      Can anyone please help me with the above exception.

      I have defined a SEAM component that needs to write to JMS:

      @Name("queuer")
      public class MyQueuer {

        @In
        private transient QueueSender mySender;

        @In
        private transient QueueSession queueSession;

        public void send(final Object pObject) {
          try {
            final ObjectMessage message = queueSession.createObjectMessage(pObject);
            mySender.send(message);
          } catch (JMSException e) {
            e.printStackTrace();
          }
        }

      }

      This works most of the time, but when the application gets busy, starts raising the exception given in the title.

      I am using SEAM 2.2.0.GA

      The full exception is:

      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.jms.queueSession
           at org.jboss.seam.Component.newInstance(Component.java:2144)
           at org.jboss.seam.Component.getInstance(Component.java:2021)
           at org.jboss.seam.Component.getInstance(Component.java:1983)
           at org.jboss.seam.Component.getInstance(Component.java:1977)
           at org.jboss.seam.Component.getInstance(Component.java:1957)
           at org.jboss.seam.Component.getInstance(Component.java:1952)
           at org.jboss.seam.jms.QueueSession.instance(QueueSession.java:55)
           at org.jboss.seam.jms.ManagedQueueSender.create(ManagedQueueSender.java:51)
           at sun.reflect.GeneratedMethodAccessor602.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
           at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
           at org.jboss.seam.Component.newInstance(Component.java:2132)
           ... 119 more
      Caused by: java.lang.RuntimeException: exception invoking: create
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
           at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
           at org.jboss.seam.Component.newInstance(Component.java:2132)
           ... 134 more
      Caused by: javax.jms.JMSException: Could not create a 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:426)
           at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createQueueSession(JmsSessionFactoryImpl.java:145)
           at org.jboss.seam.jms.QueueSession.create(QueueSession.java:38)
           at sun.reflect.GeneratedMethodAccessor603.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
           ... 137 more

      The relevant configuration in components.xml is:

        <jms:managed-queue-sender name="mySender"
                                  auto-create="true"
                                  queue-jndi-name="/queue/myQueue"/>

        <jms:queue-connection queue-connection-factory-jndi-name="java:/JmsXA" />

      Any help would be much appreciated.

      Cheers,