Hi,

here are the first results.
As I mentioned before, I focus on the client as first step.

http://www.gg-net.de/ftp/openejb3-osgi-client.zip

Download and extract.
cd openejb3/server/openejb-client-osgi-enhanced
mvn install pax:provision

You should see the following lines:
1.Test: Classic way, which does not work in OSGi environment
1.Test: .NoInitialContextException expected an catched:
javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.openejb.client.RemoteInitialContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.apache.openejb.client.RemoteInitialContextFactory]
2.Test: Direct Referencing, needs dependency to openejb-client bundle
3.Test: Request as an OSGi Service

(You can leave the felix console with shutdown)

The interesting code is:
openejb-client/org.apache.openejb.osgi.Activator
test-client/test.client.internal.ExampleActivator

Impact:
By inspecting the pom.xml you can see, that only the following
dependencies were added:
  <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>osgi_R4_core</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>osgi_R4_compendium</artifactId>
        <version>1.0</version>
    </dependency>


Steps I see before OpenEJB will be completely OSGi integrated (please
comment ):
- Approve if the OSGi dependencies are acceptable for most of the
project modules.

- All dependencies must at least supply the OSGi MANIFEST (I used the
jar-repack goal of pax to do this, but for a longshot and the ease to
develop the supplying projects, should supply the MANIFEST). Contacting
the projects, still not doing this, might take some time.

- Optionally switch some dependencies which do relay on reflective
class-loading in favor of some which dont (e.g. slf4j
[http://www.slf4j.org/] instead of commons-logging. In this special
case, no change to the code would be necessary ).

- Integrate the pax-runner tightly in the build process and tests (I
have already a handful of class-loading issues in the OSGi environment
which I don't know how to supply Unit tests via the maven build.) Anyone
here who is familiar with the maven-pax-plugin ?

As I told before, I'm trying to use OpenEJB in an Eclipse RCP
Application. Now I have some concrete problems at my hand.

- I changed the org.apache.openejb.client.proxy.Jdk13ProxyFactory to
work in OSGi.
(using the class-loader of the factory-class to for all proxy requests)
Looking forward that the changes get into the development tree. I can
resupply them also as a patch.

- In org.openejb.client.Client.processRequest on line 241
  /*----------------------------------*/
  /* Read response */
  /*----------------------------------*/
  try {
     res.readExternal(objectIn);
  } catch (ClassNotFoundException e) {
  a ClassNotFoundException in the OSGi environment is thrown (totally
expected) because the class-loader of the openejb-client does not know
the classes of different bundles. I intend to supply the needed
classloaders via a service to the openejb-client. But how do I find out
which class the Response needs  (the name as string) and how do I tell
the Response which classloader to use.  I'm looking forward for some hints.

-
Olli



Reply via email to