jay*_*yde 6 java hibernate jpa
如上所述,我的问题是EntityManagerFactory无法建立.我正在使用Maven + Hibernate.我正在连接MySQL DB(<jdbc://mysql://localhost:3306/<dbname>).
这里奇怪的是在Eclipse中调试期间,它工作正常.但是当我使用Maven构建它时,JAR文件会抛出这样的错误.我已经检查了Manifest文件,并且所有必需的JAR都包含在Class-Path中.以下是控制台中显示的JAR错误:
================================================== =========================
Feb 3, 2012 5:01:16 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Feb 3, 2012 5:01:16 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.1.Final}
Feb 3, 2012 5:01:16 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Feb 3, 2012 5:01:16 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Feb 3, 2012 5:01:16 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Feb 3, 2012 5:01:16 PM class <name>.<name>.<name> <name>
SEVERE: [ERROR]: [PersistenceUnit: <name>] Unable to build EntityManagerFactory
[ERROR]: [PersistenceUnit: <name>] Unable to build EntityManagerFactory
Run Code Online (Sandbox Code Playgroud)
================================================== =========================
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="<name>">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>classname</class>
<properties>
<!-- <property name="hibernate.ejb.cfgfile" value="/classifyPE.cfg.xml"/> -->
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.password" value="<value>" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/<name>" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)
================================================== =========================
我在这做错了什么?或者我缺少什么?
如上所述,它正在使用Debug.但是当我将它打包到JAR中时(在libs文件夹中存在所有必需的JAR),它不是.
| 归档时间: |
|
| 查看次数: |
29565 次 |
| 最近记录: |