Mr Cold
Mr Cold

Reputation: 123

Use Tomcat 6.0 as server for java web application cause javax.persistence annotations to be messed up

Normally, I use Glass Fish as my testing server for NetBeans. Recently, I tried to switch to Tomcat 6.0. As soon as I changed the server, compiler no longer understand javax.persistence.Entity. When I checked out the library structure of Tomcat 6.0, there was a file named annotation-api.jar, in which another javax.persistence package resides (!!!). Is it possible to resolve this kind of conflict, which there are two package with different contents share the same name?

Upvotes: 0

Views: 1642

Answers (1)

BalusC
BalusC

Reputation: 1108742

The annotation-api.jar is not a JPA implementation. There is no means of collisions in classpath as you seem to think (that would have produced runtime errors rather than simple compilation errors). Tomcat doesn't have any JPA implementation while Glassfish has one built-in. You need to provide one yourself. You can choose of under each OpenJPA, Hibernate, TopLink or EclipseLink. And ensure that you placed it in Webapp/WEB-INF/lib.

Upvotes: 2

Related Questions