4 Replies Latest reply on Sep 4, 2012 4:48 AM by George Vagenas

    Weld-SE maven generated jar problem

    George Vagenas Newbie

      Hi guys,


      I am working on a project that is using Weld-SE 1.1.4-Final and while everything is working as expected inside eclipse, when i am trying to run the maven generated jar i got a lot of WELD-000119 messages and finally the project fails with a WELD-001408 exception. Among the classes with the WELD-000119 message is the class that fails with WELD-001408 and cannot be injected.


      INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from gr.barphone.sdt.JTapiLogger.connectivity.ConnectivityService because of underlying class loading error
      Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ConnectivityService] with qualifiers [@Default] at injection point [[field] @Inject private gr.barphone.sdt.JTapiLogger.connectivity.socket.NIOServer.connectivityService]



      Of course running the application inside eclipse there is no WELD-001408 exception and the desired dependency is validated and injected as expected.


      Please notice that i made sure that the MANIFEST.MF contains the weld-se main class (Main-Class: org.jboss.weld.environment.se.StartMain), that i have set correct the classpath and that beans.xml is inside META-INF.


      Can somebody shed some light over here?


      Thanks
      George

        • 1. Re: Weld-SE maven generated jar problem
          George Vagenas Newbie

          Turns out that the problem was the classpath in the MANIFEST.MF, after fixing it everything is fine.


          Thanks.

          • 2. Re: Weld-SE maven generated jar problem
            Aaron Siri Newbie

            How exactly did you fix this?  When I run the packaged jar I'm seeing a bunch of errors that look like the following:

             

            295 [main] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.

            663 [main] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.injection.spi.helpers.ForwardingJpaInjectionServices because of underlying class loading error

            666 [main] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.injection.spi.JpaInjectionServices because of underlying class loading error

            ...

             

            and at the end of it all I see:

             

            Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/Scope

                    at java.lang.ClassLoader.defineClass1(Native Method)

                    at java.lang.ClassLoader.defineClassCond(Unknown Source)

                    at java.lang.ClassLoader.defineClass(Unknown Source)

                    at java.security.SecureClassLoader.defineClass(Unknown Source)

                    at java.net.URLClassLoader.defineClass(Unknown Source)

                    at java.net.URLClassLoader.access$000(Unknown Source)

                    at java.net.URLClassLoader$1.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.net.URLClassLoader.findClass(Unknown Source)

                    at java.lang.ClassLoader.loadClass(Unknown Source)

                    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                    at java.lang.ClassLoader.loadClass(Unknown Source)

                    at java.lang.Class.getEnclosingMethod0(Native Method)

                    at java.lang.Class.getEnclosingMethodInfo(Unknown Source)

                    at java.lang.Class.getEnclosingClass(Unknown Source)

                    at java.lang.Class.getSimpleBinaryName(Unknown Source)

                    at java.lang.Class.isMemberClass(Unknown Source)

                    at org.jboss.weld.util.reflection.Reflections.isNonStaticInnerClass(Reflections.java:139)

                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:78)

                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123)

                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184)

                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:350)

                    at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans(ForwardingBootstrap.java:70)

                    at org.jboss.weld.environment.se.Weld.initialize(Weld.java:133)

                    at archiver.main(Archiver.java:62)

            Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.config.Scope

                    at java.net.URLClassLoader$1.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.net.URLClassLoader.findClass(Unknown Source)

                    at java.lang.ClassLoader.loadClass(Unknown Source)

                    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                    at java.lang.ClassLoader.loadClass(Unknown Source)

                    ... 25 more

             

            But I'm not using Spring and it isn't in my project at all (neither via the pom or run configurations).  This app runs fine in Eclipse.   I'm using maven-shade-plugin to build an executable jar with dependencies.

             

            -Aaron

            • 3. Re: Weld-SE maven generated jar problem
              François Dussert Newbie

              Hi I'm interested too !!

               

              I have quite the same problem, my project launch via eclipse is good but when I package my jar with maven, I have several NoClassDefFoundError.

              I have tried even with assembly plugin and jar with dependencies or with the shade plugin.

               

              usul

              • 4. Re: Weld-SE maven generated jar problem
                George Vagenas Newbie

                You should check classpath entries in the MANIFEST.MF