0 Replies Latest reply on Jul 5, 2016 4:23 AM by Arthur Gwatidzo

    java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/model/DataModel

    Arthur Gwatidzo Newbie

      Good morning,

       

      I am trying to run unit test cases  with JUnit and Mockito in Eclipse.

       

      I get the failure trace below:

      java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/model/DataModel

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

        at java.lang.ClassLoader.defineClass(ClassLoader.java:792)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

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

        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

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

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

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

        at java.lang.ClassLoader.defineClass(ClassLoader.java:792)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

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

        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

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

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

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

        at java.lang.ClassLoader.defineClass(ClassLoader.java:792)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

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

        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

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

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

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

        at java.lang.ClassLoader.defineClass(ClassLoader.java:792)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

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

        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

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

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

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

        at java.lang.Class.privateGetDeclaredFields(Class.java:2387)

        at java.lang.Class.getDeclaredFields(Class.java:1796)

        at org.junit.runners.model.TestClass.<init>(TestClass.java:49)

        at org.junit.runners.ParentRunner.<init>(ParentRunner.java:75)

        at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57)

        at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl$1.<init>(JUnit45AndHigherRunnerImpl.java:23)

        at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.<init>(JUnit45AndHigherRunnerImpl.java:23)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

        at org.mockito.internal.runners.util.RunnerProvider.newInstance(RunnerProvider.java:39)

        at org.mockito.internal.runners.RunnerFactory.create(RunnerFactory.java:28)

        at org.mockito.runners.MockitoJUnitRunner.<init>(MockitoJUnitRunner.java:57)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

        at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)

        at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)

        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)

        at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)

        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)

        at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

       

      My POM file includes the following dependencies:

       

      <dependency>

                  <groupId>javax</groupId>

                  <artifactId>javaee-web-api</artifactId>

              </dependency>

       

      <dependency>

                  <groupId>org.jboss.seam.faces</groupId>

                  <artifactId>seam-faces</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.ocpsoft</groupId>

                  <artifactId>prettyfaces-jsf2</artifactId>

              </dependency>

       

      <dependency>

                  <groupId>org.primefaces</groupId>

                  <artifactId>primefaces</artifactId>

                  <version>4.0</version>

              </dependency>

       

       

              <dependency>

                  <groupId>org.primefaces.themes</groupId>

                  <artifactId>bootstrap</artifactId>

              </dependency>

       

        <dependency>

                  <groupId>com.sun.faces</groupId>

                  <artifactId>jsf-impl</artifactId>

                  <!--<version>2.1.7</version>-->

                  <scope>provided</scope>

              </dependency>

       

      I have attempted adding jboss-jsf-api_2.1_spec dependency but still I continue to get the same failure trace.

      What could be the problem?