简体   繁体   中英

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?

JPA 2.1 is for JavaEE7 and Java 7 onwards.

For JavaEE compatibity with JDK versions, I would take a look at this previous StackOverflow question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM