开发者

javax.persistence in java-6-openjdk

I am trying to perform the build of a Spring Roo project (= Spring MVC + aspectj + hibernate) on my hudson integration server.

The project is configured tu use

<dependency>
<groupId>javax.persistence</groupId>
<artifactId>com.springsource.javax.persistence</artifactId>
<version>1.0.0</version>
</dependency>

The build with my local maven works fine, but the environment on the server seems to inject some other version of javax.persistence which leads to these err开发者_如何学运维ors:

[ERROR] The method createQuery(String) in the type EntityManager is not applicable for the arguments (String, Class<Long>)
[ERROR] The method createQuery(String) in the type EntityManager is not applicable for the arguments (String, Class<Folder>)

The build is ran with maven and it's configuration is:

Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_18
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux" version: "2.6.32-5-amd64" arch: "amd64" Family: "unix"

edit: I wasn't using the same version of roo locally and on the server :)


Are you using JPA2 in your project?

JPA2 is part of Java EE 6, and from what I see, you're using this method:

<T> TypedQuery<T> createQuery(java.lang.String qlString, java.lang.Class<T> resultClass)

This method doesn't exist in JPA1 (Java EE 5), as you can see by examining EntityManager where only

Query createQuery(String qlString)

exists.

All of this means that Hudson is using javax.persistence for JPA1. I haven't used Hudson, so you will have to find out if you can make it use javax.persistence for JPA2.


What's strange is that it works locally.

You have a dependency to JPA 1, but use methods of JPA 2 (createQuery(query, class)).

Check your local classpath.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜