Jak podano w temacie, mój problem polega na tym, że nie można zbudować EntityManagerFactory
. Używam Maven + Hibernate. Łączę się z bazą danych MySQL DB (<jdbc://mysql://localhost:3306/<dbname>
).[PersistenceUnit: <name>]: nie można zbudować EntityManagerFactory
Dziwne jest to podczas debugowania w Eclipse, działa dobrze. Ale kiedy buduję go przy użyciu kompilacji Mavena, plik JAR rzuca taki błąd. Sprawdziłem już plik manifestu i wszystkie niezbędne pliki JAR zostały uwzględnione w ścieżce klasy. Poniżej znajduje się błąd pliku JAR wyświetlanego w konsoli:
================================= =========================================
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
== ================================================== =======================
poniżej jest mój persistence.xml:
<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>
========= ================================================== ================
Co ja tu robię źle? Albo czego mi brakuje?
Jak wspomniano, działa debugowanie. Ale kiedy pakuję go do JAR (z wszystkimi niezbędnymi JARami obecnymi w folderze libs), to nie jest.
Chyba chodzi o coś więcej niż to, w prawej konsoli? A może szczegółowy ślad stosu? – tartak
Musi być więcej logów poniżej podanego execption, proszę je opublikować –