users@glassfish.java.net

Re: Unable to get an OSGi modular application working in GF 3.1.2.2 FP

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Thu, 08 Nov 2012 22:54:20 +0530

This should work. Take a look at one of your test applications where an
OSGi service is injected into a JAX-WS end point:

https://svn.java.net/svn/glassfish~svn/trunk/fighterfish/test/testapp/test.app17

When you deploy the wab called test.app17.war, you will see a message
like this in server.log:

HelloWebService listening at address at
http://<host>:<port>/test.app17/HelloWebServiceService

and the WSDL is accessible at:

http:<host>:<port>/test.app17/HelloWebServiceService?wsdl

HTH,
Sahoo

On Thursday 08 November 2012 06:55 PM, forums_at_java.net wrote:
> Hello, I'm trying to implement my first OSGi hybrid application with GF
> 3.1.2.2. This is what I would like the design to be like: 1 OGSi
> bundle with
> my API contains Java Intefaces 1 OSGi bundle with the implementation
> contains
> @Stateless annotated POJO, Manifest.MF contains Export-EJB: ALL 1 OSGi
> bundle
> with the domain classes contains @Entity classes for JPA2 persistency
> 1 OSGi
> web application bundle to expose the business logic as Servlet or Web
> Service
> should contain @WebService or @WebServlet annotated classes contains an
> beans.xml file I use @Inject @OSGiService(dynamic=true) to inject my EJB
> exported service into the code I've no problem to develop (Eclipse
> Indigo)
> the 3 first bundles. I export the 3 bundles as JAR files and deploy
> them in
> {GF-HOME}/domains/domain1/autodeploy/bundles In the Felix Remote shell my
> bundles are deployed and marked as active. Unfortunately I don't know
> how to
> get the last bundles (WAB) working. When I export as JAR file, I don't
> know
> where to find the WSDL definition for the WebService. In the web admin
> console, there's no WebService entry (because it's OSGi bundle). When I
> deploy as WAR file, I see the application in the Web Admin console, I
> can see
> the WSDL and even the WS tester but the injected service is always
> NULL. I
> happen to get the following stack trace in the server.log:
> [#|2012-11-08T12:32:31.174+0100|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=18;_ThreadName=Thread-3;|Installed
>
> /Users/alexweirig/devel/glassfish3.1.2.2/glassfish/domains/domain1/autodeploy/bundles/lu.tlk.schoolresorts.ws_1.0.0.201211081232.jar|#]
>
> [#|2012-11-08T12:32:31.176+0100|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=18;_ThreadName=Thread-3;|Started
>
> bundle:
> file:/Users/alexweirig/devel/glassfish3.1.2.2/glassfish/domains/domain1/autodeploy/bundles/lu.tlk.schoolresorts.ws_1.0.0.201211081232.jar|#]
>
> [#|2012-11-08T12:32:31.176+0100|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=18;_ThreadName=Thread-3;|Started
>
> bundle:
> file:/Users/alexweirig/devel/glassfish3.1.2.2/glassfish/domains/domain1/autodeploy/bundles/lu.tlk.schoolresorts.ws_1.0.0.201211081232.jar|#]
>
> [#|2012-11-08T12:32:31.182+0100|INFO|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=20;_ThreadName=Thread-3;|Expanded
>
> at
> file:/var/folders/8m/p4qtrs0s39g0k1z99h8ll7_80000gp/T/osgiapp5009226054725074508/|#]
>
> [#|2012-11-08T12:32:31.225+0100|SEVERE|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=20;_ThreadName=Thread-3;|Exception
>
> while invoking class org.glassfish.weld.WeldDeployer load method
> java.lang.NullPointerException at
> org.glassfish.weld.BeanDeploymentArchiveImpl.handleEntry(BeanDeploymentArchiveImpl.java:504)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.collectJarInfo(BeanDeploymentArchiveImpl.java:482)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:422)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.(BeanDeploymentArchiveImpl.java:148)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.(BeanDeploymentArchiveImpl.java:128)
>
> at org.glassfish.weld.DeploymentImpl.(DeploymentImpl.java:121) at
> org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:386) at
> org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:100) at
> org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186) at
> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>
> at
> org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
>
> at
> org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
>
> at
> org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
>
> at
> org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
> at
> org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
>
> at
> org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
>
> at
> org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
>
> at
> org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
>
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at
> java.util.concurrent.FutureTask.run(FutureTask.java:138) at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
> at java.lang.Thread.run(Thread.java:680) |#]
> [#|2012-11-08T12:32:31.226+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=20;_ThreadName=Thread-3;|Exception
>
> while loading the app|#]
> [#|2012-11-08T12:32:31.231+0100|INFO|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=20;_ThreadName=Thread-3;|Deleted
>
> /var/folders/8m/p4qtrs0s39g0k1z99h8ll7_80000gp/T/osgiapp5009226054725074508|#]
>
> [#|2012-11-08T12:32:31.231+0100|SEVERE|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=20;_ThreadName=Thread-3;|Failed
>
> while deploying bundle lu.tlk.schoolresorts.ws [313]|#]
> [#|2012-11-08T12:32:31.231+0100|INFO|glassfish3.1.2|org.glassfish.osgiweb|_ThreadID=20;_ThreadName=Thread-3;|Removed
>
> bundle 313 against context path /lu.tlk.schoolresorts.ws |#]
> [#|2012-11-08T12:32:31.231+0100|WARNING|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=20;_ThreadName=Thread-3;|Failed
>
> to deploy bundle lu.tlk.schoolresorts.ws [313]
> org.glassfish.osgijavaeebase.DeploymentException: Deployment of
> lu.tlk.schoolresorts.ws [313] failed because of following reason: Failed
> while deploying bundle lu.tlk.schoolresorts.ws [313] :
> java.lang.RuntimeException: Failed to deploy bundle [
> lu.tlk.schoolresorts.ws
> [313] ], root cause: Exception while loading the app at
> org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:125)
>
> at
> org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
> at
> org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
>
> at
> org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
>
> at
> org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
>
> at
> org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
>
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at
> java.util.concurrent.FutureTask.run(FutureTask.java:138) at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
> at java.lang.Thread.run(Thread.java:680) Caused by:
> java.lang.RuntimeException: Failed to deploy bundle [
> lu.tlk.schoolresorts.ws
> [313] ], root cause: Exception while loading the app at
> org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:196)
>
> at
> org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
>
> at
> org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
>
> ... 10 more Caused by: java.lang.NullPointerException at
> org.glassfish.weld.BeanDeploymentArchiveImpl.handleEntry(BeanDeploymentArchiveImpl.java:504)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.collectJarInfo(BeanDeploymentArchiveImpl.java:482)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:422)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.(BeanDeploymentArchiveImpl.java:148)
>
> at
> org.glassfish.weld.BeanDeploymentArchiveImpl.(BeanDeploymentArchiveImpl.java:128)
>
> at org.glassfish.weld.DeploymentImpl.(DeploymentImpl.java:121) at
> org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:386) at
> org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:100) at
> org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186) at
> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>
> at
> org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
>
> ... 12 more |#] What am I missing? Many thanks in advance for your
> support
> Alex
>
> --
>
> [Message sent by forum member 'alexweirig']
>
> View Post: http://forums.java.net/node/892076
>
>