glassfish
  1. glassfish
  2. GLASSFISH-19072

Instantiation of EJB module withing WAR module results in "Could not create stateless EJB" java.lang.NullPointerException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.2.2, 4.0
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      java version "1.6.0_34"
      Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
      Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)

      Description

      I have an application constructed like below

       * WAR
       ** WEB-INF\classes\web-app-classes-are-here.class
       ** WEB-INF\lib\myejbmodule.jar
       ** WEB-INF\lib\some-other-libraries.jar
       ** WEB-INF\beans.xml (empty)
       ** WEB-INF\web.xml (some servlet declarations only)
      

      The application deploys successfully, but when I try to invoke any action which involves EJB, I am reveiving exception like in the attached file.

      javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
      	at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:454)
      ...	
      	at $Proxy161.query(Unknown Source)
      	at com.XXXX.gtrs.web.testplan.TestPlanListControler.searchDataStore(TestPlanListControler.java:135)
      ...
      Caused by: java.lang.NullPointerException
      	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
      	at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:1209)
      	at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:144)
      	at org.glassfish.weld.services.JCDIServiceImpl._createJCDIInjectionContext(JCDIServiceImpl.java:169)
      	at org.glassfish.weld.services.JCDIServiceImpl.createJCDIInjectionContext(JCDIServiceImpl.java:146)
      	at com.sun.ejb.containers.BaseContainer.createEjbInstanceAndContext(BaseContainer.java:1636)
      
      

      Full stack trace in the attached file.

        Activity

        Hide
        jjsnyder83 added a comment -

        I created a war with an ejb packaged in a jar in WEB-INF/lib. A servlet in the war injects the ejb and I am able to deploy the war and successfully execute the servlet.

        Show
        jjsnyder83 added a comment - I created a war with an ejb packaged in a jar in WEB-INF/lib. A servlet in the war injects the ejb and I am able to deploy the war and successfully execute the servlet.
        Hide
        dmatej added a comment -

        I have stack trace on Glassfish 4.1 - I have a MessageDrivenBean in library in ear/lib - it is detected but the creation ends up with this NPE. Same when I remove annotations and declare it in ejb-jar.xml in some EJB module.

        Show
        dmatej added a comment - I have stack trace on Glassfish 4.1 - I have a MessageDrivenBean in library in ear/lib - it is detected but the creation ends up with this NPE. Same when I remove annotations and declare it in ejb-jar.xml in some EJB module.
        Hide
        dmatej added a comment -

        Workaround: Moved message driven bean implementation to the ejb module, used annotations and deleted all xml files.

        This is perfectly reproducible bug and should be fixed, probably in Weld (but how?).

        Show
        dmatej added a comment - Workaround: Moved message driven bean implementation to the ejb module, used annotations and deleted all xml files. This is perfectly reproducible bug and should be fixed, probably in Weld (but how?).

          People

          • Assignee:
            jjsnyder83
            Reporter:
            Marcin_C
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: