aspose file tools*
The moose likes JBoss/WildFly and the fly likes org.hibernate.HibernateException: Specified JDBC Driver not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "org.hibernate.HibernateException: Specified JDBC Driver not found" Watch "org.hibernate.HibernateException: Specified JDBC Driver not found" New topic
Author

org.hibernate.HibernateException: Specified JDBC Driver not found

Juan Carmona
Greenhorn

Joined: Apr 08, 2012
Posts: 3
hi anyone, I have this problem using Hibernate 4 within a small EJB proyect
I have a META-INF/persistence.xml like this:

<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_2_0.xsd"
version="2.0">
<persistence-unit name="manager1" transaction-type="JTA">
<class>....</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.password" value="xxxx"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/xxxx"/>
<property name="hibernate.connection.username" value="xxxx"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
</properties>
</persistence-unit>
</persistence>

(I use the persistence.xml instead of the hibernate.cfg.xml when JBoss told it doesn't found the persistence.xml... so I put my config there)

I'm deploying the ejb jar within a JBoss 7.1.0 AS in Eclipse Indigo... my Library Classpath of the proyect has the JBoss7 and JRE System (1.6) libraries and a some jars I added in a folder /ejbModule/lib within the proyect. One of those jars is the mysql-connector-java-5.1.18-bin.jar and this is marked to be exported... but when I looked at the folder in JBoss (../standalone/deployments/Test.jar folder), I don't see the libs folder and I'm getting the error:

17:55:16,375 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."Test.jar#manager1": org.jboss.msc.service.StartException in service jboss.persistenceunit."AdminPape.jar#manager1": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: manager1] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
Caused by: org.hibernate.HibernateException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:104)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:234)

please help me, regards
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

I believe class loading has radically changed in JBoss 7.

You may wish to refer to this:

https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7?_sscc=t
Avinash Ga
Ranch Hand

Joined: Aug 13, 2011
Posts: 78

I think your hibernate.properties file is overriding the configuration here. try renaming the hibernate.properties and try.


Avinash G.A
OCP Java SE 6 Programmer, OCP Java EE 5 Web Component Developer, OCE Java EE 6 Web Services Developer, VMware Certified Core Spring 3.x Developer, EMC Proven Professional (ISM-V2)
Avinash Ga
Ranch Hand

Joined: Aug 13, 2011
Posts: 78

I think your hibernate.properties file is overriding the configuration here. try renaming the hibernate.properties and try.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.hibernate.HibernateException: Specified JDBC Driver not found