I attached a simple JUnit to show that OpenEJB.destroy does not work well in
3.1-SNAPSHOT (with 3.0 the same code works). Maybe it helps...
public class OpenEJBTest {
@Before
public void onBefore() throws Exception{
if(! OpenEJB.isInitialized()){
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
InitialContext ctx = new InitialContext(props);
}
}
@After
public void onAfter() throws Exception{
if(OpenEJB.isInitialized()){
OpenEJB.destroy();
}
}
@Test
public void test1() throws Exception{
InitialContext ctx = new InitialContext();
// test some lookups
UserTransaction utx = (UserTransaction)
ctx.lookup("java:comp/UserTransaction");
Assert.assertNotNull(utx);
TransactionManager tm = (TransactionManager)
ctx.lookup("java:comp/TransactionManager");
Assert.assertNotNull(tm);
}
@Test
public void test2(){
// this is just to test startup shutdown of openejb
// I run well with 3.0 but I fail with 3.1-SNAPSHOT
System.out.println("run test2");
}
}
Andreas Karalus wrote:
>
> Hi David,
>
> thank you for your efforts, I really appreciate it.
> I tried the new SNAPSHOT libraries, and the lookup works very well. Thank
> you again for providing a great support. However, I run into other
> problems (maybe because of SNAPSHOT?). I just want to give feedback on it.
>
> - the startup/shutdown behaviour of openejb may have changed? I start
> openejb in every junit test @BeforeClass, and call OpenEJB.destroy() in
> @AfterClass. Running a single test works fine, running all tests together
> (e.g. maven test) fail after the first test. If I do not call
> OpenEJB.destroy() in @AfterClass, all tests run again fine, so I suppose
> that OpenEJB.destroy() is the cause. Below is a stacktrace.
>
>
--
View this message in context:
http://www.nabble.com/UserTransaction-in-openejb-tp19313741p19529660.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.