gpt4 book ai didi

java - JPA 与 Jboss 异常

转载 作者:行者123 更新时间:2023-12-01 05:19:42 28 4
gpt4 key购买 nike

如何解决此异常?

有人可以让我知道我收到此异常的原因吗:

配置:

           jdk1.6
Jboss4.2
JPA provider: OpenJpa
EclipseIDE

完整的堆栈跟踪:

 java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.util.MissingResourceException: org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
at org.apache.openjpa.lib.conf.ProductDerivations.reportErrors(ProductDerivations.java:380)
at org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:283)
at org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:357)
at org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:165)
at org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
... 6 more
Caused by: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
FATAL ERROR in native method: processing of -javaagent failed
at org.apache.openjpa.persistence.PersistenceUnitInfoImpl.toOpenJPAProperties(PersistenceUnitInfoImpl.java:477)
at org.apache.openjpa.persistence.PersistenceUnitInfoImpl.toOpenJPAProperties(PersistenceUnitInfoImpl.java:359)
at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:541)
at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:360)
at org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:274)
... 9 more
Exception in thread "main"

最佳答案

说明明显的情况...正在使用的 OpenJPA 版本需要 JPA2,而 JBoss 4.x 存在 JPA1 API jar...因此出现未找到 JPA2 方法的异常。使用一致版本的 JPA 和 JPA 实现

关于java - JPA 与 Jboss 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10615188/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com