quality@glassfish.java.net

Re: Coding for Java-EE 6 while being compatible to Java-EE 5

From: Richard Kolb <rjdkolb_at_gmail.com>
Date: Wed, 23 Dec 2009 12:18:48 +0200

Hi Felipe

thanks for the fast response.

2009/12/23 Felipe Gaucho <fgaucho_at_gmail.com>

> You need to bundle the jpa libs with your app, and I am not sure if it will
> work at all....
>

thanks, I am doing that.
I add this to my maven project

        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.0.0</version>
        </dependency>

 But it seems I need this
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>

Since EntityManager::getCriteriaBuilder() is missing.



> Jpa 2 is java ee 6 and i am not sure if it should work on old servers :)
>

I am actually using OpenEJB to do unit testing and that is what is
failing...

            <groupId>org.apache.openejb</groupId>
            <artifactId>openejb-core</artifactId>
            <version>3.1.2</version>

And am getting :

FATAL - OpenEJB has encountered a fatal error and cannot be started: OpenEJB
encountered an unexpected error while attempting to instantiate the
assembler.
java.lang.ClassFormatError: Absent Code attribute in method that is not
native or abstract in class file
javax/resource/spi/ResourceAdapterInternalException

regards
Richard.