tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Fryer <>
Subject Re: Difference of initializing context
Date Sun, 23 Sep 2012 03:25:57 GMT
You don't need the application-client.xml file if you use the @ManagedBean
annotation on your unit test classes instead of @LocalClient.  Using
@ManagedBean also means @Inject will work in your test cases and you can
re-use the same container across mutlipe junit tests.

Using @LocalClient you bind using this code...

Properties p = new Properties();
InitialContext ctx = new InitialContext(p);
ctx.bind("inject", this);

Using @ManagedBean you have to bind like this...

ejbContainer.getContext().bind("inject", this);

I recommend replacing @LocalClient with @ManagedBean, get rid of
application-client.xml and changing your test cases to use
ejbContainer.getContext().bind("inject", this);

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message