Reputation: 1203
I am using Glassfish 3.1.1 and hibernate 3.6.5 with MySQL 5.1 + mysql-connector-java-5.1.6
Intermittently I get the following exception when I run or deploy my JSF2.0 and EJB3.1 based module
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.TimeUtil], because it has not yet been started, or was already stopped
Well the resource keeps varying everytime, sometimes it is org.hibernate.event.EventListeners$2
or com.mysql.jdbc.profiler.ProfilerEventHandlerFactory
or import.sql
May be it has something to do with my config,
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="XXXX" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/XXXXXX</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit>
</persistence>
The properties configured in Glassfish connection pool are,
driverClass: com.mysql.jdbc.Driver
URL: jdbc:mysql://localhost:3306/XXXX
portNumber: 3306
databaseName: XXXX
serverName: localhost
user: yyy
password: yyy
Could someone please help me out with this?
Upvotes: 3
Views: 2209
Reputation: 1203
Ah ha. Finally I found out the cause for the error. It was a problem with Nebeans, which was always selecting the wrong version of JPA in persistence.xml. So, I manually configured the persistence.xml as follows and it works fine now.
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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">
<persistence-unit name="XXXX" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/XXXXXX</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit>
</persistence>
Upvotes: 2