7 Replies Latest reply on Mar 6, 2012 4:00 AM by martijnzuidhof

    Strange warning when ejb 3 stateful bean removing on JBossAS7.1

    denis.pavlishin

      Hi! I deploy my simple stateful bean on JBossAS7.1.

       

       

      Remote interface:

       

          package ejbserver.session.test; 
          import javax.ejb.Remote; 
          import javax.ejb.Remove; 
      
          @Remote 
          public interface TestStateful { 
              public void test(); 
              @Remove 
              public void remove(); 
          }
      

      Stateful bean:

       

       

       

       package ejbserver.session.test; 
          import javax.annotation.PreDestroy; 
          import javax.ejb.Remove; 
          import javax.ejb.Stateful;     
      
          @Stateful
          public class TestStatefulBean implements TestStateful {
      
                    @Override
                    public void test() {
                              System.out.println("test");
      
                    }
      
                    @Override
                    @Remove
                    public void remove() {
                              System.out.println("remove");
                    }
      
                    @PreDestroy
                    public void predestroy(){
                              System.out.println("predestroy");
                    }
      
          }
      

      Test client:

       

       

       package testclient; 
          import java.security.Security;  
          import java.util.Hashtable; 
          import javax.jms.JMSException; 
          import javax.naming.Context; 
          import javax.naming.InitialContext; 
          import javax.naming.NamingException; 
          import org.apache.log4j.BasicConfigurator; 
          import org.jboss.sasl.JBossSaslProvider; 
          import ejbserver.FacadeFactory; 
          import ejbserver.session.test.TestStateful; 
      
          public class Main {
                private static final String appName = "JBossModules";
                private static final String moduleName = "EjbModule";
                private static final String distinctName = "";
      
      
                    static {
                              Security.addProvider(new JBossSaslProvider());
                    }
      
                    private static Context getInitialContext() throws NamingException {
                              Hashtable<String, String> environment = new Hashtable<String, String>();
                              environment.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
                              return new InitialContext(environment);
                    }
      
      
                private static String getStatelessConnectionString(Class<?> facadeClass) {
                          final String beanName = facadeClass.getSimpleName() + "Bean";
                          final String viewClassName = facadeClass.getName();
                          return "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName;
                }
      
      
                private static String getStatefullConnectionString(Class<?> facadeClass) {
                          return getStatelessConnectionString(facadeClass)+"?stateful";
                }
      
                    public static void main(String[] args) throws NamingException, JMSException {
                              BasicConfigurator.configure();
                              TestStateful remote = (TestStateful) getInitialContext().lookup(getStatefullConnectionString(TestStateful.class));
                              remote.test();
                              remote.remove();
                    }
          }
      

       

      But when I run the client, I see the following log:

       

          12:20:20,163 INFO  [stdout] (pool-8-thread-2) test 
          12:20:20,194 INFO  [stdout] (pool-8-thread-3) remove 
          12:20:20,194 WARN  [org.jboss.as.ejb3] (pool-8-thread-3) JBAS014101: Could not find stateful bean to release {[-103, -76, 39, 39, 74, 102, 71, -83, -123, -27, 88, 87, 104, -93, 56, 61]} 
          12:20:20,194 INFO  [stdout] (pool-8-thread-3) predestroy
      

       

      What this warning "Could not find stateful bean to release {[-103, -76, 39, 39, 74, 102, 71, -83, -123, -27, 88, 87, 104, -93, 56, 61]}" means and why the bean can't be finded?

        • 1. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
          jaikiran

          Denis Pavlishin wrote:

              12:20:20,163 INFO  [stdout] (pool-8-thread-2) test 
              12:20:20,194 INFO  [stdout] (pool-8-thread-3) remove 
              12:20:20,194 WARN  [org.jboss.as.ejb3] (pool-8-thread-3) JBAS014101: Could not find stateful bean to release {[-103, -76, 39, 39, 74, 102, 71, -83, -123, -27, 88, 87, 104, -93, 56, 61]} 
              12:20:20,194 INFO  [stdout] (pool-8-thread-3) predestroy
          

           

          What this warning "Could not find stateful bean to release {[-103, -76, 39, 39, 74, 102, 71, -83, -123, -27, 88, 87, 104, -93, 56, 61]}" means and why the bean can't be finded?

          That long sequence of numbers is the session id for that stateful bean (we could perhaps just not log that session id in the warn since it doesn't convey much). As to why you see that WARN, I'll have to check the AS7 code on what's going on.

          • 2. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
            blabno

            Any progress on this?

            I'm having the same issue. I want to migrate production app (seam2) from AS 4.2.2.GA to AS 7.1 but this message worries me.

            • 3. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
              smarlow

              Rather than removing the long sequence of numbers (ID), it would be niced if we logged something about the bean when its ID is generated, so the long sequence of numbers could be correlated back to a particular bean.

              • 4. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
                jaikiran

                Scott Marlow wrote:

                 

                Rather than removing the long sequence of numbers (ID), it would be niced if we logged something about the bean when its ID is generated, so the long sequence of numbers could be correlated back to a particular bean.

                That's a good point. I'll do that (at DEBUG level).

                • 5. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
                  smarlow

                  http://pastebin.com/S9YDqjSr shows the call stack to one of these warnings  It looks like its part of bean passivation code.  INFO might not be the right log level for that message (also not sure if that message should be logged when passivation is not enabled).

                  • 6. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
                    wolfc

                    The id of a SFSB is better expressed as a hex number with a full EJB name (app+mod+name).

                     

                    The warning is a valid one and should remain at warning level. This is a bug detection. StatefulRemoveInterceptor has already removed the bean and then StatefulSessionSynchronizationInterceptor tries to release it. Basically if remove succeeds (under the conditions mentioned in 4.6) then the StatefulSessionSynchronizationInterceptor should do nothing.

                     

                    EJB 3.1 MREL 4.6 Stateful Session Bean State Diagram

                    If the Remove method completes successfully or if the Remove methods throws an application exception for which retainIfException is not true or if a system exception is thrown, session synchronization methods are not called on the bean instance. If an application exception is thrown for which retainIfException is true, the bean is neither destroyed nor discarded, and session synchronization methods, if any, are called on the instance at the end of transaction.

                    • 7. Re: Strange warning when ejb 3 stateful bean removing on JBossAS7.1
                      martijnzuidhof

                      Hi guys,

                       

                      Any news on this? Is this a bug? Is there a workaround?