Hi,

I have a problem with some unit tests who need to start/stop the embedded
container in the same JVM instance. I have a singleton EJB which uses a
connection factory via injection:

@Singleton
@Startup
public class DummyResourceBean
{
    @Resource
    private ConnectionFactory connectionFactory;

    ...
}

When the container is restarted with a fresh InitialContext I get the
following error:

javax.naming.NamingException: Cannot instantiate a LocalInitialContext.
Exception: java.lang.NullPointerException null [Root exception is
java.lang.NullPointerException]
        at
org.apache.openejb.client.LocalInitialContextFactory.getLocalInitialContext(LocalInitialContextFactory.java:98)
        at
org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:43)
        ...
Caused by: java.lang.NullPointerException
        at
org.apache.openejb.client.LocalInitialContext.getRoot(LocalInitialContext.java:165)
        at
org.apache.openejb.client.LocalInitialContext.getContainerSystemEjbContext(LocalInitialContext.java:158)
        at
org.apache.openejb.client.LocalInitialContext.<init>(LocalInitialContext.java:64)
        ...

If I remove the connection factory reference from my resource bean it works!

It looks like the resource is not correctly cleaned after the first
shutdown...

NOTE: To shutdown the container I'm using this system property:
openejb.embedded.initialcontext.close=DESTROY

Thanks

Christian

Reply via email to