users@glassfish.java.net

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

From: Alex Weirig <alex.weirig_at_technolink.lu>
Date: Fri, 09 Nov 2012 13:51:21 +0100

Hello Sahoo,

that was it !!!

I had the beans.xml sitting in the META-INF not the WEB-INF, I moved it
and now my Servlet is available and the injection works fine.

Still struggling with the WebService.

Again, thank you very much for your support.


Schéin Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique


Ville de Luxembourg - Centre Technolink
2, rue Charles de Tornaco
L - 2623 LUXEMBOURG
alex.weirig_at_technolink.lu <mailto:alex.weirig_at_technolink.lu>
Tel: +352 4796 - 6127
Fax: +352 42 88 81
www.technolink.lu <http://www.technolink.lu>

On 09/11/12 09:19, Sahoo wrote:
> Alex,
>
> The NPE that you reported during deployment could be caused by
> incorrect packaging. Someone just reported in glassfish forum that if
> you package your beans.xml in META-INF instead of WEB-INF dir for a
> war, then weld deployer throws NPE. So, check where is your beans.xml
> packaged.
>
> In my code I used an activator as an example. You can use the
> @Stateless and Export-EJB to achieve the same. You can actually deploy
> your bundle and use Felix shell to verify that the service exported
> like this:
>
> inspect s c <bundle id>
>
> You have to deploy the WAB as a bundle. Here are your deployment options:
>
> a) asadmin deploy --type osgi <wab>
> b) cp <wab> autodpeloy/bundles/ (Note it is autodeploy/bundles - not
> autodeploy/applications/bundles as you mentioned in your email)
> c) Use felix shell or any other mechanism to install and start the bundle.
>
> Thanks,
> Sahoo
>
> On Friday 09 November 2012 01:19 PM, Alex Weirig wrote:
>> Hello Sahoo,
>>
>> thank you for your reply and the link to the test application. When I
>> compare your code with mine I do only see 2 differences:
>> 1) I annotated my implementation with @Stateless to make it an EJB
>> - in your code it's a POJO
>> 2) I used Export-EJB: All in the Manifest.MF in order to turn the EJB
>> into an OSGi service - in your code you use a BundleActivator
>> to register the POJO as service in the Context
>>
>> Does that make the difference? I thought Export-EJB was supposed to
>> register the EJB as OSGi service?
>>
>>
>> Also, should I deploy the WAB as a WAR or as a JAR file and into what
>> directory into domains/domain1/autodeploy/applications or into
>> domains/domain1/autodeploy/applications/bundles?
>>
>>
>>
>> Schéin Gréiss,
>> Mit freundlichen Grüßen,
>> Meilleures salutations,
>> Kind regards,
>> Alex Weirig
>> Responsable Technique
>>
>> Ville de Luxembourg - Centre Technolink
>> 2, rue Charles de Tornaco
>> L - 2623 LUXEMBOURG
>> alex.weirig_at_technolink.lu <mailto:alex.weirig_at_technolink.lu>
>> Tel: +352 4796 - 6127
>> Fax: +352 42 88 81
>> www.technolink.lu <http://www.technolink.lu>
>>
>> On 08/11/12 18:30, Sahoo wrote:
>>>
>>>
>>> -------- Original Message --------
>>> Subject: Re: Unable to get an OSGi modular application working in
>>> GF 3.1.2.2 FP
>>> Date: Thu, 08 Nov 2012 22:54:20 +0530
>>> From: Sahoo <sanjeeb.sahoo_at_oracle.com>
>>> Reply-To: sanjeeb.sahoo_at_oracle.com
>>> To: users_at_glassfish.java.net
>>> CC: forums_at_java.net
>>>
>>>
>>>
>>> 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
>>> >
>>> >
>>>
>>> --
>>> This email was Anti Virus checked by Astaro Security Gateway.
>>
>> --
>> This email was Anti Virus checked by Astaro Security Gateway.
>