2 Replies Latest reply: Nov 26, 2010 4:52 PM by Thomas Kernstock RSS

CDI-@ViewScope and Glassfish v3.0.1

Thomas Kernstock Newbie

Hi forum,

after not beeing able to integrate seam3 I tried the CDI-ViewContext implemented by Verborgh. I downloaded the source from GitHub and integrated the source in a simple webapplication with a the test backingbean and index.xhtml found here: http://www.icefaces.org/JForum/posts/downloadAttach/3551.page

I deployed the test.war to Glasfish 3.0.1 and it worked perfectly. I also tried to put Verborgh's code into a .jar and use this in the project as library. It worked too.

But when I deploy this Webproject (unchanged) together with my EJB Project in an EAR File instead of the standalone .war I get the following error: 

org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type be.verborgh.enterprise.context.ViewScoped
     at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:679)
     at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:138)
     at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
     at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
     at ding.dong.DemoBacking_$$_javassist_300.isToggled(DemoBacking_$$_javassist_300.java)

I'm not sure if this is a problem in glassfish, the cdi-extension mechanism, with a classloader or if I simply forgot to configure a liitle something.

Any ideas ?

I also can provide the Testproject (Eclipse Helios)

best regards and thanx in advance


  • 1. Re: CDI-@ViewScope and Glassfish v3.0.1
    Thomas Kernstock Newbie

    I simply move/copied the .jar with the cdi-extension to the lib directory of the EAR indstead of just holding it in the webapp.

    That did teh trick - now it works like a charm.


  • 2. Re: CDI-@ViewScope and Glassfish v3.0.1
    Thomas Kernstock Newbie

    After repeating the same procedure in my real project, I cannot create any EJBs from the ejb.jar.

    Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
         at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:720)
         at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:200)
         at com.sun.ejb.containers.StatelessSessionContainer.getContext(StatelessSessionContainer.java:443)
         ... 65 more
    Caused by: javax.ejb.CreateException: Could not create stateless EJB
         at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:528)
         at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:90)
         at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:718)
         ... 67 more
    Caused by: java.lang.NullPointerException
         at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
         at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:1171)
         at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:132)
         at org.glassfish.weld.services.JCDIServiceImpl.
         at org.glassfish.weld.services.JCDIServiceImpl.createJCDIInjectionContext(JCDIServiceImpl.java:122)
         at com.sun.ejb.containers.BaseContainer.createEjbInstanceAndContext(BaseContainer.java:1616)
         at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:469)
         ... 69 more

    So again a problem with the BeanManager.

    Does anybody have a functioning project with a war and an ejb packed up in an ear that uses cdi-extensions mechanism like seam3, codi .....