users@glassfish.java.net

Re: OSGI Web bundle

From: Pavel Kuzin <pk_at_nodex.ru>
Date: Wed, 21 Oct 2009 13:50:50 +0400

Now i have another problem.

osgi-web-container does not starting with server startup.

When i`m starting glassfish, deploing my apps and osgi-web-container to autodeploy/bundles
It starts ok, and starts webapp from OSGI bundles.

I`m trying to restart glassfish.
glassfish is came up.
osgi-web-container is deployed but it stays in RESOLVED state.

269 RESOLVED org.glassfish.web.osgi-web-container_3.0.0.SNAPSHOT

when i`m conecting to Equinox and give him command to start bundle (start 269).
osgi-web-container starting and working ok.
269 ACTIVE org.glassfish.web.osgi-web-container_3.0.0.SNAPSHOT


Sahoo пишет:
> Hi Pavel,
>
> I have changed OSGi Web Container in GlassFish to set osgi-bundlecontext
> attribute in ServletContext before the web app initialization event is
> fired [1], so hopefully Spring context listener can now function as long
> as it is looking for the attribute named osgi-bundlecontext. This
> attribute is named as per OSGi rfc #66.
>
> Thanks,
> Sahoo
>
> [1] https://glassfish.dev.java.net/issues/show_bug.cgi?id=10439
>
> Pavel Kuzin wrote:
>> Hello!
>>
>> In this time glassfish do this:
>>
>>
>> 1. Catching new bundle by autodeploy (autodeploy/bundles)
>> INFO: Installed
>> /usr/local/glassfish/glassfish/domains/domain1/autodeploy/bundles/RemotePayments-0.0.2.jar
>>
>> 2. Resolving it. -> RESOLVED STATE
>> 3. bundle->start -> STARTING STATE
>> 4. osgi-web-container installing webapp to container and tries
>> initialise ServletContext.
>> Webapp initialise Spring WebApplication context without OSGI.
>> 5. get error because webapp needs OsgiBundleXmlWebApplicationContext
>> java.lang.Exception: java.lang.IllegalStateException:
>> ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
>> java.lang.IllegalArgumentException: bundle context should be set
>> before refreshing the application context
>> at
>> com.sun.enterprise.web.WebApplication.start(WebApplication.java:118)
>> at
>> org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
>> at
>> org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:219)
>> at
>> org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:240)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:308)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:169)
>>
>> at
>> org.glassfish.web.osgi.JavaEEDeploymentRequest.deploy(JavaEEDeploymentRequest.java:167)
>>
>> at
>> org.glassfish.web.osgi.JavaEEDeploymentRequest.execute(JavaEEDeploymentRequest.java:119)
>>
>> at
>> org.glassfish.web.osgi.OSGiWebContainer.deployJavaEEArtifacts(OSGiWebContainer.java:141)
>>
>> at
>> org.glassfish.web.osgi.OSGiWebContainer.deploy(OSGiWebContainer.java:106)
>> at
>> org.glassfish.web.osgi.WebExtender.deploy(WebExtender.java:158)
>> at
>> org.glassfish.web.osgi.WebExtender.bundleChanged(WebExtender.java:110)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:919)
>>
>> at
>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
>>
>> at
>> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1350)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1301)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:338)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
>>
>> at
>> org.apache.felix.fileinstall.DirectoryWatcher.start(DirectoryWatcher.java:823)
>>
>> at
>> org.apache.felix.fileinstall.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:844)
>>
>> at
>> org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:401)
>>
>> at
>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:123)
>>
>>
>> 6. bundle goes to STARTED STATE
>> 7. extender starts Spring and OsgiBundleXmlApplicationContext
>> INFO: Application context successfully refreshed
>> (OsgiBundleXmlApplicationContext(bundle=ndx.billing.RemotePayments,
>> config=osgibundle:/META-INF/spring/*.xml))
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>

-- 
Pavel D. Kuzin
pk_at_nodex.ru
Nodex LTD.
Saint-Petersburg, Russia