Announcement Announcement Module
Collapse
No announcement yet.
probleme with provider DATANUCLEUS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • probleme with provider DATANUCLEUS

    hello every body;
    i create a spring ROO(1.2 release) project with STS i use this list of command :

    jpa setup --provider DATANUCLEUS --database HYPERSONIC_IN_MEMORY
    entity jpa --class ~.Employee
    field string --fieldName name
    web mvc setup
    web mvc all --package ~.web

    when i start it to the server i have this error :
    2012-02-28 11:29:47,259 [Thread-10] ERROR DataNucleus.Persistence - Error : An error occurred trying to instantiate an instance of the API adapter "org.datanucleus.api.jpa.JPAAdapter" (perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH, or the api jar for the persistence spec you are using?) : {1}

    all the dependency already existing in my CLASSPATH
    so can some one help me please !!!

  • #2
    I just published an article to TheServerSide that discusses how to set up and configure your development environment to use DataNucleus as the Java Persistence API (JPA) provider. I've linked to this thread from the article, hoping anyone who is having trouble running the example might post their question here and take advantage of the big brains that make up the JavaRanch community.

    Anyways, the darnedest thing about putting together the tutorial was that during the writing, I kept getting this annoying error that said:

    Exception in thread "main" javax.persistence.PersistenceException:
    No persistence providers available for "PU" after trying the following discovered implementations:
    org.datanucleus.jpa.PersistenceProviderImpl
    at javax.persistence.Persistence.createEntityManagerF actory(Persistence.java:180)
    at javax.persistence.Persistence.createEntityManagerF actory


    Anyways, I saw a few posts on the issue, but no solutions. I knew it had to be a simple mistake, and sure enough, it was. I had the incorrect entry in my persistence.xml file:
    view plaincopy to clipboardprint?
    <!-- INCORRECT -->
    <provider>org.datanucleus.jpa.EntityManagerFactory Impl</provider>

    The correct entry for this application should have been:
    view plaincopy to clipboardprint?
    <provider>org.datanucleus.jpa.PersistenceProviderI mpl</provider>


    The full persistence.xml file looked like this:

    view plaincopy to clipboardprint?

    <?xml version="1.0" encoding="UTF-8" ?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name="PU">
    <provider>org.datanucleus.jpa.PersistenceProviderI mpl</provider>
    <class>com.mcnz.model.GameSummary</class>
    <exclude-unlisted-classes />
    <properties>
    <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/rps" />
    <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
    <property name="javax.persistence.jdbc.user" value="root" />
    <property name="javax.persistence.jdbc.password" value="password" />
    </properties>
    </persistence-unit>
    </persistence>


    Anyways, that fixed it, just in case anyone is having a similar issue.
    Last edited by hasselcloud; Mar 5th, 2012, 01:53 PM.

    Comment


    • #3
      Perhaps you really don't have the jar "datanucleus-api-jpa-{version}.jar" in the CLASSPATH ?

      Please note that
      In DataNucleus v1 and v2 the JPA persistence provider was in jar "datanucleus-jpa-{version}.jar" and the provider had class name "org.datanucleus.jpa.PersistenceProviderImpl".
      In DataNucleus v3 the JPA persistence provider is in jar "datanucleus-api-jpa-{version}.jar" and the provider has class name "org.datanucleus.api.jpa.PersistenceProviderImpl"
      Last edited by andy; Feb 28th, 2012, 12:38 PM.

      Comment


      • #4
        in the CLASSPATH i have "datanucleus-api-jpa-3.0.6.jar" and the class provider "org.datanucleus.api.jpa.PersistenceProviderIm pl" has already exist so i don't know were is the problem , so can some one help me please ?

        Comment


        • #5
          sure you do, ... but the log tells you (DEBUG level) what is in the CLASSPATH (in terms of DataNucleus plugins available), so why not post that here. Those plugins have their own dependencies too ... like javax.persistence (JPA2), or javax.jdo for example
          Last edited by andy; Mar 1st, 2012, 12:07 PM.

          Comment


          • #6
            i use datanucleus V2 to resolve this error but now i have a new bug :
            ERROR DataNucleus.MetaData - Found Meta-Data for class com.ex.Employee but this class is not enhanced!! Please enhance the class before running DataNucleus.
            org.datanucleus.exceptions.NucleusUserException: Found Meta-Data for class com.ex.Employee but this class is not enhanced!! Please enhance the class before running DataNucleus.

            Comment

            Working...
            X