users@glassfish.java.net

Re: Using declared Services in Glassfish v3 prelude

From: Sahoo <Sahoo_at_Sun.COM>
Date: Wed, 22 Apr 2009 00:43:01 +0530

glassfish_at_javadesktop.org wrote:
>> On Apr 20, 2009, at 1:59 PM,
>> glassfish_at_javadesktop.org wrote:
>>
>>
>>> Hi Jerome,
>>>
>>> deploying osgi bundles is no problem. I got
>>>
>> problems while deploying
>>
>>> osgi bundles with declared services
>>>
>> (http://felix.apache.org/site/apache-felix-service-com
>> ponent-runtime.html
>>
>>> ). Important there is that i define an
>>>
>> Service-Component entry in
>>
>>> Manifest.MF which reference an xml file. This xml
>>>
>> file contains my
>>
>>> service declaration (like hk2 @Service annotation
>>>
>> but an xml file).
>>
>>> By the way i deploy my bundles by hand, just
>>>
>> copying them into the
>>
>>> modules folder.
>>>
>>>
>> if you do that, the bundles are not started
>> automatically which may
>> explain why your services are not started.
>>
>
> i now use the asadmin deploy command via maven exec. This approach is very nice but doesn't solve my problem. The Service is not visible nor initiated.
>
> I currently user bundlecontext.getServiceReference(String serviceInterface);
>
> should i use an different approach?
>
>
>
You can also use felix fileinstall bundle which is part of GFv3 to
deploy your bundle. You can do something like this:
Create a file called org.apache.felix.fileinstall-autodeploy-modules.cfg
in glassfish/modules dir. Let it contain following properties:
felix.fileinstall.dir=${com.sun.aas.instanceRoot}/autodeploy-modules/
felix.fileinstall.poll=5000
felix.fileinstall.debug=1
felix.fileinstall.bundles.new.start=true

Now, fileinstall will create domains/domain1/autodeploy-modules dir for
you. Drop your bundle into that dir.

Sahoo