我一直在下面的http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/tutorial.htmlHibernate的教程不工作
休眠教程和其他各種網絡董事會已指出,這是不完整的。 當我運行此命令:
MVN高管:JAVA -Dexec.mainClass = 「org.hibernate.tutorial.EventManager」 -Dexec.args = 「存儲」
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ hibernate-tutorial >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ hibernate-tutorial <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ hibernate-tutorial ---
[WARNING]
java.lang.ClassNotFoundException: org.hibernate.tutorial.EventManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:722)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.962s
[INFO] Finished at: Sun Sep 30 17:03:34 EDT 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (d
efault-cli) on project hibernate-tutorial: An exception occured while executing
the Java class. org.hibernate.tutorial.EventManager -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
所以我認爲問題很明顯。當maven執行java時,java不知道在哪裏找到我的'EventManager'。我想在我的命令行:
設置CLASSPATH = C:\用戶\長袍\文檔\休眠\ PROJECT1的\ src \主\ java的\組織
還有什麼可能是錯在這裏?
謝謝!
感謝您的快速響應,但我仍然得到同樣的錯誤。我的EventManager.java在C:\ Users \ robe \ Documents \ hibernate \ project1 \ src \ main \ java \ org \ hibernate \ tutorial – roboto1986