IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

unexpected exception: java.lang.ExceptionInInitializerError


Sujet :

GWT et Vaadin Java

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    26
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 26
    Par défaut 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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 !!

  2. #2
    Membre éclairé
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2011
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2011
    Messages : 51
    Par défaut
    Bonsoir,

    La liste des frameworks et autres compatibles ou pas GAE :
    http://code.google.com/p/googleappen...llItPlayInJava

    Maxime

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Exception : java.lang.NullPointerException
    Par parano dans le forum Langage
    Réponses: 4
    Dernier message: 05/07/2007, 20h27
  2. Erreur exception java.lang.NullPointerException
    Par geol99 dans le forum Langage
    Réponses: 2
    Dernier message: 14/06/2007, 20h24
  3. unreported exception: java.lang.ClassNotFoundException
    Par obydissonn dans le forum JDBC
    Réponses: 1
    Dernier message: 22/03/2007, 16h54
  4. [System.load] Exception java.lang.UnsatisfiedLinkError avec unknown file type
    Par jemini_fr dans le forum API standards et tierces
    Réponses: 6
    Dernier message: 05/02/2007, 13h52
  5. Resoudre exception java.lang,OutOfMemory
    Par Battosaiii dans le forum Langage
    Réponses: 9
    Dernier message: 02/08/2006, 17h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo