2 Replies Latest reply on Dec 29, 2016 12:41 AM by jaydey

    JBoss-EAP 6.4 fails to start due to weld issue

    jaydey

      I have a CDI project which works with weld-core-1.1.10.Final.jar. I have integrated a test project with my project and the test project works with weld-core-2.2.9.Final.jar

      My build.gradle file is having below weld dependencies:

       

        providedCompile "org.jboss.weld:weld-core:1.1.10.Final"

       

        testCompile("org.jboss.weld:weld-core:2.2.9.Final"){

       

        exclude group:"com.google.guava"

       

        }

       

       

      When I deploy the war file of the integrated project in JBoss-EAP 6.4 server, it fails with below exception :  Caused by: java.lang.NoSuchMethodError: org.jboss.weld.manager.BeanManagerImpl.getContextId()Ljava/lang/String;

       

      2016-12-28 05:33:06,060 EST ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."sail-services-2.12-CD2.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."sail-services-2.12-CD2.war".WeldStartService: Failed to start service
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1936)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
      Exception 0 :
      javax.enterprise.event.ObserverException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at java.lang.Class.newInstance(Class.java:442)
      at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:344)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173)
      at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:341)
      at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33)
      at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:73)
      at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:162)
      at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:245)
      at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:233)
      at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:213)
      at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:75)
      at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:46)
      at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:42)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:359)
      at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:63)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NoSuchMethodError: org.jboss.weld.manager.BeanManagerImpl.getContextId()Ljava/lang/String;
      at org.jboss.weld.environment.se.WeldSEBeanRegistrant.registerWeldSEContexts(WeldSEBeanRegistrant.java:58)
      at org.jboss.weld.environment.se.WeldSEBeanRegistrant$Proxy$_$$_WeldClientProxy.registerWeldSEContexts(WeldSEBeanRegistrant$Proxy$_$$_WeldClientProxy.java)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
      at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
      at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:164)
      at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)
      at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)
      ... 13 more

      at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:48)
      at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:42)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:359)
      at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:63)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913)
      ... 3 more

       

      I tried to play around with weld version with almost all permutations and combinations but still it's failing with above exception. It's very frustrating resolving the dependencies issue with weld and CDI project. I have been wasting a lot of time to fix this from the past 1 month.

       

      Please help and also let me know in case further information required.

        • 1. Re: JBoss-EAP 6.4 fails to start due to weld issue
          ctomc

          Why do you bundle weld-se jars in your deployment?

          that is only needed for testing for example not for deploying to app server.

           

          can you paste list of jars in your WEB-INF/lib

          • 2. Re: JBoss-EAP 6.4 fails to start due to weld issue
            jaydey

            Thanks Tomaz for your quick response.

            I have a middleware Java project which deals with Web services APIs only(both SOAP and Rest). We have a separate JUnit test project which uses Wiremock, Weld and Mockito . Now I have integrated both the projects and tested the JUnit testcases which are working fine.

            Now the actual issue is that we normally deploy the war file of the whole project in JBoss server for development and other purposes. Now it has started failing due to the integrated JUnit test project which uses Weld and I think there are conflicts between the Weld versions, but I am not sure about that.

             

            My question is, when we don't want Weld classes for deployment why it's failing during deployment. I have used testCompile/testRuntime for Weld classes so that they don't participate during deployment of war, but still the logs shows Weld classes not found error.

             

            Kindly advise and let me know in case further information required. I need a solution anyhow. It has been frustrating since along time.