Re: OpenEJB in an OSGi container
> > 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 What about a wiki/blob about this Proof Of Concept. Good works !
Re: OpenEJB in an OSGi container
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.
Re: OpenEJB in an OSGi container
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-tp19905326p19924199.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB in an OSGi container
I'm using apache Felix 1.2.1 with OSGi 1.4. I've no code to share yet - I started on this just recently and am still in information gathering mode :) but for sure I'll share this once I get it to work. Thanks a lot for the help /Zog David Blevins wrote: > > Thanks, Guillaume. That gives me a pretty good idea on what the > pieces are. > > Zog, let me know what OSGi kernel and version you're using and I'll > see if I can't whip up some boot code for you. If you've got any > starter code you can share, feel free to zip it up and attach it do a > JIRA (created a jira for you here > https://issues.apache.org/jira/browse/OPENEJB-921) > > -David > > > On Oct 9, 2008, at 2:47 PM, Guillaume Nodet wrote: > >> It's been a long time since I work on that and I still have not found >> the time to continue this integration work. >> Anyway, the code I used is available at: >> http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ >> ejb3 >> It uses a spring-powered bundle to set up OpenEJB: >> >> http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml >> and the related java classes are available at: >> >> http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/ >> >> Unfortunately, this may be a bit outdated :-( >> >> Anyway, the idea was to be able to listen to newly installed bundles >> and discover EJB inside those so that they are automatically >> configured as plain EJB or web services. >> Though, this was in the context of ServiceMix, where the EJBs were to >> be exposed on the JBI bus and eventually through HTTP/SOAP too. >> >> On Thu, Oct 9, 2008 at 9:26 PM, David Blevins >> <[EMAIL PROTECTED]> wrote: >>> Guillaume is the one who's done most the work in this area in >>> regards to his >>> use of OpenEJB in the OSGi-based ServiceMix 4. >>> >>> What boot technique did you use in ServieMix? >>> >>> >>> -David >>> >>> >>> On Oct 9, 2008, at 2:08 PM, Zog wrote: >>> Hi So, I managed to get my EJB app running just fine in Tomcat/ OpeneEJB. Now that it validates the J2EE support I need from OpenEJB, I'd like to move all this to an OSGi container. Any hints on where I should look for information ? I scanned through the web and although it's stated everywhere that OpenEJB is packaged as OSGi bundled, I couldn't find information on how to start openejb in osgi. I tried a simple approach where I load everything in openejb/lib from the system classpath, but got a mysterious exception: Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot initailize OpenEJB: null at org .apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE JB(InitContextFactory.java:88) at org .apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte xt(InitContextFactory.java:35) at org .apache.openejb.client.LocalInitialContextFactory.getIntraVmContex t(LocalInitialContextFactory.java:114) That's most probably related to the way OSGi does classloading, and I'm investigating. Should I look at the way you embedded OpenEJB for Tomcat ? Or should I look elsewhere ? Any clue welcomed :) /Zog PS: Btw, finding http://openejb.apache.org/apidocs is not very easy on the openejb site - I had to scan through the forums to find that one. -- View this message in context: http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html Sent from the OpenEJB User mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Cheers, >> Guillaume Nodet >> >> Blog: http://gnodet.blogspot.com/ >> >> Open Source SOA >> http://open.iona.com >> > > > -- View this message in context: http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19907692.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB in an OSGi container
Thanks, Guillaume. That gives me a pretty good idea on what the pieces are. Zog, let me know what OSGi kernel and version you're using and I'll see if I can't whip up some boot code for you. If you've got any starter code you can share, feel free to zip it up and attach it do a JIRA (created a jira for you here https://issues.apache.org/jira/browse/OPENEJB-921) -David On Oct 9, 2008, at 2:47 PM, Guillaume Nodet wrote: It's been a long time since I work on that and I still have not found the time to continue this integration work. Anyway, the code I used is available at: http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ ejb3 It uses a spring-powered bundle to set up OpenEJB: http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml and the related java classes are available at: http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/ Unfortunately, this may be a bit outdated :-( Anyway, the idea was to be able to listen to newly installed bundles and discover EJB inside those so that they are automatically configured as plain EJB or web services. Though, this was in the context of ServiceMix, where the EJBs were to be exposed on the JBI bus and eventually through HTTP/SOAP too. On Thu, Oct 9, 2008 at 9:26 PM, David Blevins <[EMAIL PROTECTED]> wrote: Guillaume is the one who's done most the work in this area in regards to his use of OpenEJB in the OSGi-based ServiceMix 4. What boot technique did you use in ServieMix? -David On Oct 9, 2008, at 2:08 PM, Zog wrote: Hi So, I managed to get my EJB app running just fine in Tomcat/ OpeneEJB. Now that it validates the J2EE support I need from OpenEJB, I'd like to move all this to an OSGi container. Any hints on where I should look for information ? I scanned through the web and although it's stated everywhere that OpenEJB is packaged as OSGi bundled, I couldn't find information on how to start openejb in osgi. I tried a simple approach where I load everything in openejb/lib from the system classpath, but got a mysterious exception: Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot initailize OpenEJB: null at org .apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE JB(InitContextFactory.java:88) at org .apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte xt(InitContextFactory.java:35) at org .apache.openejb.client.LocalInitialContextFactory.getIntraVmContex t(LocalInitialContextFactory.java:114) That's most probably related to the way OSGi does classloading, and I'm investigating. Should I look at the way you embedded OpenEJB for Tomcat ? Or should I look elsewhere ? Any clue welcomed :) /Zog PS: Btw, finding http://openejb.apache.org/apidocs is not very easy on the openejb site - I had to scan through the forums to find that one. -- View this message in context: http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html Sent from the OpenEJB User mailing list archive at Nabble.com. -- Cheers, Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://open.iona.com
Re: OpenEJB in an OSGi container
It's been a long time since I work on that and I still have not found the time to continue this integration work. Anyway, the code I used is available at: http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3 It uses a spring-powered bundle to set up OpenEJB: http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml and the related java classes are available at: http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/ Unfortunately, this may be a bit outdated :-( Anyway, the idea was to be able to listen to newly installed bundles and discover EJB inside those so that they are automatically configured as plain EJB or web services. Though, this was in the context of ServiceMix, where the EJBs were to be exposed on the JBI bus and eventually through HTTP/SOAP too. On Thu, Oct 9, 2008 at 9:26 PM, David Blevins <[EMAIL PROTECTED]> wrote: > Guillaume is the one who's done most the work in this area in regards to his > use of OpenEJB in the OSGi-based ServiceMix 4. > > What boot technique did you use in ServieMix? > > > -David > > > On Oct 9, 2008, at 2:08 PM, Zog wrote: > >> >> Hi >> So, I managed to get my EJB app running just fine in Tomcat/OpeneEJB. Now >> that it validates the J2EE support I need from OpenEJB, I'd like to move >> all >> this >> to an OSGi container. >> Any hints on where I should look for information ? >> I scanned through the web and although it's stated everywhere that OpenEJB >> is packaged as OSGi bundled, I couldn't find information on how to start >> openejb >> in osgi. >> I tried a simple approach where I load everything in openejb/lib from the >> system classpath, >> but got a mysterious exception: >> Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot >> initailize >> OpenEJB: null >> at >> org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE >> JB(InitContextFactory.java:88) >> at >> org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte >> xt(InitContextFactory.java:35) >> at >> org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex >> t(LocalInitialContextFactory.java:114) >> >> That's most probably related to the way OSGi does classloading, and I'm >> investigating. >> >> Should I look at the way you embedded OpenEJB for Tomcat ? Or should I >> look >> elsewhere ? >> Any clue welcomed :) >> /Zog >> >> PS: Btw, finding http://openejb.apache.org/apidocs is not very easy on the >> openejb site - >> I had to scan through the forums to find that one. >> -- >> View this message in context: >> http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html >> Sent from the OpenEJB User mailing list archive at Nabble.com. >> >> > > -- Cheers, Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://open.iona.com
Re: OpenEJB in an OSGi container
(in case that was for me and not for Guillaume N): I'm not using servicemix - I'd like to have openejb running in a plain barebone Felix installation. That would be the start, then I'd take a look at how to deploy ejbs in there (i.e. directly via the openeejb conf or as bundles like Guillaume has done). David Blevins wrote: > > Guillaume is the one who's done most the work in this area in regards > to his use of OpenEJB in the OSGi-based ServiceMix 4. > > What boot technique did you use in ServieMix? > > > -David > > > On Oct 9, 2008, at 2:08 PM, Zog wrote: > >> >> Hi >> So, I managed to get my EJB app running just fine in Tomcat/ >> OpeneEJB. Now >> that it validates the J2EE support I need from OpenEJB, I'd like to >> move all >> this >> to an OSGi container. >> Any hints on where I should look for information ? >> I scanned through the web and although it's stated everywhere that >> OpenEJB >> is packaged as OSGi bundled, I couldn't find information on how to >> start >> openejb >> in osgi. >> I tried a simple approach where I load everything in openejb/lib >> from the >> system classpath, >> but got a mysterious exception: >> Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot >> initailize >> OpenEJB: null >>at >> org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE >> JB(InitContextFactory.java:88) >>at >> org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte >> xt(InitContextFactory.java:35) >>at >> org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex >> t(LocalInitialContextFactory.java:114) >> >> That's most probably related to the way OSGi does classloading, and >> I'm >> investigating. >> >> Should I look at the way you embedded OpenEJB for Tomcat ? Or should >> I look >> elsewhere ? >> Any clue welcomed :) >> /Zog >> >> PS: Btw, finding http://openejb.apache.org/apidocs is not very easy >> on the >> openejb site - >> I had to scan through the forums to find that one. >> -- >> View this message in context: >> http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html >> Sent from the OpenEJB User mailing list archive at Nabble.com. >> >> > > > -- View this message in context: http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905846.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB in an OSGi container
Guillaume is the one who's done most the work in this area in regards to his use of OpenEJB in the OSGi-based ServiceMix 4. What boot technique did you use in ServieMix? -David On Oct 9, 2008, at 2:08 PM, Zog wrote: Hi So, I managed to get my EJB app running just fine in Tomcat/ OpeneEJB. Now that it validates the J2EE support I need from OpenEJB, I'd like to move all this to an OSGi container. Any hints on where I should look for information ? I scanned through the web and although it's stated everywhere that OpenEJB is packaged as OSGi bundled, I couldn't find information on how to start openejb in osgi. I tried a simple approach where I load everything in openejb/lib from the system classpath, but got a mysterious exception: Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot initailize OpenEJB: null at org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE JB(InitContextFactory.java:88) at org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte xt(InitContextFactory.java:35) at org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex t(LocalInitialContextFactory.java:114) That's most probably related to the way OSGi does classloading, and I'm investigating. Should I look at the way you embedded OpenEJB for Tomcat ? Or should I look elsewhere ? Any clue welcomed :) /Zog PS: Btw, finding http://openejb.apache.org/apidocs is not very easy on the openejb site - I had to scan through the forums to find that one. -- View this message in context: http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html Sent from the OpenEJB User mailing list archive at Nabble.com.