Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-1028

Log more helpful message when duplicate jars prevent injection

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Obsolete
    • Major
    • None
    • None
    • None
    • None

    Description

      If you package your business interfaces with both your ejb.jar and your web.war, EJB injection into the JSF backing beans of the web.war does not work. The reason is class loading issues - the bean implementing the business interface packaged in the ejb.jar is not assignment compatible with the other business interface found in the web.war.

      Removing the business interface classes from both the ejb.jar and web.war and packaging these in an EAR containing just 1 set of business interfaces will fix this problem. However, I just spend 24 hours trying to figure this out because the exception I got from JBoss AS 7 was not very helpful (as can be seen below).

      If multiple instances of the same jar lead to assignment incompatibilities that prevent EJB injection, I request that a much more developer friendly message is logged, such as the following:

      "It was not possible to inject EJB SurveillanceFunctionalityBean into AlarmEventView because the EJB SurveillanceFunctionalityBean implements a interface SurveillanceFunctionality loaded from another jar than the jar containing the interface used in AlarmEventView. As a result, the EJB instance is not assignment compatible with the field found in AlarmEventView. This can be solved by placing the interface SurveillanceFunctionality in its own jar inside an EAR and ensuring that no modules of the EAR contain duplicates the this particular jar."

      The original, less helpful exception

      18:17:24,880 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http--10.0.0.110-8080-2) Error Rendering View[/iphone/alarms.xhtml]: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:95) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.web.deployment.component.WebComponentInstantiator$2.<init>(WebComponentInstantiator.java:96) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.web.deployment.component.WebComponentInstantiator.initializeInstance(WebComponentInstantiator.java:94) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:86) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.web.deployment.jsf.JsfInjectionProvider.invokePostConstruct(JsfInjectionProvider.java:69) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) [jbossweb-7.0.13.Final.jar:]
      at org.apache.el.parser.AstValue.getTarget(AstValue.java:94) [jbossweb-7.0.13.Final.jar:]
      at org.apache.el.parser.AstValue.getType(AstValue.java:82) [jbossweb-7.0.13.Final.jar:]
      at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:176) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
      at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at org.primefaces.component.datatable.DataTable.isLazy(DataTable.java:922) [primefaces-3.1.1.jar:]
      at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:177) [primefaces-3.1.1.jar:]
      at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:103) [primefaces-3.1.1.jar:]
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285) [myfaces-impl-2.1.6.jar:2.1.6]
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
      at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_29]
      Caused by: java.lang.IllegalArgumentException: Can not set com.wefend.services.surveillance.SurveillanceFunctionality field com.wefend.web.events.AlarmEventView.surveillanceFunctionality to com.wefend.services.surveillance.SurveillanceFunctionality$$$view19
      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) [classes.jar:1.6.0_29]
      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) [classes.jar:1.6.0_29]
      at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) [classes.jar:1.6.0_29]
      at java.lang.reflect.Field.set(Field.java:657) [classes.jar:1.6.0_29]
      at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:111) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:106) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
      ... 50 more

      Attachments

        Activity

          People

            Unassigned Unassigned
            randahl_jira Randahl Fink Isaksen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: