unexpected exception: java.lang.ExceptionInInitializerError
Bonjour,
Je développe une web app en GWT avec Hibernate (à peu près le tutoriel qu'il y a dans la doc) et j'obtiens ce message d'erreur.
Code:
1 2 3 4 5 6
|
[ERROR] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract
java.lang.String com.hibernate_test.client.GreetingService.test(java.lang.String)
throws java.lang.IllegalArgumentException' threw an unexpected
exception: java.lang.ExceptionInInitializerError |
Mes fichiers:
Dans GreetingServiceAsync.java :
Code:
1 2 3 4 5
| public interface GreetingServiceAsync {
void greetServer(String input, AsyncCallback<String> callback)
throws IllegalArgumentException;
void test(String input, AsyncCallback<String> callback) throws IllegalArgumentException;
} |
Dans GreetingService.java :
Code:
1 2 3 4
| public interface GreetingService extends RemoteService {
String greetServer(String name) throws IllegalArgumentException;
String test(String input) throws IllegalArgumentException;
} |
Dans GreetingServiceImpl.java (cette fonction est appelée par le bouton de form) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public String test(String input) throws IllegalArgumentException {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Events theEvent = new Events();
theEvent.setTitle("aaaa");
session.save(theEvent);
session.getTransaction().commit();
return input;
} |
Dans hibernate.cfg.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.password"></property>
<property name="connection.url">jdbc:mysql://127.0.0.1/hibernate_db</property>
<property name="connection.username">root</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
<!-- DEPRECATED very expensive property name="c3p0.validate>-->
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<mapping resource="org/hibernate/tutorial/domain/Events.hbm.xml"/>
</session-factory>
</hibernate-configuration> |
Dans HibernateUtil.java :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| package org.hibernate.tutorial.util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static final SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure("org/hibernate/tutorial/hibernate.cfg.xml").buildSessionFactory();
}
catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
} |
Ma BD :
Code:
1 2 3 4 5 6 7 8 9 10
|
CREATE TABLE IF NOT EXISTS `events` (
`EVENT_ID` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`EVENT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
INSERT INTO `events` (`EVENT_ID`, `title`) VALUES
(1, 'poj'); |
Ma Events.hbm.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 20 avr. 2011 15:58:13 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class catalog="hibernate_db" name="Events" table="events">
<id name="eventId" type="java.lang.Integer">
<column name="EVENT_ID"/>
<generator class="identity"/>
</id>
<property generated="never" lazy="false" name="title" type="string">
<column name="title" not-null="true"/>
</property>
</class>
</hibernate-mapping> |
Est-ce que c'est impossible de faire de l'Hibernate sur Google App Engine ?? Certains disent ça (http://www.developpez.net/forums/d74...gwt-hibernate/) mais ça m'étonne bcp !
Si qq'un peut m'aider, merci mille fois !!