Hi Andreas,
It hasn't changed as much as there are more shutdown requirements.
But we have added functionality to allow the container system to be
shutdown without the use of internal APIs. Give this a try.
// field in your test case
private InitialContext initialContext;
// code to boot in @OnBeforeClass
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
properties.setProperty("openejb.embedded.initialcontext.close",
"destroy");
initialContext = new InitialContext(properties);
// code in @OnAfterClass
initialContext.close();
-David
On Jul 22, 2009, at 8:52 AM, Andreas Karalus wrote:
hello,
does the shutdown code in openejb 3.1.1 have changed?
in 3.0 works fine (we had > 1000 tests up and running)
Assembler assembler =
SystemInstance.get().getComponent(Assembler.class);
for (AppInfo appInfo : assembler.getDeployedApplications()) {
assembler.destroyApplication(appInfo.jarPath);
}
OpenEJB.destroy();
with 3.1.1 this seems not to work any more. I've pasted the stacktrace
below.
In our tests, the openejb server is started/stopped per TestClass
(@OnBeforeClass, @OnAfterClass).
Running only one test class with 3.1.1 is always ok, running more
then one
class fails after the first tests.
thx in advance for help.
regards,
andreas
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)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
667)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at
de
.easycredit
.ed02
.env
.testframework
.openejb.OpenEJBFactory.initContainer(OpenEJBFactory.java:74)
at
de
.easycredit
.ed02.env.testframework.BeanFactory.initContainer(BeanFactory.java:
209)
at
de
.easycredit
.ed02
.env.testframework.embedded.SimpleTest.onBeforeClass(SimpleTest.java:
36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:
74)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:
33)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:
52)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)
Caused by: java.lang.NullPointerException
at
org
.apache
.openejb.client.LocalInitialContext.getRoot(LocalInitialContext.java:
218)
at
org
.apache
.openejb
.client
.LocalInitialContext
.getContainerSystemEjbContext(LocalInitialContext.java:211)
at
org
.apache
.openejb.client.LocalInitialContext.<init>(LocalInitialContext.java:
68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun
.reflect
.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun
.reflect
.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org
.apache
.openejb
.client
.LocalInitialContextFactory
.getLocalInitialContext(LocalInitialContextFactory.java:86)
... 22 more
java.lang.NullPointerException
at
de
.easycredit
.ed02
.env.testframework.embedded.SimpleTest.onAfterClass(SimpleTest.java:
48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:
74)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runAfters(BeforeAndAfterRunner.java:65)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:
37)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:
52)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)
--
View this message in context:
http://www.nabble.com/openejb-shutdown-with-3.1.1-tp24609135p24609135.html
Sent from the OpenEJB User mailing list archive at Nabble.com.