On Jan 27, 2009, at 10:38 AM, Donatas Ciuksys wrote:

OK.

I have an idea how I could make it run in Eclipse RCP environment, just need little your (devs) guidance. I have read the other thread about integration
to OSGi, my goal is somewhat smaller:

As I understand, OpenEJB does two things:
1. Scans classpath trying identify all the resources to be analysed
(classes, archives, ...)
2. Analyses each found resource whether it is an EJB component (possibly JPA
entity too, though this could be Hibernate's job)
3. Loads identified resources by classloader.loadClass() or similar

Since we have problem with step 1, steps 2&3 do not start (obviously).

In my scenario I do not need step 1, I could start with step 2 providing
exact class names (e.g. com.mycompany.MySessionBean) that are EJB
components. Step 3 should succeed since I'm using Eclipse- BuddyPolicy (or I
could even place the classes to the same bundle as OpenEJB itself).

So my question is: is it possible, and in what source place should I look for, to skip the classpath scan and to just provide my list of class names?

Thanks for your patience,

Thank *you* for your patience :) We definitely need some work on the OSGi support.

Setting openejb.deployments.classpath=false will disable the classpath scanning for modules, but it will still be active for looking for ejb classes. That code should just issue a warning saying "Unable to scrape for ..." and continue. If it doesn't we'll need to fix that.

Listing classes is best done in the ejb-jar.xml. At minimum you have to specify the <ejb-name> and <ejb-class> elements for each ejb. We currently will "scrape" your META-INF dir for all files rather than go for each descriptor individually, but that isn't critical, we can easily update that part to go directly at the files we are looking for which should work with a "bundle:" URL.

You ok with testing out the 3.1.1 snapshot? Can publish one for you if you need it.

-David



Donatas

-----Original Message-----
From: Daniel S. Haischt [mailto:[email protected]]
Sent: Monday, January 26, 2009 4:40 PM
To: [email protected]
Subject: Re: Using OpenEJB in Eclipse RCP application

We can't simply copy & paste code from Hibernate cause it's a LGPLed
project.

2009/1/26 Donatas Ciuksys <[email protected]>:
Hi Oliver,

Thanks for straight answer. That will save my efforts to run it.

Just for discussion:

Hibernate (EntityManager) runs in OSGi, so it must have some bundle:// protocol handling functionality, and it is open-source. Since the problem
is
the same (classpath scanning), is it possible/feasible to try to find this
functionality, and to plug it into OpenEJB?

Regards,
Donatas

-----Original Message-----
From: Oliver Günther [mailto:[email protected]]
Sent: Monday, January 26, 2009 2:29 PM
To: [email protected]
Subject: Re: Using OpenEJB in Eclipse RCP application

Hi,

to make something long very short. OpenEJB does not run in an OSGi
environment (e.g. Eclipse RCP), neither local nor remote.

The little bit longer one.
OpenEJB makes heavy usage of the of Resource (JAR) finding through the
Classloader.
Eclipse (OSGi) uses different Classloaders, which do not support the
classic way of Resource finding.
The NullPointerException is caused by the OpenEJB, by getting an OSGI
Resource String
(e.g. Expects something like /home/OpenEJB/xxx.jar,  gets :
bundle://42:22/ )

You can overcome this by setting a special OpenEJB option, which
disables the classpath inspection.
But then you get completely stuck, if you try to let openejb start you
EJBs, because it uses the same algorithm to find them.

There is an ongoing thread about the OSGi integration, but the team
seams to have other priorities, so don't expect it to run
anytime soon.

PS: Don't try to get it to run in remote mode. The OpenEJB client has
also some classloading issues, which will not work in Eclipse.

-
Olli







Reply via email to