Announcement Announcement Module
Collapse
No announcement yet.
Datanucleus Plugin (Bundle) "org.datanucleus.enhancer" is already registered Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Datanucleus Plugin (Bundle) "org.datanucleus.enhancer" is already registered

    Using clean maven repositories and both mvn 3.0.4 as well as 2.2.1 I get this error.

    To reproduce:

    project --topLevelPackage com.peoplemerge.roodemo
    jpa setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
    entity jpa --class ~.domain.Topping --testAutomatically
    field string --fieldName name --notNull --sizeMin 2
    perform tests

    The URL "file:/C:/Users/dave/.m2/repository/org/datanucleus/datanucleus-enhancer/3.0.1/datanucleus-enhancer-3.0.1.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/C:/Users/dave/.m2/repository/org/datanucleus/datanucleus-enhancer/3.1.0-m1/datanucleus-enhancer-3.1.0-m1.jar." -> [Help 1]

    I'm new to Roo but I can't find a way around this. Is this problem at datanucleus m2 repo?

  • #2
    Why not address why you have 2 versions of "datanucleus-enhancer" in the CLASSPATH? The DataNucleus Maven plugin v3.0.2 shown here clearly only pulls in v3.0.1 of the enhancer jar. So where is the other one coming from? You have a pom.xml file there somewhere and that will tell you

    Comment


    • #3
      yep

      Thanks for your quick reply and, agreed, let's look at what's in the pom that's causing this.

      I'm new to this forum so my apologies for not including a full 'mvn -X' and the pomfile as well. Somehow my attachments here are limited to 19.5k and the log and pomfile both exceed that.

      But I had the same problem on 3 different versions of maven on Windows as well as Mac, after removing ~/.m2, so unless something's changed overnight I suspect everyone trying to use roo 1.2.2.RELEASE and 1.2.1.RELEASE will get the same pomfile and see the same problem now

      Anyway here are the references to datanucleus in the pomfile (which is 100% as is unmodified from what roo spat out):
      Code:
      ...
          <repositories>
      ...
             <repository>
                  <id>DataNucleus_Repos2</id>
                  <url>http://www.datanucleus.org/downloads/maven2</url>
                  <name>DataNucleus Repository</name>
                  <snapshots>
                      <enabled>true</enabled>
                  </snapshots>
              </repository>
      ...
          </repositories>
          <pluginRepositories>
      ...
              <pluginRepository>
                  <id>DataNucleus_2</id>
                  <url>http://www.datanucleus.org/downloads/maven2/</url>
              </pluginRepository>
          </pluginRepositories>
          <dependencies>
      ...
      
          <dependency>
                  <groupId>com.google.appengine.orm</groupId>
                  <artifactId>datanucleus-appengine</artifactId>
                  <version>2.0.0-final</version>
              </dependency>
              <dependency>
                  <groupId>org.datanucleus</groupId>
                  <artifactId>datanucleus-core</artifactId>
                  <version>3.0.10</version>
              </dependency>
              <dependency>
                  <groupId>org.datanucleus</groupId>
                  <artifactId>datanucleus-rdbms</artifactId>
                  <version>3.0.9</version>
              </dependency>
              <dependency>
                  <groupId>org.datanucleus</groupId>
                  <artifactId>datanucleus-api-jpa</artifactId>
                  <version>3.0.9</version>
              </dependency>
      ...
          </dependencies>
          <build>
              <plugins>
      ...
                  <plugin>
                      <groupId>org.datanucleus</groupId>
                      <artifactId>maven-datanucleus-plugin</artifactId>
                      <version>3.0.2</version>
                      <configuration>
                              <fork>false</fork>
                              <log4jConfiguration>${basedir}/src/main/resources/log4j.properties</log4jConfiguration>
                              <mappingIncludes>**/*.class</mappingIncludes>
                              <verbose>true</verbose>
                              <enhancerName>ASM</enhancerName>
                              <api>JPA</api>
                          <mappingExcludes>**/CustomRequestFactoryServlet.class, **/GaeAuthFilter.class</mappingExcludes>
                      </configuration>
                      <executions>
                          <execution>
                              <phase>compile</phase>
                              <goals>
                                  <goal>enhance</goal>
                              </goals>
                          </execution>
                      </executions>
                      <dependencies>
                          <dependency>
                              <groupId>org.datanucleus</groupId>
                              <artifactId>datanucleus-core</artifactId>
                              <version>3.0.10</version>
                          </dependency>
                          <dependency>
                              <groupId>org.datanucleus</groupId>
                              <artifactId>datanucleus-api-jpa</artifactId>
                              <version>3.0.9</version>
                          </dependency>
                      </dependencies>
                  </plugin>
              </plugins>
          </build>
      </project>
      I'll follow up with what I can dig through the dependency it builds

      Comment


      • #4
        No apparent conflicts there... -X shows
        [DEBUG] com.google.appengine.orm:datanucleus-appengine:jar:2.0.0-final:compile
        [DEBUG] org.datanucleus:datanucleus-enhancer:jar:3.1.0-m1:compile
        [DEBUG] org.ow2.asm:asm:jar:4.0:compile
        ...

        [INFO] --- maven-datanucleus-plugin:3.0.2:enhance (default) @ roodemo ---
        [DEBUG] org.datanucleus:datanucleus-enhancer:jar:3.0.1:runtime
        [DEBUG] javax.jdo:jdo-api:jar:3.1-SNAPSHOT-20120609:runtime
        [DEBUG] javax.transaction:transaction-api:jar:1.1:runtime
        ...
        [DEBUG] Populating class realm plugin>org.datanucleus:maven-datanucleus-plugin:3.0.2
        [DEBUG] Included: org.datanucleus:maven-datanucleus-plugin:jar:3.0.2
        [DEBUG] Included: org.datanucleus:datanucleus-core:jar:3.0.10
        [DEBUG] Included: org.datanucleus:datanucleus-api-jpa:jar:3.0.9
        [DEBUG] Included: org.datanucleus:datanucleus-enhancer:jar:3.0.1
        ...
        [DEBUG] Configuring mojo org.datanucleus:maven-datanucleus-plugin:3.0.2:enhance from plugin realm ClassRealm[plugin>org.datanucleus:maven-datanucleus-plugin:3.0.2, parent: sun.misc.Launcher$AppClassLoader@f4a24a]
        [DEBUG] (f) classpathElements = [ ... C:\Users\dave\.m2\repository\org\datanucleus\datan ucleus-enhancer\3.1.0-m1\datanucleus-enhancer-3.1.0-m1.jar ...
        [DEBUG] (f) pluginArtifacts = [org.datanucleus:maven-datanucleus-plugin:maven-plugin:3.0.2:, org.datanucleus:datanucleus-core:jar:3.0.10:runtime, org.datanucleus:datanucleus-api-jpa:jar:3.0.9:runtime, org.datanucleus:datanucleus-enhancer:jar:3.0.1:runtime,
        ...
        [DEBUG] -- end configuration --
        [DEBUG] Metadata Directory is : C:\MercurialRepos\roo5\target\classes
        [INFO] CP: C:\Users\dave\.m2\repository\org\datanucleus\datan ucleus-enhancer\3.0.1\datanucleus-enhancer-3.0.1.jar
        [INFO] CP: C:\Users\dave\.m2\repository\org\datanucleus\datan ucleus-enhancer\3.1.0-m1\datanucleus-enhancer-3.1.0-m1.jar

        I don't know how to interpret all this. What do you think:

        1 Does Roo spits out a legitimate pomfile for which datanucleus dependencies should work; in that case I should move this issue to the folks at datanucleus to fix? Or,
        2 Is the pom invalid so roo or whatever magic in maven plugins springsource it calls to build the pom need fixing? Or,
        3 User error - am I doing something obviously wrong in how I'm following the documentation and need to take the Roo 101 course?

        Comment


        • #5
          Duh, if I can't post here, I can post elsewhere so here are the gory details.

          mvn -X:

          http://pastie.org/4127817
          http://pastie.org/4127820

          Complete pomfile:

          http://pastie.org/4127833

          Comment


          • #6
            The problem is Google's JDO/JPA plugin "datanucleus-appengine" (a plugin for DataNucleus, owned by Google) is being defined as version "2.0.0-final" (specified in that POM file) but this is not in Maven in any (official) place I know of, so where you have that coming from I've no idea. See http://repo1.maven.org/maven2/com/go...eus-appengine/ for what is officially released into Maven (central). This artifact is (incorrectly) bringing in v3.1.x of datanucleus-enhancer (and ASM v4). Find where that comes from and you have the chance to fix it.

            There is an outstanding issue on Google to sort out their publishing of "datanucleus-appengine" in Maven at http://code.google.com/p/datanucleus...wner%20Summary
            Last edited by andy; Jun 22nd, 2012, 01:03 AM.

            Comment


            • #7
              Have you been able to fix this in the meanwhile, cause I'm having the same problem.
              The datanucleus enhancer is giving me a headache.
              Changing datanucleus-appengine to version 2.0.1.1 doesn't solve this either.
              Please help me out.

              Comment


              • #8
                As already said to the previous user, if you actually look at 2.0.1.1 it has datanucleus-enhancer version [3.0,3.0.99) so that is not pulling in v3.1.0.m1. So go and work out why that version is being pulled in (by doing what the previous user did, turn on -X, and read what it says and where the dependencies come from, and somewhere it will say why you are using v3.1.0.m1 of the enhancer as well as the other one). You have a project CLASSPATH, and you presumably use some Maven plugin and they are the only places pulling things in, so you're the only person who can identify the problem with your situation since you can see it
                Last edited by andy; Jul 8th, 2012, 12:16 PM.

                Comment


                • #9
                  There must still be something pulling in v3.1.0-m2. I got the following error during 'run' goal:

                  >>org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus.enhancer" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/Users/johntroch/Documents/workspace/Recipebook/gae_version/target/recipebook-0.1.0.BUILD-SNAPSHOT/WEB-INF/lib/datanucleus-enhancer-3.1.0-m1.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/Users/johntroch/Documents/workspace/Recipebook/gae_version/target/recipebook-0.1.0.BUILD-SNAPSHOT/WEB-INF/lib/datanucleus-enhancer-3.1.0-m2.jar."

                  How can I easily find what needs v3.1.0-m2 ?

                  I also have the following error:

                  >>ERROR org.springframework.web.context.ContextLoader - Context initialization failed
                  org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in file [/Users/johntroch/Documents/workspace/Recipebook/gae_version/target/recipebook-0.1.0.BUILD-SNAPSHOT/WEB-INF/classes/META-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory';

                  Any suggestions ?

                  thanks in advance,
                  John
                  Last edited by jonesbaking; Jul 8th, 2012, 02:10 PM. Reason: the error differs depending on the mvn goal

                  Comment


                  • #10
                    I already made a suggestion ... run Maven with "-X" so it tells you where dependencies come from ... just like the previous poster did. Maybe you're using some old version of the "maven-datanucleus-plugin" ? who knows since your pom.xml is not visible. Running with "-X" would reveal all

                    Comment


                    • #11
                      I went through the resulting pom by hand to compare the most current versions of all the datanucleus and maven-gae-plugin with what was available from their repos. That got me past the issue in this thread. I'm attaching the resultant pomfile.

                      The generated code does error in other ways on "perform tests" so I couldn't do an end-to-end test, but the problem isn't roo itself.

                      Cannot have a primary key of type java.lang.Long and be a child object Child.; nested exception is javax.persistence.PersistenceException: Error in meta-data for field Child.id : Cannot have a primary key of type java.lang.Long and be a child object

                      So the resulting code evidently needs massaging. Could roo be self-aware to avoid this? If I have time, I'll dig deeper open a more thorough bug report/ feature request. Meanwhile, I had to revert to non-roo to make my deadline, and I already had a steep enough learning curve having gwt issues, being new to app engine, and learning a new domain.

                      Comment


                      • #12
                        Since GAE defaults to what they call "owned relations" (entities put in the same entity group). You can change the relation to "unowned" and there is no such restriction (either set @Unowned on the relation fields or, using the very latest code v2.1.0 you can set persistence property "datanucleus.appengine.relationDefault" set to "unowned"). At the end of the day that restriction is well publicised in GAE docs, so yes the problem is indeed Roo, since it purports to provide code ready to use with GAE; raise a bug on them

                        Comment

                        Working...
                        X