Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-10339

Seam 2.2 chatroom: connectAndChat test sometimes fails due to a NPE in org.jboss.seam.jms.TopicSession

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • EAP_EWP 5.2.0 ER2
    • Seam2, Testsuite
    • None
    • RHEL5_x86_64, JBoss EAP 6.0.1.ER3, Oracle JDK 1.6.0_30

    • Hide
      1. Create JMS queue
        $JBOSS_DIR/bin/jboss-cli.sh "connect,jms-topic add --topic-address=chatroomTopic --entries=topic/chatroomTopic"
      2. Build and deploy the migrated Seam 2.2 remoting/chatroom example
      3. Run the test
      Show
      Create JMS queue $JBOSS_DIR/bin/jboss-cli.sh "connect,jms-topic add --topic-address=chatroomTopic --entries=topic/chatroomTopic" Build and deploy the migrated Seam 2.2 remoting/chatroom example Run the test
    • Workaround Exists
    • Hide

      Add the following class to the project:

      import org.jboss.seam.annotations.*;
      import org.jboss.seam.ScopeType;
      import javax.jms.TopicConnection;
      
      @Name("topicConnectionStartup") 
      @Startup
      @Scope(ScopeType.APPLICATION)
      public class TopicConnectionStartup {
          @In(value="org.jboss.seam.jms.topicConnection", create=true) 
          private TopicConnection topicConnection; 
      
          @Create
          public void init() {
              System.out.println(topicConnection.toString()); // arbitrary call to invoke injection of topicConnection
        }
      }
      
      Show
      Add the following class to the project: import org.jboss.seam.annotations.*; import org.jboss.seam.ScopeType; import javax.jms.TopicConnection; @Name( "topicConnectionStartup" ) @Startup @Scope(ScopeType.APPLICATION) public class TopicConnectionStartup { @In(value= "org.jboss.seam.jms.topicConnection" , create= true ) private TopicConnection topicConnection; @Create public void init() { System .out.println(topicConnection.toString()); // arbitrary call to invoke injection of topicConnection } }
    • Hide
      By design, Seam puts newly instantiated components into the scopes before calling the @Create or @PostConstruct methods. The Seam JMS Components TopicConnection and QueueConnection do not synchronize access to their @Create and @Unwrap methods. This causes multiple concurrent requests that are the first to require these components to inject instances of these built-in application-scoped components before they are instantiated. To work around this issue, you can force the components to be created during application start-up. In this case, there is no risk of this race condition occurring. The following example code shows how to apply this work-around:

      import org.jboss.seam.annotations.*;
      import org.jboss.seam.ScopeType;
      import javax.jms.TopicConnection;

      @Name("topicConnectionStartup")
      @Startup
      @Scope(ScopeType.APPLICATION)
      public class TopicConnectionStartup {
          @In(value="org.jboss.seam.jms.topicConnection", create=true)
          private TopicConnection topicConnection;

          @Create
          public void init() {
              System.out.println(topicConnection.toString()); // arbitrary call to invoke injection of topicConnection
        }
      }

      If you apply the work-around, the components are created during application start-up and no race condition occurs.
      Show
      By design, Seam puts newly instantiated components into the scopes before calling the @Create or @PostConstruct methods. The Seam JMS Components TopicConnection and QueueConnection do not synchronize access to their @Create and @Unwrap methods. This causes multiple concurrent requests that are the first to require these components to inject instances of these built-in application-scoped components before they are instantiated. To work around this issue, you can force the components to be created during application start-up. In this case, there is no risk of this race condition occurring. The following example code shows how to apply this work-around: import org.jboss.seam.annotations.*; import org.jboss.seam.ScopeType; import javax.jms.TopicConnection; @Name("topicConnectionStartup") @Startup @Scope(ScopeType.APPLICATION) public class TopicConnectionStartup {     @In(value="org.jboss.seam.jms.topicConnection", create=true)     private TopicConnection topicConnection;     @Create     public void init() {         System.out.println(topicConnection.toString()); // arbitrary call to invoke injection of topicConnection   } } If you apply the work-around, the components are created during application start-up and no race condition occurs.
    • Not Yet Documented
    • NEW

    Description

      The connectAndChat test intermittently fails.
      This seems to happen in Seam 2.3 as well.

      Test error:

      com.thoughtworks.selenium.Wait$WaitTimedOutException: Timeout while waiting for asynchronous update of xpath=//div/select[@id='userList']/option[contains(text(),'Martin')]
      

      Server log:

      14:34:36,328 ERROR [org.jboss.as.ejb3.invocation] (http-/127.0.0.1:8080-3) JBAS014134: EJB Invocation failed on component ChatRoomAction for method public abstract boolean org.jboss.seam.example.remoting.chatroom.ChatRoomActionWebRemote.connect(java.lang.String): javax.ejb.EJBException: org.jboss.seam.InstantiationException: Could not instantiate Seam component: topicPublisher
          at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:164) [jboss-as-ejb3-7.1.3.Final-redhat-3.jar:7.1.3.Final-redhat-3]
          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.3.Final-redhat-3.jar:7.1.3.Final-redhat-3]
          ...
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: topicPublisher
          at org.jboss.seam.Component.newInstance(Component.java:2197) [jboss-seam.jar:2.2.6.EAP5]
          at org.jboss.seam.Component.getInstance(Component.java:2021) [jboss-seam.jar:2.2.6.EAP5]
          ...
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.jms.topicSession
          at org.jboss.seam.Component.newInstance(Component.java:2197) [jboss-seam.jar:2.2.6.EAP5]
          at org.jboss.seam.Component.getInstance(Component.java:2021) [jboss-seam.jar:2.2.6.EAP5]
          ...
      Caused by: java.lang.NullPointerException
          at org.jboss.seam.jms.TopicSession.create(TopicSession.java:38) [jboss-seam.jar:2.2.6.EAP5]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_30]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_30]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_30]
          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_30]
          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.2.6.EAP5]
          at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam.jar:2.2.6.EAP5]
          at org.jboss.seam.Component.callComponentMethod(Component.java:2302) [jboss-seam.jar:2.2.6.EAP5]
          at org.jboss.seam.Component.callCreateMethod(Component.java:2225) [jboss-seam.jar:2.2.6.EAP5]
          at org.jboss.seam.Component.newInstance(Component.java:2185) [jboss-seam.jar:2.2.6.EAP5]
          ... 138 more
      

      Attachments

        Issue Links

          Activity

            People

              mnovotny@redhat.com Marek Novotny
              rsmeral Ron Šmeral (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: