Search code examples
jakarta-eejava-ee-6jboss-arquillianweblogic12c

ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException


I'm trying to use Arquillian against weblogic 12C.

I put the following configuration in my pom.xml

<dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.0.0.CR7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.protocol</groupId>
        <artifactId>arquillian-protocol-servlet</artifactId>
        <version>1.0.0.CR7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
        <version>1.0.0-beta-5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-wls-remote-12.1</artifactId>
        <version>1.0.0.Alpha2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>weblogic</groupId>
        <artifactId>wlfullclient</artifactId>
        <version>12.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-6.0</artifactId>
        <version>3.0.0.Final</version>
        <scope>test</scope>
    </dependency>

Then, I configured the arquillian.xml file as following :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org.schema/arquillian"
            xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
    <container qualifier="weblogic" default="true">
        <configuration>
            <protocol type="Servlet 3.0">
                <property name="executionType">REMOTE</property>
            </protocol>
            <property name="adminUrl">t3://localhost:7001</property>
            <property name="adminUserName">weblogic</property>
            <property name="adminPassword">weblogic1</property>
            <property name="target">AdminServer</property>
            <property name="wlsHome">c:\java\servers\wls12c\wlserver</property>
        </configuration>
    </container>
</arquillian>

Finally I tried to "create" an archive with Arquillian :

 JavaArchive ejbArchive = ShrinkWrap.create(JavaArchive.class,"jee6app-ejb.jar").addAsResource("META-INF/persistence.xml","META-INF/persistence.xml").addPackages(false,Adr.class.getPackage(),Service.class.getPackage());
           EnterpriseArchive earArchive = ShrinkWrap.create(EnterpriseArchive.class, "jee6app.ear").addAsModule(ejbArchive).addAsLibraries(
                   new File("target/test-libs/validation-api.jar"),
                   new File("target/test-libs/hibernate-entitymanager.jar"),
                   new File("target/test-libs/hibernate-validator.jar"),
                   new File("target/test-libs/javassist.jar"),
                   new File("target/test-libs/asm.jar"),
                   new File("target/test-libs/cglib.jar"),
                   new File("target/test-libs/hibernate-jpa.jar"),
                   new File("target/test-libs/hibernate-commons-annotations.jar"),
                   new File("target/test-libs/hibernate-annotations.jar"),
                   new File("target/test-libs/slf4j-api.jar"),
                   new File("target/test-libs/jta.jar"),
                   new File("target/test-libs/dom4j.jar"),
                   new File("target/test-libs/commons-collections.jar"),
                   new File("target/test-libs/antlr.jar"),
                   new File("target/test-libs/hibernate-core.jar")
                   );

            return earArchive;

So, after all of those things, I always have the following error :

Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException
    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)

What's wrong in my configuration? As you can see before, I tried to add to the classpath the wlfullclient jar and jboss api jar

Thanks in advance for your help

Regards


Solution

  • Seeing that you're pulling in the javaee-api artifact into your test scope, you might want to use the JBoss provided APIs,

    See this Arquillian FAQ for more details.

    Or, in the case of WLS, you could rely on the wlfullclient.jar to provide the required classes. You'll need to install it into a Maven repo (perhaps into an organization-wide one), and then reference it in your project.