DataNucleus TypeConverter插件没有正确注册" CLASSPATH中没有#c4类型的Java类型"

时间:2017-03-14 14:03:12

标签: maven datanucleus

我正在创建一个DataNucleus TypeConverter插件作为JAR,然后在我的主项目中使用此插件。但是,我收到错误java type not present in CLASSPATH,即使从我所知道的,类路径是正确的。

详情如下。

对于我的插件,我有以下plugin.xml

<?xml version="1.0"?>
<plugin id="com.advantagegroup.blue.jdo.datanucleus" name="blue.jdo.datanucleus" provider-name="advantagegroup">
    <extension point="org.datanucleus.type_converter">
        <type-converter name="org.json.simple.JSONObject -- java.lang.String"
                member-type="org.json.simple.JSONObject"
                datastore-type="java.lang.String"
                converter-class="com.advantagegroup.blue.jdo.datanucleus.JSONObjectConverter"
        />
    </extension>
</plugin>

我构建了我的插件并将其添加到我的主项目中。

在主项目中,我使用maven&#39; datanucleus-maven-plugin运行增强器。 POM文件的相关部分如下:

<dependencies>
    <!-- START JSON simple -->
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
        <type>jar</type>
    </dependency>
    <!-- END JSON simple -->

    <!-- START JDO -->
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>javax.jdo</artifactId>
        <version>3.2.0-m6</version>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>5.0.6</version>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-api-jdo</artifactId>
        <version>5.0.6</version>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-rdbms</artifactId>
        <version>5.0.6</version>
        <scope>runtime</scope>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-jdo-query</artifactId>
        <version>5.0.1</version>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- END JDO -->

    // ...

    <!-- START internal dependencies -->
    <dependency>
        <groupId>com.advantagegroup</groupId>
        <artifactId>blue-jdo-datanucleus</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <!-- END internal dependencies -->
</dependencies>

<build>
    <plugins>
        // ...

        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-maven-plugin</artifactId>
            <version>5.0.2</version>
            <configuration>
                <api>JDO</api>
                <props>${basedir}/datanucleus.properties</props>
                <log4jConfiguration>${basedir}/jdoEnhancerLog4j.properties</log4jConfiguration>
                <verbose>true</verbose>
            </configuration>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

我从增强器获得以下DEBUG消息:

2017-03-13 23:07:41 DEBUG Persistence:63 - TypeConverter for org.json.simple.JSONObject<->java.lang.String ignored since java type not present in CLASSPATH

事情从那里开始很糟糕。

我可以看到我的插件(blue-jdo-datanucleus-1.0-SNAPSHOT.jar)和JSON Simple(json-simple-1.1.1.jar都在CLASSPATH 中。请参阅下面的日志片段(为清晰起见而编辑):

[DEBUG] cmd.exe /X /C "C:\jdk1.8.0_112\jre\bin\java 
-cp 
    C:\Users\dcherkassky\.m2\repository\org\datanucleus\datanucleus-maven-plugin\5.0.2\datanucleus-maven-plugin-5.0.2.jar;
    C:\Users\dcherkassky\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;
    C:\Users\dcherkassky\.m2\repository\com\advantagegroup\blue-jdo-datanucleus\1.0-SNAPSHOT\blue-jdo-datanucleus-1.0-SNAPSHOT.jar;
    C:\code\bluesky\ui\target\classes;
    ... 
-Dlog4j.configuration=file:C:/code/bluesky/ui/jdoEnhancerLog4j.properties 
org.datanucleus.enhancer.DataNucleusEnhancer 
-v 
-api JDO 
-flf C:\Users\DCHERK~1\AppData\Local\Temp\enhancer-680011732335723141.flf"

为什么增强器无法找到org.json.simple.JSONObject

的任何想法

(我试图提供所有相关信息 - 如有必要,我可以添加更多细节)

谢谢, DC

0 个答案:

没有答案