3 Replies Latest reply on Oct 10, 2012 8:43 AM by Randall Hauch

    Absent Code attribute in method that is not native or abstract...

    alex soto Newbie

      Hello,

       

      I am seeing this error during unit testing an EJB 3.1 class that uses JCR:

       

      Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/security/jacc/PolicyContext
                at java.lang.ClassLoader.defineClass1(Native Method)
                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
                at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
                at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
                at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
                at org.modeshape.common.util.ClassUtil.loadClassStrict(ClassUtil.java:196)
                at org.modeshape.jcr.JcrRepository.<init>(JcrRepository.java:933)
                at org.modeshape.jcr.JcrEngine.doCreateJcrRepository(JcrEngine.java:607)
                at org.modeshape.jcr.JcrEngine$RepositoryInitializer.call(JcrEngine.java:900)
                ... 6 more
      
      

       

      The EJB itself does not depend on ModeShape, but on JCR API.  The unit test attempts to create a ModeShape repository and fails with the exception above.

       

      My POM dependencies are:

       

          <dependencies>
              <dependency>
                  <groupId>javax</groupId>
                  <artifactId>javaee-api</artifactId>
                  <version>6.0</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>javax.jcr</groupId>
                  <artifactId>jcr</artifactId>
                  <version>2.0</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
                  <version>1.6.4</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.10</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-log4j12</artifactId>
                  <version>1.6.4</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.modeshape</groupId>
                  <artifactId>modeshape-jcr</artifactId>
                  <version>2.6.0.Final</version>
                  <scope>test</scope>
              </dependency>
          </dependencies>
      
      

       

      This post suggest it may be related to javeee-api: http://community.jboss.org/thread/18265

      I need javaee-api dependency because the EJB annotations, so I can't remove them.

      Before adding the unit test (that uses ModeShape), the project was compiling without any problem.

       

      Anybody seen this?

      Any idea on how to solve?

       

      Thanks