3 Replies Latest reply: May 3, 2012 1:13 AM by Maciej Swiderski RSS

Using Datanucleus JPA for MongoDB with JBPM5.2.0 gives an "class not enhanced" error

Kishore Jaladi Newbie

Hi,

I am trying to set JPA persistence for MongoDB with Datanucleus and I am getting the following error for org.drools.grid.service.directory.impl.AddressImpl. [details of the code and persistence.xml first].

Any ideas?

 

versions:

<dependency> 

        <groupId>org.datanucleus</groupId> 

        <artifactId>datanucleus-core</artifactId> 

        <version>[2.9, )</version> 

    </dependency> 

    <dependency> 

        <groupId>org.datanucleus</groupId> 

        <artifactId>datanucleus-mongodb</artifactId> 

        <version>[2.9, )</version> 

    </dependency>

<dependency> 

        <groupId>org.datanucleus</groupId> 

        <artifactId>datanucleus-api-jpa</artifactId> 

        <version>[2.9, )</version> 

    </dependency>

 

 

Code:

EntityManagerFactory emf = Persistence.createEntityManagerFactory("jbpm.mongodb.persistence.test", new HashMap<String, String>());

 

persistence.xml:

<persistence 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" version="1.0"> 

 

    <!-- Tutorial "unit" --> 

    <persistence-unit name="jbpm.mongodb.persistence.test"> 

        <properties> 

            <property name="datanucleus.ConnectionURL" value="mongodb:localhost/mng1"/> 

            <property name="datanucleus.storeManagerType" value="mongodb" /> 

            <property name="datanucleus.autoCreateSchema" value="true" /> 

        </properties> 

    </persistence-unit> 

 

</persistence>

 

error:

org.datanucleus.exceptions.NucleusUserException: Found Meta-Data for class org.drools.grid.service.directory.impl.AddressImpl but this class is not enhanced!! Please enhance the class before running DataNucleus.

    at org.datanucleus.metadata.MetaDataManager.initialiseClassMetaData(MetaDataManager.java:2570)

    at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaData(MetaDataManager.java:2521)

    at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:1117)

    at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:963)

    at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:751)

    at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:414)

    at org.datanucleus.api.jpa.JPAEntityManagerFactory.<init>(JPAEntityManagerFactory.java:377)

    at org.datanucleus.api.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:91)

    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)

    at com.x.infra.service.griffin.impl.EventHandler.handleGetOrderStatus(EventHandler.java:73)

    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 com.x.infra.application.webeventlistener.Callback.invoke(Callback.java:68)

    at com.x.infra.application.processor.GenericAsyncResponseProcessor.invoke(GenericAsyncResponseProcessor.java:107)

    at com.x.infra.application.processor.GenericAsyncResponseProcessor.execute(GenericAsyncResponseProcessor.java:51)

    at com.x.infra.application.processor.GenericAsyncResponseProcessor.run(GenericAsyncResponseProcessor.java:37)

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

    at java.lang.Thread.run(Thread.java:662)

  • 1. Re: Using Datanucleus JPA for MongoDB with JBPM5.2.0 gives an "class not enhanced" error
    Mauricio Salatino Master

    the error doesn;t appear.. can you check that please?

  • 2. Re: Using Datanucleus JPA for MongoDB with JBPM5.2.0 gives an "class not enhanced" error
    Kishore Jaladi Newbie

    Hmmm...interesting...I can see it in my original message. Here is it again:

    Code:

    EntityManagerFactory emf = Persistence.createEntityManagerFactory("jbpm.mongodb.persistence.test", new HashMap<String, String>());

     

    persistence.xml:

    <persistence 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" version="1.0"> 

     

        <!-- Tutorial "unit" --> 

        <persistence-unit name="jbpm.mongodb.persistence.test"> 

            <properties> 

                <property name="datanucleus.ConnectionURL" value="mongodb:localhost/mng1"/> 

                <property name="datanucleus.storeManagerType" value="mongodb" /> 

                <property name="datanucleus.autoCreateSchema" value="true" /> 

            </properties> 

        </persistence-unit> 

     

    </persistence>

     

    error:

    org.datanucleus.exceptions.NucleusUserException: Found Meta-Data for class org.drools.grid.service.directory.impl.AddressImpl but this class is not enhanced!! Please enhance the class before running DataNucleus.

        at org.datanucleus.metadata.MetaDataManager.initialiseClassMetaData(MetaDataManager.java:2570)

        at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaData(MetaDataManager.java:2521)

        at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:1117)

        at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:963)

        at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:751)

        at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:414)

        at org.datanucleus.api.jpa.JPAEntityManagerFactory.<init>(JPAEntityManagerFactory.java:377)

        at org.datanucleus.api.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:91)

        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)

        at com.x.infra.service.griffin.impl.EventHandler.handleGetOrderStatus(EventHandler.java:73)

        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 com.x.infra.application.webeventlistener.Callback.invoke(Callback.java:68)

        at com.x.infra.application.processor.GenericAsyncResponseProcessor.invoke(GenericAsyncResponseProcessor.java:107)

        at com.x.infra.application.processor.GenericAsyncResponseProcessor.execute(GenericAsyncResponseProcessor.java:51)

        at com.x.infra.application.processor.GenericAsyncResponseProcessor.run(GenericAsyncResponseProcessor.java:37)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

        at java.lang.Thread.run(Thread.java:662)

  • 3. Re: Using Datanucleus JPA for MongoDB with JBPM5.2.0 gives an "class not enhanced" error
    Maciej Swiderski Master

    you could try to use exlcude unlisted classes tag in your persistence.xml to avoid persistence provider to pick up classes that are not needed for jBPM persistence.

     

    HTH