2011-06-29 13 views
0

と休止状態:私はこの中で冬眠実行するとCFX 2.4を使用し、2.5動的なWebモデルバージョンで http://www.youtube.com/watch?v=o2Vjs8ylmFM私はこのMethodeのようなWebサービスを作成し、通常の動的Webプロジェクト にこの仕事私の問題を読む前に、Webサービス

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 

     org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP: 

     An error occurred at line: 1 in the generated java file 
     The type net.sf.hibernate.Session cannot be resolved. It is indirectly referenced from   required .class files 

     Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp 
      Session cannot be resolved to a type 
     13: <BODY> 
     14: <% 
     15: 
     16: Session hibernateSession = HibernateUtil.currentSession(); 
     17: Transaction tx = hibernateSession.beginTransaction(); 
     18: 
     19: Etudinat etudiant = new Etudinat(); 


     Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp 

と私のクラスHibernateUtilのは、次のとおりです:私は例外を取得するWebサービスによって生成され、現在のクライアントのWebプロジェクト 、これはそれがある

package DBase; 

import net.sf.hibernate.*; 

import net.sf.hibernate.cfg.*; 


public class HibernateUtil { 

private static final SessionFactory sessionFactory; 

static { 
try { 
// Crée la SessionFactory 
sessionFactory = 
new Configuration().configure().buildSessionFactory(); 
} catch (HibernateException ex) { 
throw new RuntimeException("Problème de configuration : " 
+ ex.getMessage(), ex); 
} 
} 

public static final ThreadLocal session = new ThreadLocal(); 

    public static Session currentSession() 
    throws HibernateException { 
    Session s = (Session) session.get(); 
// Ouvre une nouvelle Session, si ce Thread n'en a aucune 
if (s == null) { 
s = sessionFactory.openSession(); 
session.set(s); 
} 
return s; 
} 

と私のhibernate.cfg.xmlのページは次のとおりです。

<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE hibernate-configuration 
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" 
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> 

<hibernate-configuration> 
<session-factory > 

<!-- local connection properties --> 
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property> 
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> 
<property name="hibernate.connection.username">root</property> 
<property name="hibernate.connection.password">162826</property> 
<!-- property name="hibernate.connection.pool_size"></property --> 

<!-- dialect for MySQL --> 
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property> 



<!-- Echo all executed SQL to stdout --> 
<property name="show_sql">true</property> 

    <property name="current_session_context_class">thread</property> 

    <mapping resource="DBase/Favorieensei.hbm" /> 
    <mapping resource="DBase/Ajouter.hbm" /> 
    <mapping resource="DBase/Favorie.hbm" /> 
    <mapping resource="DBase/Enseignant.hbm" /> 

と、これは私のページのjspで

<%@page import="DBase.HibernateUtil"%> 
<%@ page import="java.io.*" %> 
<%@ page import="java.util.*" %> 
<%@ page import="DBase.*" %> 
<%@ page import="net.sf.hibernate.*" %> 
<%@ page import="net.sf.hibernate.cfg.*" %> 

<HTML> 
<HEAD> 
<title>Greetings!</title> 
</HEAD> 
    <BODY> 
<% 

Session hibernateSession = HibernateUtil.currentSession(); 
    Transaction tx = hibernateSession.beginTransaction(); 

    Etudinat etudiant = new Etudinat(); 
    etudiant.setUserName("davido"); 
etudiant.setPassword("mioo"); 
    etudiant.setQuestion("best music"); 
    etudiant.setAnswer("rock"); 
    etudiant.setEmail("[email protected]"); 
    etudiant.setNom("....."); 
    etudiant.setPrenom("...."); 
    etudiant.setSexe("Homme"); 

    etudiant.setIDFilliere(Filliere.INFORMATIQUE); 
    hibernateSession.save(etudiant); 
    tx.commit(); 
    HibernateUtil.closeSession(); 


    %> 


    <br> 
<br> 
<br> 
<br> 
    <table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox"> 
    <tr> 
    <td CLASS="bluebanner" align="center"> Greetings, </TD> 
    </tr> 
    </table> 
    </BODY> 
    </HTML> 

これは私のscreanですplzは私たちが私たちを助ける

screan shot about hibernate

ショット時間をかけて走っている私はそれを終えるために3つ残っている

答えて

1
An error occurred at line: 1 in the generated java file 
    The type net.sf.hibernate.Session cannot be 

resolved. It is indirectly referenced from required .class files

明らかに、クラスパスに問題があります。必要に応じてすべてをインポートしていることを確認してください(一見正しいと思います)。hibernate.jarが正しいフォルダにあり、実行中に適切にloadetを取得していることを確認してください。

+0

私たちは休止状態のjarファイルを変更し、net.sf.hibernate.SessionでHibernate2.0.3.jarをもう1つダウンロードしましたが、sessionnはこのjarファイルのクラスではなく、同じエラーが表示されますplzは私を助けます – David

+0

jarfileが現在のフォルダにあり、正しくロードされているかどうか確認しましたか? – bonifaz

+0

はいjarは現在のフォルダにあり、正しくロードされています。私はEclipseを開いてそこにsession.classを見つけましたが、同じエラーが発生しました。 – David

関連する問題