我正试图在我的hudson集成服务器上执行Spring Roo项目的构建(= Spring MVC + aspectj + hibernate)。
该项目已配置为使用
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>com.springsource.javax.persistence</artifactId>
<version>1.0.0</version>
</dependency>我本地maven的构建运行良好,但服务器上的环境似乎注入了其他版本的javax.persistence,这导致了以下错误:
[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>)构建是用maven运行的,它的配置是:
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"编辑:我在本地和服务器上使用的roo版本不同:)
发布于 2010-11-19 19:14:20
你在你的项目中使用JPA2吗?
JPA2是JavaEE6的一部分,在我看来,您使用的是this方法:
<T> TypedQuery<T> createQuery(java.lang.String qlString, java.lang.Class<T> resultClass)这个方法在JPA1 (JavaEE5)中是不存在的,您可以通过检查EntityManager来看到这一点
Query createQuery(String qlString)存在。
所有这些都意味着Hudson正在为JPA1使用javax.persistence。我还没有用过Hudson,所以你得看看能不能在JPA2上用javax.persistence。
发布于 2010-11-19 19:15:20
奇怪的是,它在本地工作。
您对JPA1有依赖关系,但使用JPA2 (createQuery(query, class))的方法。
检查您的本地类路径。
https://stackoverflow.com/questions/4224259
复制相似问题