Strange warning when ejb 3 stateful bean removing on JBossAS7.1
denis.pavlishin Dec 13, 2011 7:07 AMHi! 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?