Nevermind... Just found the problem... I was not calling ejbJar.addEnterpriseBean(new StatefulBean(MySessionBean.class));
... :O) tkx, Thiago. On Wed, May 26, 2010 at 7:18 PM, Thiago Veronezi <[email protected]>wrote: > Guys, > Im trying to add a unit test to the * > org.apache.openejb.core.stateful.StatefulContainerTest* class, but I cant > create a simple stateful bean. > I've added the following code to the test class... > > ******************************************* > . > . > . > @Local > public static interface MySession { > void method1(); > void method2(); > } > > @Stateful > public static class MySessionBean implements MySession { > @Resource > private SessionContext myctx; > > public void method1() { > System.out.println("Method 1 invoked!"); > myctx.getBusinessObject(MySession.class).method2(); > } > > public void method2() { > System.out.println("Method 2 invoked!"); > } > > } > } > //End of file > ******************************************* > > When executing the test, I can see that the *WidgetBean* (an existing bean > within the same class) has been created, but my *MySessionBean* is nowhere > to be found. Could you help me? > tkx, > Thiago. > > *The log...* > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@6de1dadb > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@6de1dadb > INFO - Enterprise application "org.apache.openejb.jee.ejb...@6de1dadb" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@6de1dadb > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=WidgetBean) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@6de1dadb) > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@40b86944 > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@40b86944 > INFO - Enterprise application "org.apache.openejb.jee.ejb...@40b86944" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@40b86944 > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=WidgetBean) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@40b86944) > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@242da5a6 > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@242da5a6 > INFO - Enterprise application "org.apache.openejb.jee.ejb...@242da5a6" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@242da5a6 > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=WidgetBean) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@242da5a6) > ERROR - An unexpected exception occured while invoking the preDestroy > method on the removed Stateful SessionBean instance; > java.lang.NullPointerException null > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@5c5ddd3 > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@5c5ddd3 > INFO - Enterprise application "org.apache.openejb.jee.ejb...@5c5ddd3" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@5c5ddd3 > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=WidgetBean) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@5c5ddd3) > ERROR - An unexpected exception occured while invoking the preDestroy > method on the removed Stateful SessionBean instance; > java.lang.NullPointerException null > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@2e39060b > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@2e39060b > INFO - Enterprise application "org.apache.openejb.jee.ejb...@2e39060b" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@2e39060b > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=WidgetBean) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@2e39060b) > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@5059cbda > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@5059cbda > INFO - Enterprise application "org.apache.openejb.jee.ejb...@5059cbda" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@5059cbda > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=WidgetBean) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=WidgetBean) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@5059cbda) > INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, > type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) > INFO - Configuring Service(id=Default Transaction Manager, > type=TransactionManager, provider-id=Default Transaction Manager) > INFO - Configuring Service(id=Default Security Service, > type=SecurityService, provider-id=Default Security Service) > INFO - Configuring Service(id=Default Stateful Container, type=Container, > provider-id=Default Stateful Container) > WARN - Property "PoolSize" not supported by "Default Stateful Container" > INFO - Configuring enterprise application: > org.apache.openejb.jee.ejb...@12b31a7c > WARN - Unable to scrape for @Stateful, @Stateless or @MessageDriven > annotations. Invalid EjbModule URL: org.apache.openejb.jee.ejb...@12b31a7c > INFO - Enterprise application "org.apache.openejb.jee.ejb...@12b31a7c" > loaded. > INFO - Assembling app: org.apache.openejb.jee.ejb...@12b31a7c > INFO - Jndi(name=WidgetBeanLocal) --> Ejb(deployment-id=*WidgetBean*) > INFO - Jndi(name=WidgetBeanRemote) --> Ejb(deployment-id=*WidgetBean*) > INFO - Jndi(name=WidgetBeanLocalBean) --> Ejb(deployment-id=*WidgetBean*) > INFO - Created Ejb(deployment-id=WidgetBean, ejb-name=WidgetBean, > container=Default Stateful Container) > INFO - Deployed Application(path=org.apache.openejb.jee.ejb...@12b31a7c) > > > > > *The test method...* > * > public void testMySessionBean() throws Exception { > InitialContext ctx = new InitialContext(); > Object object = ctx.lookup("MySessionBeanLocal"); > MySession bean = (MySession) object; > bean.method1(); > assertTrue(true); > } > * > >
