我对 Java EE 领域还很陌生,所以请原谅我的无知;我继承了一个使用 guice-persist 和 hibernate 来处理 ORM 的应用程序。
我正在尝试使用CriteriaQuery
,但我发现我的jaxax.persistence.EntityManager
似乎是这个接口(来自 EJB),而不是我想要的接口(来自 JPA),所以我无法使用createQuery(CriteriaQuery)
.
这是一个 Maven 项目,我不清楚这个 EJB 代码是从哪里来的——我从 Guice-Persist 和 Hibernate 中看到的一切都显示了 JPA 接口,而不是 EJB 接口,所以我不知道这个 EJB 包在哪里来自。
这里有什么想法吗?我是否有一个杂散的 Maven 依赖项将 EJB 引入我的项目,或者听起来我误解了持久层并且实际上在我的应用程序中需要 EJB?
如果您让我知道您需要什么,我将很乐意发布更多信息。
编辑:
经过仔细检查,我开始怀疑我的“远程”项目有一个格式错误的 pom.xml。下面的依赖树。
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ texasU ---
[INFO] texasU:texasU:war:1.1.2-SNAPSHOT
[INFO] +- com.google.gwt:gwt-user:jar:2.5.0-rc1:provided
[INFO] | +- (javax.validation:validation-api:jar:1.0.0.GA:compile - scope updat
ed from provided; omitted for duplicate)
[INFO] | +- javax.validation:validation-api:jar:sources:1.0.0.GA:provided
[INFO] | \- org.json:json:jar:20090211:provided
[INFO] +- com.google.gwt:gwt-servlet:jar:2.5.0-rc1:runtime
[INFO] +- com.arcbees.core:arcbees-core:jar:1.0-SNAPSHOT:provided
[INFO] | +- (com.google.gwt:gwt-servlet:jar:2.4.0:provided - omitted for confli
ct with 2.5.0-rc1)
[INFO] | +- com.google.appengine:appengine-api-1.0-sdk:jar:1.6.1:provided
[INFO] | +- (com.gwtplatform:gwtp-dispatch-server-guice:jar:0.8-SNAPSHOT:provid
ed - omitted for duplicate)
[INFO] | +- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile - sc
ope updated from provided; omitted for duplicate)
[INFO] | +- (com.google.inject:guice:jar:3.0:compile - scope updated from provi
ded; omitted for duplicate)
[INFO] | +- (com.google.inject.extensions:guice-servlet:jar:3.0:provided - omit
ted for duplicate)
[INFO] | +- (com.google.inject.extensions:guice-assistedinject:jar:3.0:provided
- omitted for duplicate)
[INFO] | +- javax.persistence:persistence-api:jar:1.0:provided
[INFO] | +- org.restlet.gae:org.restlet:jar:2.1-RC2:provided
[INFO] | \- org.restlet.gae:org.restlet.ext.servlet:jar:2.1-RC2:provided
[INFO] | \- (org.restlet.gae:org.restlet:jar:2.1-RC2:provided - omitted for
duplicate)
[INFO] +- com.gwtplatform:gwtp-mvp-client:jar:0.8-SNAPSHOT:provided
[INFO] | \- com.gwtplatform:gwtp-clients-common:jar:0.8-SNAPSHOT:provided
[INFO] | \- (com.google.inject:guice:jar:3.0:provided - omitted for duplicat
e)
[INFO] +- com.gwtplatform:gwtp-dispatch-client:jar:0.8-SNAPSHOT:provided
[INFO] | +- (com.gwtplatform:gwtp-clients-common:jar:0.8-SNAPSHOT:provided - om
itted for duplicate)
[INFO] | +- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:provided - o
mitted for duplicate)
[INFO] | \- (com.google.inject:guice:jar:3.0:provided - omitted for duplicate)
[INFO] +- com.gwtplatform:gwtp-dispatch-server-guice:jar:0.8-SNAPSHOT:compile
[INFO] | +- com.gwtplatform:gwtp-dispatch-server:jar:0.8-SNAPSHOT:compile
[INFO] | | \- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile -
omitted for duplicate)
[INFO] | +- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile - om
itted for duplicate)
[INFO] | \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
[INFO] +- com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile
[INFO] +- com.gwtplatform:gwtp-processors:jar:0.8-SNAPSHOT:provided
[INFO] +- com.google.inject:guice:jar:3.0:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- com.google.inject.extensions:guice-servlet:jar:3.0:compile
[INFO] | \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
[INFO] +- com.google.inject.extensions:guice-assistedinject:jar:3.0:compile
[INFO] | \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
[INFO] +- com.google.gwt.inject:gin:jar:1.5.0:provided
[INFO] | +- (com.google.inject:guice:jar:3.0-rc2:provided - omitted for conflic
t with 3.0)
[INFO] | +- (com.google.inject.extensions:guice-assistedinject:jar:3.0-rc2:prov
ided - omitted for conflict with 3.0)
[INFO] | \- (com.google.gwt:gwt-servlet:jar:2.2.0:provided - omitted for confli
ct with 2.5.0-rc1)
[INFO] +- mysql:mysql-connector-java:jar:5.1.21:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.1.4.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar
:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Fin
al:compile
[INFO] | +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:
compile
[INFO] | \- (org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile - omitted
for conflict with 3.1.0.GA)
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.4.Final:compile
[INFO] | +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - omitted for
duplicate)
[INFO] | +- (org.hibernate:hibernate-core:jar:4.1.4.Final:compile - omitted for
duplicate)
[INFO] | +- (org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:ja
r:1.0.0.Final:compile - omitted for duplicate)
[INFO] | +- (dom4j:dom4j:jar:1.6.1:compile - omitted for duplicate)
[INFO] | +- (org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Fi
nal:compile - omitted for duplicate)
[INFO] | +- (org.javassist:javassist:jar:3.15.0-GA:compile - omitted for duplic
ate)
[INFO] | \- (org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final
:compile - omitted for duplicate)
[INFO] +- org.hibernate:hibernate-validator:jar:4.3.0.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] | \- (org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile - omitted fo
r conflict with 3.1.0.GA)
[INFO] +- com.google.inject.extensions:guice-persist:jar:3.0:compile
[INFO] | \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
[INFO] +- org.hibernate:hibernate-c3p0:jar:4.1.4.Final:compile
[INFO] | +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - omitted for
duplicate)
[INFO] | +- (org.hibernate:hibernate-core:jar:4.1.4.Final:compile - omitted for
duplicate)
[INFO] | \- c3p0:c3p0:jar:0.9.1:compile
[INFO] +- com.googlecode.gwtquery:gwtquery:jar:1.1.0:provided
[INFO] +- com.google.guava:guava:jar:13.0-rc2:compile
[INFO] +- com.google.guava:guava-gwt:jar:13.0-rc2:provided
[INFO] | \- (com.google.guava:guava:jar:13.0-rc2:provided - omitted for duplica
te)
[INFO] +- org.mindrot:jbcrypt:jar:0.3m:compile
[INFO] +- javax.mail:mail:jar:1.4.5:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- edu.utsouthwestern.qbri.remoter:service-bundle:jar:1.0-SNAPSHOT:compil
e
[INFO] | +- org.nuiton.thirdparty:Rserve:jar:0.6-1:compile
[INFO] | +- org.nuiton.thirdparty:REngine:jar:0.6-1:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.5.1:compile
[INFO] | | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | | +- asm:asm:jar:3.3:compile
[INFO] | | +- org.apache.cxf:cxf-api:jar:2.5.1:compile
[INFO] | | | +- org.apache.cxf:cxf-common-utilities:jar:2.5.1:compile
[INFO] | | | | +- (org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile
- omitted for duplicate)
[INFO] | | | | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.1:runtime
[INFO] | | | | \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] | | | +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile
[INFO] | | | +- org.apache.neethi:neethi:jar:3.0.1:compile
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] | | +- org.apache.cxf:cxf-rt-core:jar:2.5.1:compile
[INFO] | | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
cate)
[INFO] | | | +- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
[INFO] | | | +- (org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile - o
mitted for duplicate)
[INFO] | | | \- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.
1:compile
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.1:compile
[INFO] | | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
cate)
[INFO] | | | +- org.apache.cxf:cxf-tools-common:jar:2.5.1:compile
[INFO] | | | | +- (wsdl4j:wsdl4j:jar:1.6.2:compile - omitted for duplicate)
[INFO] | | | | +- (com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile - omitted f
or duplicate)
[INFO] | | | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for du
plicate)
[INFO] | | | | +- (org.apache.cxf:cxf-common-utilities:jar:2.5.1:compile - o
mitted for duplicate)
[INFO] | | | | \- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted fo
r duplicate)
[INFO] | | | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.5.1:compile
[INFO] | | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for du
plicate)
[INFO] | | | +- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted fo
r duplicate)
[INFO] | | | \- (com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile - omitted f
or duplicate)
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.5.1:compile
[INFO] | | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
cate)
[INFO] | | | \- (org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.5.1:compile - o
mitted for duplicate)
[INFO] | | +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.5.1:compile
[INFO] | | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
cate)
[INFO] | | | +- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted for d
uplicate)
[INFO] | | | \- (org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.1:compile - omit
ted for duplicate)
[INFO] | | \- org.apache.cxf:cxf-rt-ws-addr:jar:2.5.1:compile
[INFO] | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
cate)
[INFO] | | +- (org.apache.cxf:cxf-common-utilities:jar:2.5.1:compile - omit
ted for duplicate)
[INFO] | | \- (org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.1:compile - omit
ted for duplicate)
[INFO] | \- org.apache.cxf:cxf-rt-transports-http:jar:2.5.1:compile
[INFO] | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for duplicat
e)
[INFO] | +- org.apache.cxf:cxf-rt-transports-common:jar:2.5.1:compile
[INFO] | | +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
cate)
[INFO] | | \- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted for d
uplicate)
[INFO] | +- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted for dupl
icate)
[INFO] | \- org.springframework:spring-web:jar:3.0.6.RELEASE:compile
[INFO] | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplic
ate)
[INFO] | +- org.springframework:spring-beans:jar:3.0.6.RELEASE:compile
[INFO] | | \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile
- omitted for duplicate)
[INFO] | +- org.springframework:spring-context:jar:3.0.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:3.0.6.RELEASE:compile
[INFO] | | | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for
duplicate)
[INFO] | | | +- (org.springframework:spring-asm:jar:3.0.6.RELEASE:compi
le - omitted for duplicate)
[INFO] | | | +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:com
pile - omitted for duplicate)
[INFO] | | | \- (org.springframework:spring-core:jar:3.0.6.RELEASE:comp
ile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compil
e - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile
- omitted for duplicate)
[INFO] | | +- org.springframework:spring-expression:jar:3.0.6.RELEASE:co
mpile
[INFO] | | | \- (org.springframework:spring-core:jar:3.0.6.RELEASE:comp
ile - omitted for duplicate)
[INFO] | | \- org.springframework:spring-asm:jar:3.0.6.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:3.0.6.RELEASE:compile
[INFO] | +- (org.springframework:spring-asm:jar:3.0.6.RELEASE:compile
- omitted for duplicate)
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.apache.commons:commons-io:jar:1.3.2:compile
[INFO] +- com.googlecode.gwt.charts:gwt-charts:jar:0.9.5:compile
[INFO] +- junit:junit:jar:4.10:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- org.mockito:mockito-all:jar:1.9.5-rc1:test
[INFO] +- org.jukito:jukito:jar:1.1:test
[INFO] | +- org.mockito:mockito-core:jar:1.8.5:test
[INFO] | | +- (org.hamcrest:hamcrest-core:jar:1.1:test - omitted for duplicate
)
[INFO] | | \- org.objenesis:objenesis:jar:1.0:test
[INFO] | +- (junit:junit:jar:4.5:test - omitted for conflict with 4.10)
[INFO] | +- (com.google.inject:guice:jar:3.0:test - omitted for duplicate)
[INFO] | \- (com.google.inject.extensions:guice-assistedinject:jar:3.0:test - o
mitted for duplicate)
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:2.22.0:test
[INFO] | +- org.seleniumhq.selenium:selenium-android-driver:jar:2.22.0:test
[INFO] | | \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
[INFO] | | +- cglib:cglib-nodep:jar:2.1_3:test
[INFO] | | +- (org.json:json:jar:20080701:test - omitted for conflict with
20090211)
[INFO] | | +- (org.seleniumhq.selenium:selenium-api:jar:2.22.0:test - omitt
ed for duplicate)
[INFO] | | +- (org.apache.httpcomponents:httpclient:jar:4.1.2:test - omitte
d for duplicate)
[INFO] | | +- (com.google.guava:guava:jar:12.0:test - omitted for conflict
with 13.0-rc2)
[INFO] | | +- (org.apache.commons:commons-exec:jar:1.1:test - omitted for d
uplicate)
[INFO] | | +- (net.java.dev.jna:jna:jar:3.4.0:test - omitted for duplicate)
[INFO] | | \- (net.java.dev.jna:platform:jar:3.4.0:test - omitted for dupli
cate)
[INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.22.0:test
[INFO] | | \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
- omitted for duplicate)
[INFO] | +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.22.0:test
[INFO] | | +- org.seleniumhq.selenium:selenium-api:jar:2.22.0:test
[INFO] | | | \- (com.google.guava:guava:jar:12.0:test - omitted for conflict
with 13.0-rc2)
[INFO] | | +- net.sourceforge.htmlunit:htmlunit:jar:2.9:test
[INFO] | | | +- xalan:xalan:jar:2.7.1:test
[INFO] | | | | \- xalan:serializer:jar:2.7.1:test
[INFO] | | | | \- (xml-apis:xml-apis:jar:1.3.04:test - omitted for duplic
ate)
[INFO] | | | +- commons-collections:commons-collections:jar:3.2.1:test
[INFO] | | | +- commons-lang:commons-lang:jar:2.6:test
[INFO] | | | +- org.apache.httpcomponents:httpmime:jar:4.1.2:test
[INFO] | | | | +- (org.apache.httpcomponents:httpcore:jar:4.1.2:test - omitt
ed for duplicate)
[INFO] | | | | \- (commons-logging:commons-logging:jar:1.1.1:test - omitted
for duplicate)
[INFO] | | | +- commons-codec:commons-codec:jar:1.4:test
[INFO] | | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.9:test
[INFO] | | | +- xerces:xercesImpl:jar:2.9.1:test
[INFO] | | | | \- xml-apis:xml-apis:jar:1.3.04:test
[INFO] | | | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.15:test
[INFO] | | | +- net.sourceforge.cssparser:cssparser:jar:0.9.5:test
[INFO] | | | | \- org.w3c.css:sac:jar:1.3:test
[INFO] | | | +- (commons-io:commons-io:jar:2.0.1:test - omitted for duplicate
)
[INFO] | | | \- (commons-logging:commons-logging:jar:1.1.1:compile - scope up
dated from test; omitted for duplicate)
[INFO] | | \- org.apache.httpcomponents:httpclient:jar:4.1.2:test
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.1.2:test
[INFO] | | \- (commons-logging:commons-logging:jar:1.1.1:compile - scope up
dated from test; omitted for duplicate)
[INFO] | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.22.0:test
[INFO] | | +- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
- omitted for duplicate)
[INFO] | | +- commons-io:commons-io:jar:2.0.1:test
[INFO] | | \- org.apache.commons:commons-exec:jar:1.1:test
[INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.22.0:test
[INFO] | | +- net.java.dev.jna:jna:jar:3.4.0:test
[INFO] | | +- net.java.dev.jna:platform:jar:3.4.0:test
[INFO] | | \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
- omitted for duplicate)
[INFO] | +- org.seleniumhq.selenium:selenium-iphone-driver:jar:2.22.0:test
[INFO] | | \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
- omitted for duplicate)
[INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.22.0:test
[INFO] | | +- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
- omitted for duplicate)
[INFO] | | \- (org.webbitserver:webbit:jar:0.4.6:test - omitted for duplicate)
[INFO] | +- org.seleniumhq.selenium:selenium-support:jar:2.22.0:test
[INFO] | | \- (org.seleniumhq.selenium:selenium-api:jar:2.22.0:test - omitted
for duplicate)
[INFO] | \- org.webbitserver:webbit:jar:0.4.6:test
[INFO] | \- org.jboss.netty:netty:jar:3.2.7.Final:test
[INFO] +- info.cukes:cucumber-java:jar:1.0.11:test
[INFO] | \- info.cukes:cucumber-core:jar:1.0.11:test
[INFO] | +- info.cukes:gherkin:jar:2.11.1:test
[INFO] | \- info.cukes:cucumber-html:jar:0.2.1:test
[INFO] +- info.cukes:cucumber-guice:jar:1.0.11:test
[INFO] | \- (info.cukes:cucumber-java:jar:1.0.11:test - omitted for duplicate)
[INFO] \- info.cukes:cucumber-junit:jar:1.0.11:test
[INFO] \- (info.cukes:cucumber-core:jar:1.0.11:test - omitted for duplicate)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.014s
[INFO] Finished at: Tue Sep 11 09:08:32 CDT 2012
[INFO] Final Memory: 13M/218M
[INFO] ------------------------------------------------------------------------
RemoteR 应该是一个自主运行的 CXF SOAP Web 服务。我在这个项目中想要的只是“客户端”部分,它能够向其他地方托管的 Web 服务发出请求。因此,在我当前的项目中看到 spring 依赖项让我怀疑我可能在这里遇到了一些 JPA 冲突。