vendredi 19 juin 2015

How to choose the right JDK JavaEE Spring version

Generally I will use the following framework in my project: Spring MVC + Hibernate with Tomcat as the container.

And I never care about the version, the later the better.

This is the concrete SDK, framework version in the project:

JDK 1.7
Spring Framework:
    spring-webmvc >> 4.1.6.RELEASE
Hibernate:
    hibernate-entitymanager >> 4.3.10.Final
        org.hibernate.javax.persistence >> hibernate-jpa-2.1-api >> 1.0.0.Final
Tomcat 7

The application works well under tomcat, however I meet some problems when I deploy the application from Tomcat to a Java EE Server(which support JavaEE 5 only).

One of the error I got is something like:

java.lang.NoSuchMethodError: javax.persistence.Table.indexes()

It seems that the indexes is a new method in JPA2.1(which is supported in JavaEE 7) while the Java EE server does not provide it.

But as shown, the hibernate dependency org.hibernate.javax.persistence >> hibernate-jpa-2.1-api >> 1.0.0.Final provide the methods, why the Java EE Server can not use that?

And to solve the problme, for a given JavaEE Server say it support JavaEE 5 only, what should be under consideration when choosing JDK, frameworks?

Aucun commentaire:

Enregistrer un commentaire