2

我在使用 MappingTool 时遇到问题,当我在 Java 源文件上运行它时,它不断抛出 java.lang.ClassNotFoundException。感觉这是一个类路径问题,但我不确定。请看下面:

我这样运行它:

java -cp .:openjpa-2.2.1.jar:openjpa-all-2.2.1.jar:/home/vic/tmp/test/src
org.apache.openjpa.jdbc.meta.MappingTool -p ~/tmp/test/persistence.xml
~/tmp/test/src/java/org/mag/Magazine.java

它返回这个:

Exception in thread "main" java.lang.IllegalArgumentException:
java.lang.ClassNotFoundException: org.mag.Magazine
    at serp.util.Strings.toClass(Strings.java:164)
    at serp.util.Strings.toClass(Strings.java:108)
    at
org.apache.openjpa.lib.meta.ClassArgParser.parseTypes(ClassArgParser.java:164)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1035)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1001)
    at org.apache.openjpa.jdbc.meta.MappingTool$1.run(MappingTool.java:937)
    at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:748)
    at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:738)
    at org.apache.openjpa.jdbc.meta.MappingTool.main(MappingTool.java:932)

Magazine.java 看起来像这样:

package org.mag;

@Entity
@IdClass(Magazine.MagazineId.class)
public class Magazine {


    public static class MagazineId {

    }
}

谢谢

4

0 回答 0