users@glassfish.java.net

Re: JSF 2 pages spread over multiple OSGi bundles

From: Robert Anderson <ranomail_at_gmail.com>
Date: Fri, 5 Aug 2011 07:54:19 -0300

Hi Sahoo,

I'm using Glassfish 3.1.build-43.

I changed the code to illustrate the problem (
http://code.google.com/p/osgijee/source/browse/webclient/src/main/java/ranophoenix/osgijee/webclient/impl/cdi/ModuleExtensionListener.java).


Steps:

$> asadmin start-database
$> asadmin start-domain
$> telnet localhost 6666 //osgi shell or OSGi Web Console
osgi> install core.jar
osgi> start <core.jar id>
osgi> install webclient.war
osgi> start <webclient.war id>

/-- glassfish log --/
INFO: Expanded at
file:/F:/Users/RANOPH~1/AppData/Local/Temp/osgiapp7656686012903924963/
INFO: Instantiated an instance of
org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: total number of classes with faces annotation = 0
INFO: Inicializando Mojarra 2.1.0 (FCS 2.1.0-b11) para o contexto
'/webclient'
INFO: Faces Config uris excluding the ones named as faces-config.xml =
[bundle://363.0:0/WEB-INF/classes/META-INF/weld.faces-config.xml]
INFO: Facelet Config uris = []
INFO: WEB0671: Loading application
[ranophoenix.osgijee.webclient_1.0.0.SNAPSHOT] at [/webclient]
INFO: Registered ServletContext as a service with properties:
{osgi.web.symbolicname=ranophoenix.osgijee.webclient,
osgi.web.version=1.0.0.SNAPSHOT, osgi.web.contextpath=/webclient}
INFO: deployed bundle ranophoenix.osgijee.webclient [363] at
file:/F:/Users/RANOPH~1/AppData/Local/Temp/osgiapp7656686012903924963/
/-- end glassfish log --/

osgi> install module1.war
osgi> start <module1.war id>

/-- glassfish log --/
INFO: ERROR: Bundle ranophoenix.osgijee.webclient [363]: EventDispatcher:
Error during dispatch. (java.lang.IllegalStateException: Singleton not set
for WebappClassLoader (delegate=false; repositories=))
GRAVE: java.lang.IllegalStateException: Singleton not set for
WebappClassLoader (delegate=false; repositories=)
    at
org.glassfish.weld.ACLSingletonProvider$ACLSingleton.get(ACLSingletonProvider.java:110)
    at org.jboss.weld.Container.instance(Container.java:58)
    at
org.jboss.weld.resolution.ResolvableBuilder.checkQualifier(ResolvableBuilder.java:209)
    at
org.jboss.weld.resolution.ResolvableBuilder.addQualifier(ResolvableBuilder.java:174)
    at
org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:202)
    at
org.jboss.weld.manager.BeanManagerImpl.resolveObserverMethods(BeanManagerImpl.java:474)
    at
org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:625)
    at org.jboss.weld.event.EventImpl.fire(EventImpl.java:75)
    at
ranophoenix.osgijee.webclient.impl.cdi.ModuleExtensionListener.serviceChanged(ModuleExtensionListener.java:45)
    at
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)
    at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)
    at
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3769)
    at org.apache.felix.framework.Felix.access$000(Felix.java:80)
    at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:722)
    at
org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107)
    at org.apache.felix.framework.Felix.registerService(Felix.java:2854)
    at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:251)
    at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:229)
    at ranophoenix.osgijee.module1.impl.Activator.start(Activator.java:17)
    at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1835)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1752)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
    at
org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:114)
    at
org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
    at
org.apache.felix.webconsole.internal.misc.ShellServlet.doPost(ShellServlet.java:93)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at
org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:428)
    at
org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:375)
    at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:171)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
    at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
    at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
    at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)

INFO: Module1 started

/-- end glassfish log --/


Thanks in advance,

Robert


On Fri, Aug 5, 2011 at 1:28 AM, Sahoo <sanjeeb.sahoo_at_oracle.com> wrote:

> **
> Robert,
>
> I can't reproduce this. I tried commenting out this line of code as well in
> osgijee/webclient/src/main/java/ranophoenix/osgijee/webclient/impl/cdi/ModuleExtensionListener.java:
> modExtAddedEvent.fire(me);
> //java.lang.IllegalStateException: Singleton not set for WebappClassLoader
> (delegate=false; repositories=)
>
> , yet I can't reproduce. I have copied core.jar, webclient.war,
> module[12].war to autodeploy/bundles/. What step is missing?
>
> Thanks,
> Sahoo
>
>
> On Friday 05 August 2011 12:18 AM, Robert Anderson wrote:
>
> "GlassFish has a number of OSGi features exposed to the end user which are
> all nicely documented in the official documentation."
>
> Surely! I'm liking very much. Obviously a lot can still be improved, but
> that's why we're here. Long life open source! ;)
>
> So...
>
> I'm trying to use CDI events but I'm receiving the exception below:
>
> java.lang.IllegalStateException: Singleton not set for WebappClassLoader
> (delegate=false; repositories=)
> at
> org.glassfish.weld.ACLSingletonProvider$ACLSingleton.get(ACLSingletonProvider.java:110)
> at org.jboss.weld.Container.instance(Container.java:58)
> at
> org.jboss.weld.resolution.ResolvableBuilder.checkQualifier(ResolvableBuilder.java:209)
> at
> org.jboss.weld.resolution.ResolvableBuilder.addQualifier(ResolvableBuilder.java:174)
> at
> org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:202)
> at
> org.jboss.weld.manager.BeanManagerImpl.resolveObserverMethods(BeanManagerImpl.java:474)
> at
> org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:625)
> at org.jboss.weld.event.EventImpl.fire(EventImpl.java:75)
> at
> ranophoenix.osgijee.webclient.impl.cdi.ModuleExtensionListener.serviceChanged(ModuleExtensionListener.java:45)
> at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)
> at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)
> at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3769)
> at org.apache.felix.framework.Felix.access$000(Felix.java:80)
> at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:722)
> at
> org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:135)
> at
> org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:129)
> at
> org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:178)
> at org.apache.felix.framework.Felix.stopBundle(Felix.java:2227)
> at org.apache.felix.framework.BundleImpl.stop(BundleImpl.java:958)
> at
> org.apache.felix.shell.impl.StopCommandImpl.execute(StopCommandImpl.java:93)
> at
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
> at
> org.apache.felix.webconsole.internal.misc.ShellServlet.doPost(ShellServlet.java:93)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
> at
> org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:428)
> at
> org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:375)
> at
> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:171)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
> at
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
> at
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
> at
> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
> at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
> at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
> at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
> at
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
> at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
> at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
> at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
> at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
> at
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
> at
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
> at java.lang.Thread.run(Thread.java:662)
>
>
>
> Source code:
> http://code.google.com/p/osgijee/source/browse/webclient/src/main/java/ranophoenix/osgijee/webclient/impl/cdi/ModuleExtensionListener.java
>
>
> Suggestions?
>
>
> Thanks in advance,
>
> Robert
>
> On Thu, Aug 4, 2011 at 11:32 AM, Jason Lee <jason.d.lee_at_oracle.com> wrote:
>
>> While not perfect, GlassFish has a number of OSGi features exposed to the
>> end user which are all nicely documented in the official documentation.
>> What this user is trying to do is a pretty specific use case, so it's not
>> something we have had to investigate yet. Oddly enough, though, I was
>> recently requested to do exactly this same thing, so I'll be looking into
>> this as well.
>>
>> We can't cover every use case a user might have, but we try to cover the
>> big ones. The others we'll fill in as we can when the need arises. This
>> is, though, an open source effort, so there's always room for someone to
>> jump in and help, as is the case here. :)
>>
>>
>> On 8/4/11 6:48 AM, Martin Gainty wrote:
>>
>> your product is suffering mr ellison...
>> why doesnt larry open his wallet and hire some of the millions of unpaid
>> engineers that support this product?
>> JBoss is no picnic but at least RH PAYS their engineers to put OSGI
>> features in JBoss
>>
>> 'Nuf said
>> Martin Gainty
>>
>> --
>> Jason Lee
>> Senior Member of Technical Staff
>> GlassFish REST API / Administration Console
>>
>> Oracle Corporation
>> Phone +1 405-216-3193
>> Blog http://blogs.steeplesoft.com
>>
>>
>
>