Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1367

Services form external component libraries are not recognized

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 1.1.4.Final
    • None
    • None
    • Hide

      see sample application

      Show
      see sample application
    • Medium

    Description

      There seems to be problem with weld and detecting external jar files from ear projects.

      I have the following project structure:

       |-ear-sample
       |   |-ear-sample-ejb.jar
       |   |-ear-sample-lib.jar
       |   |-ear-sample-web.jar
       |   |    |-WEB-INF/beans.xml
      

      The web module uses CDI to inject the EJB services. So beans.xml is included in the WEB-INF folder.
      So fahr everything is fine. Also the EJB module ban be CDI enabled by adding the beans.xml into the META-INF folder of the EJB modul.
      The tricky part is the ear-sample-lib.jar. This is a component library containging additional services. To deploy this correctly into one ejb module (ear-sample-ejb.jar) there is a MANIFEST.MF Class-Path entry:

      Class-Path: ear-sample-lib.jar
      

      So the ear-sample-lib.jar with all its services will become part of the ejb module. And all services will be deployed fine. This is the recommanded packaging from the GlassFish team.
      Also all services can be injected with @EJB into a CDI bean living in the web module.

      The Problem begins in the moment when the CDI bean try to inject the services with @Inject. The services in the EJB module seems to become injected. But the services from the lib module not. It seems to me that the Class-Path entry in the MANIFEST.MF file is not checked by weld - so the beans there are not visible. Can you confirm that?

      Below I added the stack trace. Also I have a sample project demonstrating the problem. Simply add the beans.xml into the EJB module and try to deploy again.

      SEVERE: EJB5070: Exception creating stateless session bean : [SampleService]
      WARNING: EJB5184:A system exception occurred during an invocation on EJB SampleService, method: public java.lang.String org.imixs.test.lib.SampleService.getName()
      WARNING: 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 com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2547)
      	at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1899)
      	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
      	at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
      	at sun.proxy.$Proxy451.getName(Unknown Source)
      	at org.imixs.test.lib.__EJB31_Generated__SampleService__Intf____Bean__.getName(Unknown Source)
      	at org.imixs.test.web.TestController.getServiceSample(TestController.java:73)
      	at org.imixs.test.web.TestController$Proxy$_$$_WeldClientProxy.getServiceSample(TestController$Proxy$_$$_WeldClientProxy.java)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
      	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      	at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
      	at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
      	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
      	at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
      	at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:227)
      	at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:150)
      	at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
      	at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
      	at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
      	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
      	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
      	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
      	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
      	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      	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.StandardHostValve.invoke(StandardHostValve.java:161)
      	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
      	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
      	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
      	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
      	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:722)
      Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
      	at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:726)
      	at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:247)
      	at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:449)
      	... 57 more
      Caused by: javax.ejb.CreateException: Could not create stateless EJB
      	at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:534)
      	at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:95)
      	at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:724)
      	... 59 more
      Caused by: java.lang.NullPointerException
      
      SEVERE: Error Rendering View[/welcome.xhtml]
      

      Attachments

        Activity

          People

            rhn-engineering-jharting Jozef Hartinger
            rsoika ralph Soika (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: