0

我已经创建了 JPA 项目(我使用 OpenJPA 2.0 作为 JPA 提供者)。

IDE:Websphere Software(RAD) 的 IBM Rational Software 架构师
JPA 提供者:OpenJPA
版本:2.0
数据库:Oracle

我在 Websphere(7.0 版)中创建了数据源,并尝试通过 JNDI 访问数据源。请在下面找到 persistence.xml。

<persistence version="2.0">

     <persistence-unit name="DataSourceDemo">

          <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>       
          <jta-data-source>oracleDS</jta-data-source>

          <class>com.nyl.ltc.auditlog.model.NylBatchPrint</class>

          <properties>
               <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
               <property name="openjpa.ConnectionUserName"   
                          value="admin" />
               <property name="openjpa.ConnectionPassword" value="admin" />
               <property name="openjpa.jdbc.Schema" value="SMSVC" />
          </properties>

     </persistence-unit>

</persistence>

所有数据库事务均成功,但出现以下异常。

Exception in thread "Attachment 49459" java.lang.UnsupportedOperationException: cannot get the capability, performing dispose of the retransforming environment
    at com.ibm.tools.attach.javaSE.Attachment.loadAgentLibraryImpl(Native Method)
    at com.ibm.tools.attach.javaSE.Attachment.loadAgentLibrary(Attachment.java:253)
    at com.ibm.tools.attach.javaSE.Attachment.parseLoadAgent(Attachment.java:235)
    at com.ibm.tools.attach.javaSE.Attachment.doCommand(Attachment.java:154)
    at com.ibm.tools.attach.javaSE.Attachment.run(Attachment.java:116)
Exception in thread "P=221586:O=0:CT" java.lang.UnsupportedOperationException: cannot get the capability, performing dispose of the retransforming environment
    at sun.instrument.InstrumentationImpl.isRetransformClassesSupported0(Native Method)
    at sun.instrument.InstrumentationImpl.isRetransformClassesSupported(InstrumentationImpl.java:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:600)
    at org.apache.openjpa.enhance.ClassRedefiner.canRedefineClasses(ClassRedefiner.java:123)
    at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:122)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:304)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:202)
    at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:213)
    at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:45)
    at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:30)
    at com.nyl.ltc.auditlog.util.JPAUtil.getEntityManager(JPAUtil.java:45)
    at com.nyl.ltc.auditlog.dao.sericeImpl.AuditLogDAOServiceImpl.persist(AuditLogDAOServiceImpl.java:27)
    at com.nyl.ltc.auditlog.serviceImpl.AuditLogServiceImpl.persistAuditLog(AuditLogServiceImpl.java:20)
    at com.nyl.ltc.auditlog.handlerImpl.AuditLogHandlerImpl.persistAuditlog(AuditLogHandlerImpl.java:22)
    at com.main.Main.main(Main.java:19)
2203  DataSourceDemo  INFO   [P=221586:O=0:CT] openjpa.Enhance - Creating subclass for "[class com.nyl.

请让我知道为什么我得到了这个例外,我该如何解决?

4

1 回答 1

0

Apache OpenJPA (JPA 1.0) 引擎随 Websphere 7 (Java EE 5) 一起提供。类加载器默认加载内部 OpenJPA 实现。您可能需要更改类加载器策略。

在WebSphere Application Server V7:了解类加载器中查看更多信息。

于 2013-08-15T16:20:24.273 回答