问题是,在 Eclipse-IDE 中,使用 Ebean 相关方法的每个测试都可以正常工作,但是当您编译 jar 文件以使用它时,例如在主页或命令提示符下,我只能得到这个
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.util.ClassPathSearch find
Classes
Warnung: No Entities found in ClassPath using ClassPathReader [com.avaje.ebeanin
ternal.server.util.DefaultClassPathReader@6c08bae7] Classpath Searched[[file:/C:
/xampp/htdocs/webp3/jars/DPG.jar]]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.core.BootupClassPathSearc
h search
Information: Classpath search hits in jars[] pkgs[] searchTime[27]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.lib.sql.DataSourcePool in
itialise
Information: DataSourcePool [mysql] autoCommit[false] transIsolation[READ_COMMIT
TED] min[1] max[25]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.core.DefaultServerFactory
setDatabasePlatform
Information: DatabasePlatform name:mysql platform:mysql
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.subclass.SubClassManager$
1 run
Information: SubClassFactory parent ClassLoader [sun.misc.Launcher$AppClassLoade
r]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.deploy.BeanDescriptorMana
ger logStatus
Information: Entities enhanced[0] subclassed[0]
Exception in thread "main" javax.persistence.PersistenceException: com.dpu.entit
ies.Department is NOT an Entity Bean registered with this server?
at com.avaje.ebeaninternal.server.core.DefaultServer.createQuery(Default
Server.java:1008)
at com.avaje.ebeaninternal.server.core.DefaultServer.createQuery(Default
Server.java:965)
at com.avaje.ebeaninternal.server.core.DefaultServer.find(DefaultServer.
java:1001)
at com.avaje.ebean.Ebean.find(Ebean.java:1143)
at com.dpu.data.Datagenerator.generateData(Datagenerator.java:26)
at com.dpu.main.MainGenerator.main(MainGenerator.java:23)
我在谷歌上尝试了许多“解决方案”,比如编辑类路径,但日志上的一切似乎都很好。
My JAR-Manifest contains this:
Manifest-Version: 1.0
Main-Class: com.dpu.main.MainGenerator
Class-Path: .
有人知道如何解决这个愚蠢的问题吗?我今天尝试了所有方法,这很烦人