Robert,
Yes, somehow you have to load a class from osgi-http bundle. You can
just have a dummy ServiceTracker tracking HttpService in your bundle
activator. That's what I do in our http sample as you can see here:
https://svn.java.net/svn/glassfish~svn/trunk/fighterfish/sample/osgihttp/helloworld/src/main/java/org/glassfish/fighterfish/sample/osgihttp/helloworld/HelloWorldHttpActivator.java
Hope that's acceptable to you. If you really don't want to do this, then
you can actually configure GlassFish to start all lazy bundles eagerly
by setting glassfish.osgi.auto.start.options=0 in
felix/conf/config.properties.
Thanks,
Sahoo
On Wednesday 31 August 2011 06:59 AM, Robert Weeks wrote:
> Hey Sahoo -
>
> Thanks for the reply.
>
> This is not the behavior I am seeing tho - for example - if I deploy a bundle that is using a component (declarative service) to register a servlet when the service becomes available - then it never does - so any servlets and/or resources that I am exporting from the bundle never get registered.
>
> If I then do a manual "start" on the bundle id - then all of my resources/servlets become available.
>
> So - I guess then it *is* that behavior - but if we are using DS instead of straight trackers to get at this - it will never get started that way - correct?
>
> So - say in my bnd file - something like:
>
> Service-Component: com.ext_inc.systemmanager.servlets.*;\
> http=org.osgi.service.http.HttpService
>
> so that in on of my servlet classes:
>
> @Component(provide = HttpServlet.class)
> public class SystemManagerProxy ........
>
> @Reference
> protected void setHttp(HttpService http) {
> if (http != null) {
> this.http = http;
> registerHttpResources();
> }
> }
>
> This works great - as long as the service is active.
>
> Is there anything I can do to kickstart it?
>
> Thanks again.
>
>
>
> Robert Weeks
> Lead Developer - Framework and UI
> EXTENSION, INC.
> Email: rweeks_at_ext-inc.com
> Office: 260-797-0200 x4228
> General: 877-207-3753
> www.OpenTheRedBox.com
>
> Download the FREE EXTENSION Mobile App for iPhone and iPod Touch
> http://www.opentheredbox.com/iPhone_appDemo.php
>
> Download the FREE EXTENSION Mobile App for Android-Based Devices
> https://market.android.com/details?id=com.ext_inc.android&feature=search_result
>
> We're Exhibiting in an Area Near You
> http://www.opentheredbox.com/events.php
>
> ________________________________________
> From: Sahoo [sanjeeb.sahoo_at_oracle.com]
> Sent: Tuesday, August 30, 2011 8:54 PM
> To: users_at_glassfish.java.net
> Cc: Robert Weeks
> Subject: Re: GlassFish 3.1.1 - OSGi HTTP Service Implementation not starting
>
> Hi Robert,
>
> No, you don't have to explicitly start it. You see it in Starting state,
> because it uses "LAZY ACTIVATION" policy. This bundle exports
> org.osgi.service.http package, so if you deploy your own bundle that
> uses httpservice API from this bundle, then it will automatically get
> activated. I felt this is better than user having to download and
> deploy osgi-http.jar from somewhere.
>
> Thanks,
> Sahoo
> On Wednesday 31 August 2011 12:39 AM, Robert Weeks wrote:
>> Hello -
>>
>> On a fresh install of GF3.1.1 - when looking at the bundles (gogo -> lb) - it always says the OSGi HTTP Service Implementation for GlassFish Web Container (1.0.4) is "Starting" - and never completely starts unless I kickstart it by telling it to start in the console.
>>
>> We rely on this - and with GF 3.1 - we installed the bundle into the modules/autostart directory. I thought I could get rid of that step with 3.1.1 - but if we manually have to tell that bundle to start before it will complete, we won't be able to use this.
>>
>> Is there a reason for this?
>>
>> Thanks for any information.
>>