Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Accessing local entity beans from within OSGI bundles in JBoss
Accessing local entity beans from within OSGI bundles in JBoss [message #110877] Thu, 29 May 2008 05:46
Eclipse UserFriend
Originally posted by: cgan.gmx.de

Hi,

I think this issue has been treated before on this newsgroup, but I don't
seem to make any progress without some more input...

I have an ear deployed on JBoss. The ear contains an ejb.jar containing
some entity beans (3.0), a war with the servlet bridge and some bundles
(eclipse RAP, lets call it RAP.war) and a second, "classical" war for
sanity checks. I can access the local ejb from the classical war without
problems.

Some sample coding:
try {

InitialContext initialContext = new InitialContext();

Object emfo = initialContext.lookup("java:/MyManagerFactory");
EntityManagerFactory emf = (EntityManagerFactory) emfo;
return emf.createEntityManager();
} catch (Throwable nex) {
nex.printStackTrace();
return null;
}
I am able to get the Initial Context and remote debugging revealed that I
am able to get an instance of the EntityManagerFactory. Yet, the cast
fails with a NoClassDefFoundError for class
javax.persistance.EntityManagerFactory (I don't get a class cast
exception!).

The same thing happens when I try to access one of my local ejbs (MyEJB
ejb = new MyEJB();): I get another NoClassDefFoundError.

So, I need to get my rap.war to load these (and other) classes through the
class loader of the "surrounding" j2ee framework. I am pretty sure that I
cannot bundle these classes or their respective libraries into RAP.war,
because this would lead to class cast exceptions (That's what happened
when I by mistake added some of my ejb classes to the classical war.)

I tried extended framework exports in my web.xml, but it did not work. Is
this even the right approach and am I using it correctly? See below:
<init-param>
<param-name>extendedFrameworkExports</param-name>
<param-value>javax.persistence; version=1.0.0</param-value>
</init-param>

My launch.ini contains the following:
osgi.parentClassloader=app
osgi.contextClassLoaderParent=ccl

Any help is much appreciated!

Thanks,
Clemens
Previous Topic:Running an empty equinox container without console port
Next Topic:Remote debugging equinox bundles...
Goto Forum:
  


Current Time: Fri Apr 26 17:10:48 GMT 2024

Powered by FUDForum. Page generated in 0.03734 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top