10 Replies Latest reply on Mar 22, 2013 7:00 PM by klind

    java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl

    klind Newbie

      Hi, when doing mvn gwt:compile I get

       

      Caused by: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl

      at com.google.gwt.dev.jjs.impl.UnifyAst.searchForTypeBySource(UnifyAst.java:981)

      at com.google.gwt.dev.jjs.impl.UnifyAst.access$1500(UnifyAst.java:120)

      at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleGwtCreate(UnifyAst.java:364)

      at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:433)

       

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <module rename-to='ppmock'>
                <inherits name="org.jboss.errai.common.ErraiCommon" />
                <inherits name="org.jboss.errai.bus.ErraiBus" />
                <inherits name="org.jboss.errai.ioc.Container" />
                <inherits name="org.jboss.errai.enterprise.CDI" />
                  <inherits name='com.google.gwt.junit.JUnit' />
                <inherits name='com.google.gwt.user.theme.chrome.Chrome' /> 
      </module>
      
      

       

      Using :

       

      <gwtVersion>2.5.1</gwtVersion>

      <errai.version>2.2.0.Final</errai.version>

      java 7

       

        • 1. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
          Jonathan Fuerth Master

          MarshallerFactoryImpl is supposed to be generated at GWT rebind time (which should happen during a gwt:compile). I can't tell from the stack trace excerpt what's gone wrong. Can you please post the full output from running mvn clean package -Dgwt.compiler.strict=true? Maybe there will be a clue in there.

           

          Cheers,

          Jonathan

          • 3. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
            Jonathan Fuerth Master

            These errors from the GWT compiler probably indicate what was causing the other failure:

             

            [INFO] --- gwt-maven-plugin:2.5.1:compile (default) @ ppmock ---

            [INFO] auto discovered modules [com.farheap.jsi.ppmock.ppmock]

            [INFO] Compiling module com.farheap.jsi.ppmock.ppmock

            [INFO]    Validating units:

            [INFO]       [ERROR] Errors in 'file:/C:/jsi-workspace/JSI/ppmock/src/main/java/com/farheap/jsi/ppmock/client/MainTabPanel.java'

            [INFO]          [ERROR] Line 113: No source code is available for type com.farheap.jsi.ppmock.shared.pojo.PrintProviderMock; did you forget to inherit a required module?

            [INFO]       [ERROR] Errors in 'file:/C:/jsi-workspace/JSI/ppmock/src/main/java/com/farheap/jsi/ppmock/client/PPTabPanel.java'

            [INFO]          [ERROR] Line 57: No source code is available for type com.farheap.jsi.ppmock.shared.pojo.PrintProviderMock; did you forget to inherit a required module?

            [INFO]       [ERROR] Errors in 'file:/C:/jsi-workspace/JSI/ppmock/src/main/java/com/farheap/jsi/ppmock/client/PrintProviderMockService.java'

            [INFO]          [ERROR] Line 16: No source code is available for type com.farheap.jsi.ppmock.shared.pojo.PrintProviderMock; did you forget to inherit a required module?

            [INFO]       [ERROR] Errors in 'file:/C:/jsi-workspace/JSI/ppmock/target/generated-sources/gwt/com/farheap/jsi/ppmock/client/PrintProviderMockServiceAsync.java'

             

             

            [INFO]          [ERROR] Line 14: No source code is available for type com.farheap.jsi.ppmock.shared.pojo.PrintProviderMock; did you forget to inherit a required module?

            [INFO]    [ERROR] Aborting compile due to errors in some input files

             

            You probably need to add the following lines to your .gwt.xml module descriptor:

             

                <source path="client"/>

                <source path="shared"/>

             

            Hope that helps!

             

            Jonathan

            • 4. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
              klind Newbie

              I change it to

               

               

              <?xml version="1.0" encoding="UTF-8"?>
              <module rename-to='ppmock'>
                        <inherits name="org.jboss.errai.common.ErraiCommon" />
                        <inherits name="org.jboss.errai.bus.ErraiBus" />
                        <inherits name="org.jboss.errai.ioc.Container" />
                        <inherits name="org.jboss.errai.enterprise.CDI" />
              
                          <!-- <inherits name='com.google.gwt.junit.JUnit' /> -->
                        <inherits name='com.google.gwt.user.theme.chrome.Chrome' /> 
                
                        <!-- Specify the paths for translatable code                    -->
                        <source path='client' />
                        <source path='shared' />
              
               </module>
              
              

               

              But still get the

               

               

              [INFO] java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/enterprise/util/TypeLiteral

              [INFO]  at java.lang.ClassLoader.defineClass1(Native Method)

              [INFO]  at java.lang.ClassLoader.defineClass(ClassLoader.java:791)

              [INFO]  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

              [INFO]  at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

              [INFO]  at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

              ......

              ......

              [INFO] Caused by: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl

              [INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst.searchForTypeBySource(UnifyAst.java:981)

              [INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst.access$1500(UnifyAst.java:120)

              [INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleGwtCreate(UnifyAst.java:364)

              [INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:433)

              [INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:237)

              [INFO]  at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:243)

              [INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

              [INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

               

              • 5. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
                Jonathan Fuerth Master

                Can you compile again with -Dgwt.compiler.strict=true? There is probably something non-GWT-translatable under your shared package. Unfortunately, GWT doesn't complain about these things unless you ask it to be strict.

                 

                -Jonathan

                • 7. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
                  Jonathan Fuerth Master

                  Okay, the top hit on Google[1] for

                   

                  java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/enterprise/util/TypeLiteral

                   

                  says:

                   

                  The standard Java EE 6 APIs in the Maven repository were processed by a tool, which removes the method body implementation from the bytecode and makes the javaee-web-api dependency unusable for unit testing. Any attempt to load the classes from the Java EE 6 API leads to an error like the following:

                  Absent Code attribute in method that is not native or abstract in class file javax/enterprise/util/TypeLiteral

                   

                  Maybe you're depending on this stripped version of the CDI API? Here's what we're currently using in the Errai framework. It doesn't appear to suffer from the issue:

                        <dependency>

                          <groupId>javax.enterprise</groupId>

                          <artifactId>cdi-api</artifactId>

                          <version>1.0-SP4</version>

                        </dependency>

                   

                  -Jonathan

                   

                  [1]: http://www.oracle.com/technetwork/articles/java/unittesting-455385.html

                  • 8. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
                    klind Newbie

                    Ok, so try this  :

                     

                     

                    <!-- <dependency>
                                                  <groupId>javax</groupId>
                                                  <artifactId>javaee-api</artifactId>
                                                  <version>6.0</version>
                                                  <scope>provided</scope>
                                        </dependency> -->
                                        <dependency>
                                                  <groupId>javax.enterprise</groupId>
                                                  <artifactId>cdi-api</artifactId>
                                                  <version>1.0-SP4</version>
                                        </dependency>
                    
                    

                     

                    And it can compile now... I had the remove a @EJB and use @Inject instead.

                    But what if I wanna use the @EJB annotations ???

                    • 9. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
                      Jonathan Fuerth Master

                      First, you should keep the new cdi-api dependency at provided scope. You don't want to deploy that to your app server.

                       

                      As for the EJB 3 API, I don't know off the top of my head. You could maybe try this one:

                       

                      <dependency>

                          <groupId>javax.ejb</groupId>

                          <artifactId>javax.ejb-api</artifactId>

                          <version>3.2-b02</version>

                          <scope>provided</scope>

                      </dependency>

                       

                      You could also erase the above, the cdi-api, and your original javaee-api dependency, and instead depend on the JBoss distribution of the complete Java EE 6 API:

                      <dependency>

                          <groupId>org.jboss.spec</groupId>

                          <artifactId>jboss-javaee-all-6.0</artifactId>

                          <version>3.0.2.Final</version>

                          <scope>provided</scope>

                      </dependency>

                       

                      This should provide all the same APIs as your original dependency, but without the "missing method bodies" problem.

                       

                      -Jonathan

                      • 10. Re: java.lang.NoClassDefFoundError: org.jboss.errai.marshalling.client.api.MarshallerFactoryImpl
                        klind Newbie

                        Using the cdi-api is fine, ad long as I can use @Inject instaed of @EJB.

                         

                        How much of the errai dependencies must be provided ?