开发者

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开发者_StackOverflow resolve this kind of conflict, which there are two package with different contents share the same name?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜