1

I've tried to test an EJB class whith JUnit but I gave this error :

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

I've added follow dependencies:

    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.openejb</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0-6</version>
        <scope>test</scope>
    </dependency>

what should I do to resolve this error?

1 Answers1

1

Unfortunately this is a known problem with javax:javaee-api:6.0 artifact. For licensing reasons of some sort Oracle elected to deploy this to the maven central repo minus any implementation byte code. Consequently you can compile against it but not execute code that is dependent upon it.

You already have the org.apache.openejb:javaee-api:6.0-6 artifact in your pom and you could completely replace the above with this one at provided scope.

There is some discussion regarding this issue at TROUBLE WITH CRIPPLED JAVA EE 6 APIS IN MAVEN REPOSITORY AND THE SOLUTION.

Steve C
  • 18,876
  • 5
  • 34
  • 37