On Sat, Oct 17, 2009 at 12:16 AM, Jacek Laskowski
<jacek@laskowski.net.pl> wrote:
> I'm trying to figure out how to proceed with OSGi'fication of the
> current openejb codebase and have created an ejb3 client that worked
> fine standalone. When I run the client as a osgi bundle with
> appropriate imports the client was not able to instantiate the
> LocalInitialContextFactory (I believe it's java.lang.Class.forName
> that messes it up). I guess it needs another approach for JNDI context
> creation.
Got it resolved. The necessary change in the client code was to link
the current classloader with the thread's one.
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
It's one of the very well-known issues while migrating common java
apps into OSGi env.
Jacek
--
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl
|