문제

I try to develop JPA project on ibm RAD. And i can run it on Webpshere successfully, but the problem is my machine is quite old. So deploying in Java EE container isn't reasonable.And i want to run it on JSE.But it gives following error:

94  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.2.1-SNAPSHOT
235  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "com.ibm.ws.persistence.jdbc.sql.DB2Dictionary".
1797  test  WARN   [main] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class Customer]".
Exception in thread "main" <openjpa-1.2.1-SNAPSHOT-r422266:686069 fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class Customer" has not been enhanced.
    at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1650)
    at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1624)
    at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:717)
    at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:616)
    at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541)
    at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
    at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1114)
    at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
    at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
    at deneme.main(deneme.java:21)

What i'm missing?

By the my persistent.xml is:

**<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
    <provider>
        com.ibm.websphere.persistence.PersistenceProviderImpl
    </provider> 
        <class>Customer</class>
        <properties>
            <property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver"/>
            <property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:50000/PARUD:retrieveMessagesFromServerOnGetMessage=true;"/>
            <property name="openjpa.ConnectionUserName" value="db2admin"/>
            <property name="openjpa.ConnectionPassword" value="xxxxx"/>
            <property name="openjpa.jdbc.Schema" value="POOL"/>
        </properties>
    </persistence-unit>
</persistence>**
도움이 되었습니까?

해결책

는 완료, 개효 됨, 폐화 또는 핵심이 어떤 용도로 사용됩니까?

다른 팁

I just went through the exercise of getting OpenJPA 2.1.0 to run on Tomcat 7.0. I was simply unable to get run-time enhancement to work under Tomcat so I gave up and decided to use build-time enhancement. I am developing my code under Eclipse so I followed the instructions here:

http://openjpa.apache.org/enhancement-with-eclipse.html

Note however that the instructions on this page are for generic java projects. If you are working with Dynamic Web Projects, be sure to specify the build directory argument correctly. I used -Dbuild.dir=build/classes which is the typical location for the compiled code.

One more annoying quirk you have to live with. You must manually invoke the builder using the "Project > Build Project" menu item. When the enhancer runs, it modifies the previously built classes. Consequently, you need to hit F5 or Refresh for the project before you publish to Tomcat.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top