Eclipse struts 2 hibernate Mysql

Fermé
rb.ridene Messages postés 1 Date d'inscription dimanche 25 avril 2010 Statut Membre Dernière intervention 25 avril 2010 - 25 avril 2010 à 11:39
 Bounty - 26 août 2010 à 14:56
Bonjour,

je développe une application JEE en éclipse, j'ai un problème avec hibernate, quand j'essaie d'ajouter un nouveau contact a ma base de données, voici l'erreur qu'il m'affiche :


Etat HTTP 500 - 

--------------------------------------------------------------------------------

type Rapport d'exception

message 

description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.

exception 

javax.servlet.ServletException: L'exécution du filtre (Filter) a lancé une exception


cause mère 

java.lang.NoClassDefFoundError: Could not initialize class inv.controller.ContactManager
	inv.view.ContactAction.<init>(ContactAction.java:20)
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	java.lang.reflect.Constructor.newInstance(Unknown Source)
	java.lang.Class.newInstance0(Unknown Source)
	java.lang.Class.newInstance(Unknown Source)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:119)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288)
	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)
	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)
	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
	org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)



voici ma classe de configuration de la session de connexion a ma base HibernateUtil.java :

package inv.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;


public class HibernateUtil {

	private static final SessionFactory sessionFactory = buildSessionFactory();

	private static SessionFactory buildSessionFactory() {
		try {
			// Create the SessionFactory from hibernate.cfg.xml
			return new AnnotationConfiguration().configure().buildSessionFactory();
			
		} catch (Throwable ex) {
			System.err.println("Initial SessionFactory creation echoué." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}


Mon fichier hibernate.cfg.xml :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
		"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
		"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">root</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/inventaire</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
		<property name="connection.pool_size">1</property>
		<property name="current_session_context_class">thread</property>
		<property name="cache.provider_class">
			org.hibernate.cache.NoCacheProvider
		</property>
		<property name="show_sql">true</property>
		<property name="hbm2ddl.auto">update</property>
		<mapping class="inv.model.Contact" />

    </session-factory>
</hibernate-configuration>


Merci de vouloir m'aider :)
A voir également:

1 réponse

il nous faudrait ton fichier struts.xml pour voir le probleme. Apparemment il n'arrive pas à trouver la class définit dans l'action.
0