Java – invocationtargetexception: the plug-in (bundle) “org. Datanucleus” has been registered

I'm trying to follow dataoucleus tutorial for JDO I'm using maven, and I've followed the enhancer instructions provided here

However, I received the following error:

[datanucleus:enhance]
Could not transfer Metadata asm:asm/maven-Metadata.xml from/to local.repository (file:../../local.repository/trunk): No connector available to access repository local.repository (file:../../local.repository/trunk) of type legacy using the available factories WagonRepositoryConnectorFactory
  CP: C:\... \.m2\repository\org\datanucleus\maven-datanucleus-plugin\3.0.0-release\maven-datanucleus-plugin-3.0.0-release.jar
  CP: C:\... \.m2\repository\org\datanucleus\datanucleus-core\3.0.2\datanucleus-core-3.0.2.jar
  CP: C:\... \.m2\repository\org\datanucleus\datanucleus-enhancer\3.0.0-release\datanucleus-enhancer-3.0.0-release.jar
  CP: C:\... \.m2\repository\javax\jdo\jdo-api\3.1-SNAPSHOT-20110926\jdo-api-3.1-SNAPSHOT-20110926.jar
  CP: C:\... \.m2\repository\javax\transaction\transaction-api\1.1\transaction-api-1.1.jar
  CP: C:\... \.m2\repository\org\apache\geronimo\specs\geronimo-jpa_2.0_spec\1.0\geronimo-jpa_2.0_spec-1.0.jar
  CP: C:\... \.m2\repository\asm\asm\3.3.1\asm-3.3.1.jar
  CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-utils\1.2\plexus-utils-1.2.jar
  CP: C:\... \.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar
  CP: C:\... \trunk\plasma\target\classes
  CP: C:\... \.m2\repository\net\dwst\generics\1.2.0\generics-1.2.0.jar
  CP: C:\... \.m2\repository\org\swinglabs\swing-layout\1.0.3\swing-layout-1.0.3.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-plugin-api\2.0.8\maven-plugin-api-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-project\2.0.8\maven-project-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-settings\2.0.8\maven-settings-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-profile\2.0.8\maven-profile-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-model\2.0.8\maven-model-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-artifact-manager\2.0.8\maven-artifact-manager-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-repository-Metadata\2.0.8\maven-repository-Metadata-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\wagon\wagon-provider-api\1.0-beta-2\wagon-provider-api-1.0-beta-2.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-plugin-registry\2.0.8\maven-plugin-registry-2.0.8.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-artifact\2.0.8\maven-artifact-2.0.8.jar
  CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-9-stable-1\plexus-container-default-1.0-alpha-9-stable-1.jar
  CP: C:\... \.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar
  CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-utils\1.4.5\plexus-utils-1.4.5.jar
  CP: C:\... \.m2\repository\com\h2database\h2\1.3.158\h2-1.3.158.jar
  CP: C:\... \.m2\repository\org\jboss\netty\netty\3.2.4.Final\netty-3.2.4.Final.jar
  CP: C:\... \.m2\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar
  CP: C:\... \.m2\repository\net\flat\flat\1.2.0\flat-1.2.0.jar
  CP: C:\... \.m2\repository\com\pyx4me\proguard-maven-plugin\2.0.4\proguard-maven-plugin-2.0.4.jar
  CP: C:\... \.m2\repository\ant\ant\1.6.5\ant-1.6.5.jar
  CP: C:\... \.m2\repository\org\apache\maven\maven-archiver\2.3\maven-archiver-2.3.jar
  CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-archiver\1.0-alpha-9\plexus-archiver-1.0-alpha-9.jar
  CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-io\1.0-alpha-1\plexus-io-1.0-alpha-1.jar
  CP: C:\... \.m2\repository\com\sun\codemodel\codemodel\2.4\codemodel-2.4.jar
  CP: C:\... \.m2\repository\org\datanucleus\datanucleus-core\3.0.0-release\datanucleus-core-3.0.0-release.jar
  CP: C:\... \.m2\repository\org\datanucleus\datanucleus-api-jdo\3.0.0-release\datanucleus-api-jdo-3.0.0-release.jar
  CP: C:\... \.m2\repository\org\datanucleus\datanucleus-rdbms\3.0.0-release\datanucleus-rdbms-3.0.0-release.jar
  CP: C:\... \.m2\repository\javax\jdo\jdo-api\3.0\jdo-api-3.0.jar
07-oct.-2011 18:01:05 org.datanucleus.enhancer.datanucleusEnhancer <init>
INFO: datanucleus Enhancer : Using ClassEnhancer "ASM" for API "JDO"
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 8.475s
Finished at: Fri Oct 07 18:01:05 CEST 2011
Final Memory: 12M/29M
------------------------------------------------------------------------
Failed to execute goal org.datanucleus:maven-datanucleus-plugin:3.0.0-release:enhance (default) on project plasma:
Error executing enhancer: InvocationTargetException: Plugin (Bundle) "org.datanucleus" is already registered.
Ensure you dont have multiple JAR versions of the same plugin in the classpath.
The URL "file:/C:/... /.m2/repository/org/datanucleus/datanucleus-core/3.0.2/datanucleus-core-3.0.2.jar" is already registered,and you are trying to register an identical plugin located at URL "file:/C:/... /.m2/repository/org/datanucleus/datanucleus-core/3.0.0-release/datanucleus-core-3.0.0-release.jar." -> [Help 1]

Who knows how to solve this problem? What makes this tutorial applicable to 3.0 Correct POM for version 0 XML configuration?

edit

This is my POM xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>net.dwst</groupId>
    <artifactId>datanucleus</artifactId>
    <version>1.0.0</version>

    <name>datanucleus 1.0.0</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.source>1.6</project.build.source>
        <project.build.target>1.6</project.build.target>
    </properties>

    <build>

        <finalName>datanucleus</finalName>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>        

        <plugins>

            <!-- Source code target JDK version & encoding -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${project.build.source}</source>
                    <target>${project.build.target}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.datanucleus</groupId>
                <artifactId>maven-datanucleus-plugin</artifactId>
                <version>3.0.0-release</version>
                <configuration>
                    <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
                    <verbose>true</verbose>
                    <fork>false</fork>
                    <!-- props>${basedir}/datanucleus.properties</props -->
                </configuration>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

    <dependencies>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-core</artifactId>
            <version>3.0.0-release</version>
        </dependency>

        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-api-jdo</artifactId>
            <version>3.0.0-release</version>
        </dependency>

        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-rdbms</artifactId>
            <version>3.0.0-release</version>
        </dependency>

        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>maven-datanucleus-plugin</artifactId>
            <version>3.0.0-release</version>
        </dependency>

        <dependency>
            <groupId>javax.jdo</groupId>
            <artifactId>jdo-api</artifactId>
            <version>3.0</version>
        </dependency>        

    </dependencies>

</project>

Solution

After reading this, I found the solution:

<dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>3.0.0-release</version>
        <scope>runtime</scope>
    </dependency>

The core dependency scope should be runtime

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>