Succeeded to load OpenEJB in Felix 1.2.1 OSGi container.
See
https://issues.apache.org/jira/browse/OPENEJB-921
for details.
It's not perfect but it fits my needs (for now - just had to produce
a proof of concept).
       /zog



Zog wrote:
> 
> Thought I should give a first update here:
> I took the approach to package the whole OpenEJB (except the javaee jar)
> inside a single bundle,
> trying to run from inside OSGi but still configuring from
> openejb.home/conf/openejb.xml and
> loading my EJBs from openejb.home/apps.
> I did 2 things:
> - created an osgi bundle with proper Import-Package and Bundle-Classpath
> entries
> (classpath contains the whole openejb/lib minus javaee)
> - dropped openejb installation in a local './openejb' dir
> - used adapted code from Guillaume OpenEjbFactory to load openejb in my
> bundle activator:
>          properties = new Properties();
>          properties.put("openejb.home", "./openejb");
>          properties.put("openejb.base", "./openejb");
>          properties.put("openejb.configuration",
> "./openejb/conf/openejb.xml");
>          properties.put("openejb.deployments.classpath.include", " ");
>          properties.put("openejb.deployments.classpath", "true");
>         
> properties.put("openejb.deployments.classpath.filter.system.apps",
> "false");
>         SystemInstance system = SystemInstance.get();
> 
>         ApplicationServer appServer = new ServerFederation();
>         system.setComponent(ApplicationServer.class, appServer);
> 
>         Assembler assembler = new Assembler();
>        
> SystemInstance.get().setComponent(org.apache.openejb.spi.Assembler.class,
> assembler);
>         Properties props = new Properties();
>         props.putAll(system.getProperties());
>         props.putAll(properties);
>         assembler.init(props);
>         assembler.build();
> 
> This works almost ok, BUT
> - because OpenEJB expect resources to be accessible through jars URLs, the
> openejb-core-3.0.jar EJBs do not load. Actually, if I use the default
> empty value for
> openejb.deployments.classpath.include, I get a NPE in
> DeploymentLoader.getWebDescriptors
> because the META-INF dirs have classpath URLs that look like
> 'bundle://5.0:1/META-INF" - looks
> like xbean ResourceFinder doesn't work well in OSGi - will look into it.
> - JNDI tree doesn't seem to be working well: I can find my beans, but not
> my datasources and 
> openejb/ subcontext is missing.
> 
> I attach the log in case someone want to have a look.
> 
>  http://www.nabble.com/file/p19924199/openejb.log openejb.log 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19977951.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to