views:

677

answers:

1
+1  Q: 

openJPA on Java SE

Hi guys,

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 JEE 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"&gt;
    <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>**
+3  A: 

Just a pointer: You need to enhance your classes e.g. at runtime via -javaagent:yourlib.jar or even while compiling. You could learn more on this topic here:

"The second and recommended way get runtime enhancement is to provide a javaagent when launching the JVM that OpenJPA is going run in."

Karussell
yes i tried javaagent.like this-javaagent:C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.jpa.jarit gives error: "Couldn't create Java Virtual machine"
qasanov
the problem was space "Program Files" here. I moved file under "C:\com.ibm.ws.jpa.jar" and everthing seems ok. thanks in advance :)
qasanov