本文介绍了嵌套异常是java.lang.NoClassDefFoundError:无法初始化类com.my.util.HibernateUtil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用spring处理应用程序,遇到以下错误,我不知道如何处理它。 Etat HTTP 500 - 处理程序处理失败;嵌套的异常是java.lang.NoClassDefFoundError:无法初始化类com.my.util.HibernateUtil
类型Rapport d''异常
消息处理程序处理失败;嵌套的异常是java.lang.NoClassDefFoundError:无法初始化类com.my.util.HibernateUtil
描述请注意不要错过重复的内容。
异常
org.springframework.web.util.NestedServletException:处理程序处理失败;嵌套异常是java.lang.NoClassDefFoundError:无法初始化类com.my.util.HibernateUtil
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
org.springframework。 web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet。的doPost(FrameworkServlet.java:563)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
导致mère
java.lang.NoClassDefFoundError:无法初始化类com.my. util.HibernateUtil
com.my.dao.EmployeImplDB.getAllEmploye(EmployeImplDB.java:114)
com.my.service.EmployeImplMetier.getAll(EmployeImplMetier.java:55)
com.my .controller。 ImportController.Read(ImportController.java:235)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl。 invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
org.springframework.web.servlet.Dispatch erServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet。 Java的:563)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
组织。 apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
注意La Tracecomplètede la causemèrede cette erreur est disponible dans les fichiers journaux de Apache Tomcat / 8.0.23。
Apache Tomcat / 8.0.23
这是我的com.my. util.HibernateUtil类
package com.my.util;
/ **
*
* @author ILIAS
* /
import org.hibernate。*;
import org.hibernate.cfg。*;
public class HibernateUtil {
public static final SessionFactory sessionFactory;
private static HibernateUtil singleton = null;
private HibernateUtil(){}
$ b $ static {
try {
sessionFactory = new Configuration()。configure(Hibernate.cfg.xml ).buildSessionFactory();
} catch(Throwable ex){
System.err.println(Initial SessionFactory creation failed。*********************** ****+ ex);
抛出新的ExceptionInInitializerError(ex);
public static HibernateUtil getInstance(){
if(singleton == null){
singleton = new HibernateUtil();
}
返回单身人士;
$ b $ public static SessionFactory getSessionFactory(){
return sessionFactory;}}
这是tomcat服务器日志
初始化SessionFactory创建失败。******* ********************************* org.hibernate.PropertyNotFoundException:无法在com类中找到Employe的getter。 my.dao.Departement
AOUT 06,2015年上午9时18分十八秒org.apache.catalina.core.StandardWrapperValve调用
GRAVE:Servlet.service()为servlet的[动作]在上下文中与路径[ / Gestion_et_Generation_Docs_des_Salaries]抛出异常[Handler processing failed;嵌套的例外是java.lang.ExceptionInInitializerError]与根源
org.hibernate.PropertyNotFoundException:找不到雇工类com.my.dao.Departement
在org.hibernate.property.BasicPropertyAccessor一个getter .createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:272 )
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:247)
at org.hibernate.tuple.entity.AbstractEntityTuplizer。< init>(AbstractEntityTuplizer.java:125) < init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping。< init>(EntityEntityModeToTuplizerMapping.java: 56)org.hibernate.tuple.entity.EntityMetamodel
。< init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister。< init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister。< init>(SingleTableEntityPersister.java:109 )
。在org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
。在org.hibernate.impl.SessionFactoryImpl<初始化>(SessionFactoryImpl.java:226)
在org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)LT
。在com.my.util.HibernateUtil&; clinit>(HibernateUtil.java:19)
。在com.my. dao.EmployeImplDB.getAllEmploye(EmployeImplDB.java:114)
at com.my.service.EmployeImplMetier.getAll(EmployeImplMetier.java:55)
at com.my.controller.ImportController.Read(ImportController。 Java的:235)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
在sun.reflect.NativeMethodAccessorImpl.invoke(来源不明)
在sun.reflect.Delegatin gMethodAccessorImpl.invoke(未知源)
在java.lang.reflect.Method.invoke(未知源)
在org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java: 710)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod( AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch( DispatcherServlet.java:771)
在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
在org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java: 647)在org.springframework.web.servlet.F上
rameworkServlet.doPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java: 729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
在org.apache .catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector .CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process (AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1521)
at org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1478)
在java.util.concurrent.ThreadPoolExecutor.runWorker(来源不明)
在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(U n知道源)
在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)$ b $在java.lang.Thread.run(未知源)
- 清理连接池:jdbc:mysql:// localhost:3306 / GestionDocs
这是我的com.my.dao.Departement类
package com.my.dao;
import java.util.Set;
$ b $ **
* @author Ilias
* @version 1.0
* /
公开课部门{
私人int id;
private String nomDepartement;
私人套餐< Employe>雇员;
/ **
* @return the employe
* /
public Set< Employe> getEmploye(){
return Employe;
}
/ **
* @param雇员设置
* /
public void setEmploye(Set< Employe> Employe){
this.Employe = Employe;
$ b $ **
* @return the id
* /
public int getId(){
return id;
$ b $ **
* @param id要设置的id
* /
public void setId(int id){
this.id = id;
}
/ **
* @return nomDepartement
* /
public String getNomDepartement(){
return nomDepartement;
$ b $ **
* @param nomDepartement the nomDepartement to set
* /
public void setNomDepartement(String nomDepartement){
this.nomDepartement = nomDepartement;
}
public Departement(String nomDepartement){
super();
this.nomDepartement = nomDepartement;
$ b公共部门(){
}
/ **
*
* @exception可抛出的
* /
public void finalize()
throws Throwable {
}
}
这是我的com.my.dao.Employe类
package com。 my.dao;
import java.util.Date;
$ b $ / **
* @author Ilias
* @version 1.0
* /
公共类雇员{
private int id;
私人字符串nomEmploye;
私人字符串prenomEmploye;
private int matriculeMY;
私人字符串地址;
私人字符串性别;
private String cin;
私人日期dateNaissance;
私人字符串情况准确性;
private int nombreEnfant;
私人日期dateEntree;
私人日期dateSortie;
私人字符串numCIMR;
私人字符串numCNSS;
私人字符串numMUT;
私人字符串配置文件;
private String resteConge;
私人字符串银行;
私人字符串numCpteBanc;
private String fonction;
私人浮动沙发;
私人浮动indTransport;
私人浮动indRepresent;
私人浮动indPanier;
私人部门eDepartement;
private Fonction eFonction;
私人服务电子服务;
private TypePaiement eTypePaiement;
private ModePaiement eModePaiement;
/ **
* @return the id
* /
public int getId(){
return id;
* @param id要设置的id
* /
public void setId(int id){
this.id = ID;
}
/ **
* @return nomEmploye
* /
public String getNomEmploye(){
return nomEmploye;
}
/ **
* @param nom雇员nomEmploye设置
* /
public void setNomEmploye(String nomEmploye){
this.nomEmploye = nomEmploye;
* @返回prenomEmploye
* /
public String getPrenomEmploye(){
return prenomEmploye;
}
/ **
* @param prenomEmploye prenomEmploye设置
* /
public void setPrenomEmploye(String prenomEmploye){
this.prenomEmploye = prenomEmploye;
}
/ **
* @返回matriculeMY
* /
public int getMatriculeMY(){
return matriculeMY;
* @param matriculeMY matriculeMY设置
* /
public void setMatriculeMY(int matriculeMY){
this.matriculeMY = matriculeMY;
}
/ **
* @返回地址
* /
public String getAdresse(){
return adresse;
}
/ **
* @param adresse adresse to set
* /
public void setAdresse(String adresse){
this.adresse =住址;
}
/ **
* @返回性别
* /
public String getSexe(){
return sexe;
* @param sexe设置
* /
public void setSexe(String sexe){
this.sexe = sexe;
}
/ **
* @返回cin
* /
public String getCin(){
return cin;
* @param cin cin设置
* /
public void setCin(String cin){
this.cin = CIN;
}
/ **
* @return the dateNaissance
* /
public Date getDateNaissance(){
return dateNaissance;
}
/ **
* @param dateNaissance dateNaissance设置
* /
public void setDateNaissance(Date dateNaissance){
this.dateNaissance = dateNaissance;
}
/ **
* @return the situationFamiliale
* /
public String getSituationFamiliale(){
return situationFamiliale;
}
/ **
* @param情况所有情况所需金额设置
* /
public void setSituationFamiliale(String situationFamiliale){
this.situationFamiliale = situationFamiliale;
}
/ **
* @return the nombreEnfant
* /
public int getNombreEnfant(){
return nombreEnfant;
}
/ **
* @param nombreEnfant nombreEnfant设置
* /
public void setNombreEnfant(int nombreEnfant){
this.nombreEnfant = nombreEnfant;
}
/ **
* @return dateEntree
* /
public Date getDateEntree(){
return dateEntree;
}
/ **
* @param dateEntree dateEntree设置
* /
public void setDateEntree(Date dateEntree){
this.dateEntree = dateEntree;
}
/ **
* @return the dateSortie
* /
public Date getDateSortie(){
return dateSortie;
}
/ **
* @param dateSortie dateSortie to set
* /
public void setDateSortie(Date dateSortie){
this.dateSortie = dateSortie;
* @返回numCIMR
* /
public String getNumCIMR(){
return numCIMR;
$ ** b $ b * @param numCIMR numCIMR设置
* /
public void setNumCIMR(String numCIMR){
this.numCIMR = numCIMR;
$ b $ **
* @return the numCNSS
* /
public String getNumCNSS(){
return numCNSS;
}
/ **
* @param numCNSS numCNSS设置
* /
public void setNumCNSS(String numCNSS){
this.numCNSS = numCNSS;
* @返回numMUT
* /
public String getNumMUT(){
return numMUT;
}
/ **
* @param numMUT numMUT设置
* /
public void setNumMUT(String numMUT){
this.numMUT = numMUT;
}
/ **
* @返回配置文件
* /
public String getProfile(){
return profile;
* @param profile用于设置的概要文件
* /
public void setProfile(String profile){
this.profile =简介;
* @return the resteConge
* /
public String getResteConge(){
return resteConge;
}
/ **
* @param resteConge resteConge设置
* /
public void setResteConge(String resteConge){
this.resteConge = resteConge;
}
/ **
* @返回银行
* /
public String getBanque(){
return banque;
}
/ **
* @param banque the banque to set
* /
public void setBanque(String banque){
this.banque = BANQUE;
* @return the numCpteBanc
* /
public String getNumCpteBanc(){
return numCpteBanc;
* @param numCpteBanc numCpteBanc设置
* /
public void setNumCpteBanc(String numCpteBanc){
this.numCpteBanc = numCpteBanc;
}
/ **
* @返回函数
* /
public String getFonction(){
return fonction;
* @param fonction设置
* /
的功能public void setFonction(String fonction){
this.fonction = fonction;
}
/ **
* @return the salaire
* /
public float getSalaire(){
return salaire;
* @param salaire the salaire to set
* /
public void setSalaire(float salaire){
this.salaire = salaire;
}
/ **
* @return indTransport
* /
public float getIndTransport(){
return indTransport;
}
/ **
* @param indTransport indTransport设置
* /
public void setIndTransport(float indTransport){
this.indTransport = indTransport;
}
/ **
* @return the indRepresent
* /
public float getIndRepresent(){
return indRepresent;
}
/ **
* @参数ind表示indr表示设置
* /
public void setIndRepresent(float indRepresent){
this.indRepresent = indRepresent;
}
/ **
* @return indPanier
* /
public float getIndPanier(){
return indPanier;
$ ** b $ b * @param indPanier indPanier设置
* /
public void setIndPanier(float indPanier){
this.indPanier = indPanier;
* @return eDepartement
* /
public Departement geteDepartement(){
return eDepartement;
}
/ **
* @param eDepartement eDepartement to set
* /
public void seteDepartement(Departement eDepartement){
this.eDepartement = eDepartement;
* @返回eFonction
* /
public Fonction geteFonction(){
return eFonction;
}
/ **
* @param eFonction eFonction设置
* /
public void seteFonction(Fonction eFonction){
this.eFonction = eFonction;
* @return the eService
* /
public Service geteService(){
return eService;
}
/ **
* @param eService eService设置
* /
public void seteService(Service eService){
this.eService =电子服务;
}
/ **
* @return eTypePaiement
* /
public TypePaiement geteTypePaiement(){
return eTypePaiement;
}
/ **
* @param eTypePaiement设置
* /
的eTypePaiement public void seteTypePaiement(TypePaiement eTypePaiement){
this.eTypePaiement = eTypePaiement;
* @return the eModePaiement
* /
public ModePaiement geteModePaiement(){
return eModePaiement;
}
/ **
* @param eModePaiement eModePaiement设置
* /
public void seteModePaiement(ModePaiement eModePaiement){
this.eModePaiement = eModePaiement;
$ b public Employe(String nomEmploye,String prenomEmploye,int matriculeMY,String adresse,String sexe,String cin,
Date dateNaissance,String situationFamiliale,int nombreEnfant,Date dateEntree, Date dateSortie,
String numCIMR,String numCNSS,String numMUT,String profile,String resteConge,String banque,
String numCpteBanc, b部门eDepartement,Fonction eFonction,Service eService,TypePaiement eTypePaiement,
ModePaiement eModePaiement){
super();
this.nomEmploye = nomEmploye;
this.prenomEmploye = prenomEmploye;
this.matriculeMY = matriculeMY;
this.adresse = adresse;
this.sexe = sexe;
this.cin = cin;
this.dateNaissance = dateNaissance;
this.situationFamiliale = situationFamiliale;
this.nombreEnfant = nombreEnfant;
this.dateEntree = dateEntree;
this.dateSortie = dateSortie;
this.numCIMR = numCIMR;
this.numCNSS = numCNSS;
this.numMUT = numMUT;
this.profile = profile;
this.resteConge = resteConge;
this.banque = banque;
this.numCpteBanc = numCpteBanc;
this.fonction = fonction;
this.salaire = salaire;
this.indTransport = indTransport;
this.indRepresent = indRepresent;
this.indPanier = indPanier;
this.eDepartement = eDepartement;
this.eFonction = eFonction;
this.eService = eService;
this.eTypePaiement = eTypePaiement;
this.eModePaiement = eModePaiement;
}
public Employe(Employe e){
this.setNomEmploye(e.nomEmploye);
this.setPrenomEmploye(e.prenomEmploye);
this.setCin(e.cin);
this.setDateNaissance(e.dateNaissance);
this.setSituationFamiliale(e.situationFamiliale);
this.setNombreEnfant(e.nombreEnfant);
this.setDateEntree(e.dateEntree);
this.setDateSortie(e.dateSortie);
this.setNumCIMR(e.numCIMR);
this.setNumCNSS(e.numCNSS);
this.setNumMUT(e.numMUT);
this.setProfile(e.profile);
this.setResteConge(e.resteConge);
this.setBanque(e.banque);
this.setNumCpteBanc(e.numCpteBanc);
this.setSalaire(e.salaire);
this.setIndTransport(e.indTransport);
this.setIndRepresent(e.indRepresent);
this.setIndPanier(e.indPanier);
//this.setFonction(e.fonction);
this.seteDepartement(e.eDepartement);
this.seteFonction(e.eFonction);
this.seteService(e.eService);
this.seteModePaiement(e.eModePaiement);
this.seteTypePaiement(e.eTypePaiement);
}
public Employe(){
super();
}
/ **
* {@exception}可抛
* /
public void finalize()throws Throwable {
}}
这是Departement.hbm.xml
<?xml version =1.0?>
<!DOCTYPE hibernate-mapping PUBLIC - // Hibernate / Hibernate映射DTD 3.0 // EN
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\"> ;
<! - 由Hibernate Tools 3.4.0.CR1生成的5 ao?t 2015 11:05:44 - >
< hibernate-mapping>
< class name =com.my.dao.Departementtable =DEPARTEMENT>
< id name =idtype =int>
< column name =ID/>
< generator class =native/>
< / id>
< property name =nomDepartementtype =java.lang.String>
< column name =NOMDEPARTEMENT/>
< / property>
< set name =Employeinverse =true>
< key column =IDnot-null =true/>
< / set>
< / class>
< / hibernate-mapping>
这是Employe.hbm.xml
<?xml version =1.0?>
<!DOCTYPE hibernate-mapping PUBLIC - // Hibernate / Hibernate映射DTD 3.0 // EN
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\"> ;
<! - 由Hibernate Tools 3.4.0.CR1生成的5 ao?t 2015 11:05:44 - >
< hibernate-mapping>
< class name =com.my.dao.Employetable =EMPLOYE>
< id name =idtype =int>
< column name =ID/>
< generator class =native/>
< / id>
< property name =nomEmployetype =java.lang.String>
< column name =NOMEMPLOYE/>
< / property>
< property name =prenomEmployetype =java.lang.String>
< column name =PRENOMEMPLOYE/>
< / property>
< property name =matriculeMYtype =int>
< column name =MATRICULEMY/>
< / property>
< property name =adressetype =java.lang.String>
< column name =ADRESSE/>
< / property>
< property name =sexetype =java.lang.String>
< column name =SEXE/>
< / property>
< property name =cintype =java.lang.String>
< column name =CIN/>
< / property>
< property name =dateNaissancetype =java.lang.String>
< column name =DATENAISSANCE/>
< / property>
< property name =situationFamilialetype =java.lang.String>
< column name =SITUATIONFAMILIALE/>
< / property>
< property name =dateEntreetype =java.lang.String>
< column name =DATEENTREE/>
< / property>
< property name =dateSortietype =java.lang.String>
< column name =DATESORTIE/>
< / property>
< property name =numCIMRtype =java.lang.String>
< column name =NUMCIMR/>
< / property>
< property name =numCNSStype =java.lang.String>
< column name =NUMCNSS/>
< / property>
< property name =numMUTtype =java.lang.String>
< column name =NUMMUT/>
< / property>
< property name =profiletype =java.lang.String>
< column name =PROFILE/>
< / property>
< property name =resteCongetype =java.lang.String>
< column name =RESTECONGE/>
< / property>
< property name =banquetype =java.lang.String>
< column name =BANQUE/>
< / property>
< property name =numCpteBanctype =java.lang.String>
< column name =NUMCPTEBANC/>
< / property>
<! - < property name =fonctiontype =java.lang.String>
< column name =FONCTION/>
< / property> - >
< property name =salairetype =float>
< column name =SALAIRE/>
< / property>
< property name =indTransporttype =float>
< column name =INDTRANSPORT/>
< / property>
< property name =indRepresenttype =float>
< column name =INDREPRESENT/>
< / property>
< property name =indPaniertype =float>
< column name =INDPANIER/>
< / property>
< column name =EDEPARTEMENT/>
< /多对一>
< column name =EFONCTION/>
< /多对一>
< column name =ESERVICE/>
< /多对一>
< column name =ETYPEPAIEMENT/>
< /多对一>
< column name =EMODEPAIEMENT/>
< /多对一>
< / class>
< / hibernate-mapping>
我是初学者,这是我在春季的第一个项目
我想我在hibernate-mapping上有问题,
但是我找不到问题在哪里,你能帮助PLZ吗?
解决方案在你的日志中,我们可以看到
lockquote
org.hibernate.PropertyNotFoundException:在类com中找不到雇员的getter .my.dao.Departement
我认为Hibernate无法初始化您的映射。
在Departement.hbm.xml中,您将
< set name =Employeinverse =true >
< key column =IDnot-null =true/>
< / set>
但是在Department.java中没有attribut Employe。所以你必须添加一个像这样的:
private Set< Employe>雇员;
并为它添加getter / setter
顺便说一下,你应该像雇佣者那样重新命名attribut Employe(从小写开始)。
I'm working on an application with spring, i'm encountering the following error and i don't know how to deal with it .
Etat HTTP 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.my.util.HibernateUtil
type Rapport d''exception
message Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.my.util.HibernateUtil
description Le serveur a rencontré une erreur interne qui l''a empêché de satisfaire la requête.
exception
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.my.util.HibernateUtil
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
cause mère
java.lang.NoClassDefFoundError: Could not initialize class com.my.util.HibernateUtil
com.my.dao.EmployeImplDB.getAllEmploye(EmployeImplDB.java:114)
com.my.service.EmployeImplMetier.getAll(EmployeImplMetier.java:55)
com.my.controller.ImportController.Read(ImportController.java:235)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/8.0.23.
Apache Tomcat/8.0.23
this is my com.my.util.HibernateUtil class
package com.my.util;
/**
*
* @author ILIAS
*/
import org.hibernate.*;
import org.hibernate.cfg.*;
public class HibernateUtil {
public static final SessionFactory sessionFactory;
private static HibernateUtil singleton = null;
private HibernateUtil(){}
static {
try {
sessionFactory = new Configuration().configure("Hibernate.cfg.xml").buildSessionFactory();
} catch (Throwable ex) {
System.err.println("Initial SessionFactory creation failed.***************************" + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static HibernateUtil getInstance(){
if(singleton == null){
singleton = new HibernateUtil();
}
return singleton;
}
public static SessionFactory getSessionFactory() {
return sessionFactory;}}
this is the tomcat server log
Initial SessionFactory creation failed.****************************************org.hibernate.PropertyNotFoundException: Could not find a getter for Employe in class com.my.dao.Departement
août 06, 2015 9:18:18 AM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [action] in context with path [/Gestion_et_Generation_Docs_des_Salaries] threw exception [Handler processing failed; nested exception is java.lang.ExceptionInInitializerError] with root cause
org.hibernate.PropertyNotFoundException: Could not find a getter for Employe in class com.my.dao.Departement
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:272)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:247)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:125)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at com.my.util.HibernateUtil.<clinit>(HibernateUtil.java:19)
at com.my.dao.EmployeImplDB.getAllEmploye(EmployeImplDB.java:114)
at com.my.service.EmployeImplMetier.getAll(EmployeImplMetier.java:55)
at com.my.controller.ImportController.Read(ImportController.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
- cleaning up connection pool: jdbc:mysql://localhost:3306/GestionDocs
this is my com.my.dao.Departement class
package com.my.dao;
import java.util.Set;
/**
* @author Ilias
* @version 1.0
*/
public class Departement {
private int id;
private String nomDepartement;
private Set<Employe> Employe;
/**
* @return the employe
*/
public Set<Employe> getEmploye() {
return Employe;
}
/**
* @param employe the employe to set
*/
public void setEmploye(Set<Employe> Employe) {
this.Employe = Employe;
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the nomDepartement
*/
public String getNomDepartement() {
return nomDepartement;
}
/**
* @param nomDepartement the nomDepartement to set
*/
public void setNomDepartement(String nomDepartement) {
this.nomDepartement = nomDepartement;
}
public Departement(String nomDepartement) {
super();
this.nomDepartement = nomDepartement;
}
public Departement(){
}
/**
*
* @exception Throwable
*/
public void finalize()
throws Throwable{
}
}
this is my com.my.dao.Employe class
package com.my.dao;
import java.util.Date;
/**
* @author Ilias
* @version 1.0
*/
public class Employe {
private int id;
private String nomEmploye;
private String prenomEmploye;
private int matriculeMY;
private String adresse;
private String sexe;
private String cin;
private Date dateNaissance;
private String situationFamiliale;
private int nombreEnfant;
private Date dateEntree;
private Date dateSortie;
private String numCIMR;
private String numCNSS;
private String numMUT;
private String profile;
private String resteConge;
private String banque;
private String numCpteBanc;
private String fonction;
private float salaire;
private float indTransport;
private float indRepresent;
private float indPanier;
private Departement eDepartement;
private Fonction eFonction;
private Service eService;
private TypePaiement eTypePaiement;
private ModePaiement eModePaiement;
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the nomEmploye
*/
public String getNomEmploye() {
return nomEmploye;
}
/**
* @param nomEmploye the nomEmploye to set
*/
public void setNomEmploye(String nomEmploye) {
this.nomEmploye = nomEmploye;
}
/**
* @return the prenomEmploye
*/
public String getPrenomEmploye() {
return prenomEmploye;
}
/**
* @param prenomEmploye the prenomEmploye to set
*/
public void setPrenomEmploye(String prenomEmploye) {
this.prenomEmploye = prenomEmploye;
}
/**
* @return the matriculeMY
*/
public int getMatriculeMY() {
return matriculeMY;
}
/**
* @param matriculeMY the matriculeMY to set
*/
public void setMatriculeMY(int matriculeMY) {
this.matriculeMY = matriculeMY;
}
/**
* @return the adresse
*/
public String getAdresse() {
return adresse;
}
/**
* @param adresse the adresse to set
*/
public void setAdresse(String adresse) {
this.adresse = adresse;
}
/**
* @return the sexe
*/
public String getSexe() {
return sexe;
}
/**
* @param sexe the sexe to set
*/
public void setSexe(String sexe) {
this.sexe = sexe;
}
/**
* @return the cin
*/
public String getCin() {
return cin;
}
/**
* @param cin the cin to set
*/
public void setCin(String cin) {
this.cin = cin;
}
/**
* @return the dateNaissance
*/
public Date getDateNaissance() {
return dateNaissance;
}
/**
* @param dateNaissance the dateNaissance to set
*/
public void setDateNaissance(Date dateNaissance) {
this.dateNaissance = dateNaissance;
}
/**
* @return the situationFamiliale
*/
public String getSituationFamiliale() {
return situationFamiliale;
}
/**
* @param situationFamiliale the situationFamiliale to set
*/
public void setSituationFamiliale(String situationFamiliale) {
this.situationFamiliale = situationFamiliale;
}
/**
* @return the nombreEnfant
*/
public int getNombreEnfant() {
return nombreEnfant;
}
/**
* @param nombreEnfant the nombreEnfant to set
*/
public void setNombreEnfant(int nombreEnfant) {
this.nombreEnfant = nombreEnfant;
}
/**
* @return the dateEntree
*/
public Date getDateEntree() {
return dateEntree;
}
/**
* @param dateEntree the dateEntree to set
*/
public void setDateEntree(Date dateEntree) {
this.dateEntree = dateEntree;
}
/**
* @return the dateSortie
*/
public Date getDateSortie() {
return dateSortie;
}
/**
* @param dateSortie the dateSortie to set
*/
public void setDateSortie(Date dateSortie) {
this.dateSortie = dateSortie;
}
/**
* @return the numCIMR
*/
public String getNumCIMR() {
return numCIMR;
}
/**
* @param numCIMR the numCIMR to set
*/
public void setNumCIMR(String numCIMR) {
this.numCIMR = numCIMR;
}
/**
* @return the numCNSS
*/
public String getNumCNSS() {
return numCNSS;
}
/**
* @param numCNSS the numCNSS to set
*/
public void setNumCNSS(String numCNSS) {
this.numCNSS = numCNSS;
}
/**
* @return the numMUT
*/
public String getNumMUT() {
return numMUT;
}
/**
* @param numMUT the numMUT to set
*/
public void setNumMUT(String numMUT) {
this.numMUT = numMUT;
}
/**
* @return the profile
*/
public String getProfile() {
return profile;
}
/**
* @param profile the profile to set
*/
public void setProfile(String profile) {
this.profile = profile;
}
/**
* @return the resteConge
*/
public String getResteConge() {
return resteConge;
}
/**
* @param resteConge the resteConge to set
*/
public void setResteConge(String resteConge) {
this.resteConge = resteConge;
}
/**
* @return the banque
*/
public String getBanque() {
return banque;
}
/**
* @param banque the banque to set
*/
public void setBanque(String banque) {
this.banque = banque;
}
/**
* @return the numCpteBanc
*/
public String getNumCpteBanc() {
return numCpteBanc;
}
/**
* @param numCpteBanc the numCpteBanc to set
*/
public void setNumCpteBanc(String numCpteBanc) {
this.numCpteBanc = numCpteBanc;
}
/**
* @return the fonction
*/
public String getFonction() {
return fonction;
}
/**
* @param fonction the fonction to set
*/
public void setFonction(String fonction) {
this.fonction = fonction;
}
/**
* @return the salaire
*/
public float getSalaire() {
return salaire;
}
/**
* @param salaire the salaire to set
*/
public void setSalaire(float salaire) {
this.salaire = salaire;
}
/**
* @return the indTransport
*/
public float getIndTransport() {
return indTransport;
}
/**
* @param indTransport the indTransport to set
*/
public void setIndTransport(float indTransport) {
this.indTransport = indTransport;
}
/**
* @return the indRepresent
*/
public float getIndRepresent() {
return indRepresent;
}
/**
* @param indRepresent the indRepresent to set
*/
public void setIndRepresent(float indRepresent) {
this.indRepresent = indRepresent;
}
/**
* @return the indPanier
*/
public float getIndPanier() {
return indPanier;
}
/**
* @param indPanier the indPanier to set
*/
public void setIndPanier(float indPanier) {
this.indPanier = indPanier;
}
/**
* @return the eDepartement
*/
public Departement geteDepartement() {
return eDepartement;
}
/**
* @param eDepartement the eDepartement to set
*/
public void seteDepartement(Departement eDepartement) {
this.eDepartement = eDepartement;
}
/**
* @return the eFonction
*/
public Fonction geteFonction() {
return eFonction;
}
/**
* @param eFonction the eFonction to set
*/
public void seteFonction(Fonction eFonction) {
this.eFonction = eFonction;
}
/**
* @return the eService
*/
public Service geteService() {
return eService;
}
/**
* @param eService the eService to set
*/
public void seteService(Service eService) {
this.eService = eService;
}
/**
* @return the eTypePaiement
*/
public TypePaiement geteTypePaiement() {
return eTypePaiement;
}
/**
* @param eTypePaiement the eTypePaiement to set
*/
public void seteTypePaiement(TypePaiement eTypePaiement) {
this.eTypePaiement = eTypePaiement;
}
/**
* @return the eModePaiement
*/
public ModePaiement geteModePaiement() {
return eModePaiement;
}
/**
* @param eModePaiement the eModePaiement to set
*/
public void seteModePaiement(ModePaiement eModePaiement) {
this.eModePaiement = eModePaiement;
}
public Employe(String nomEmploye, String prenomEmploye, int matriculeMY, String adresse, String sexe, String cin,
Date dateNaissance, String situationFamiliale, int nombreEnfant, Date dateEntree, Date dateSortie,
String numCIMR, String numCNSS, String numMUT, String profile, String resteConge, String banque,
String numCpteBanc, String fonction, float salaire, float indTransport, float indRepresent, float indPanier,
Departement eDepartement, Fonction eFonction, Service eService, TypePaiement eTypePaiement,
ModePaiement eModePaiement) {
super();
this.nomEmploye = nomEmploye;
this.prenomEmploye = prenomEmploye;
this.matriculeMY = matriculeMY;
this.adresse = adresse;
this.sexe = sexe;
this.cin = cin;
this.dateNaissance = dateNaissance;
this.situationFamiliale = situationFamiliale;
this.nombreEnfant = nombreEnfant;
this.dateEntree = dateEntree;
this.dateSortie = dateSortie;
this.numCIMR = numCIMR;
this.numCNSS = numCNSS;
this.numMUT = numMUT;
this.profile = profile;
this.resteConge = resteConge;
this.banque = banque;
this.numCpteBanc = numCpteBanc;
this.fonction = fonction;
this.salaire = salaire;
this.indTransport = indTransport;
this.indRepresent = indRepresent;
this.indPanier = indPanier;
this.eDepartement = eDepartement;
this.eFonction = eFonction;
this.eService = eService;
this.eTypePaiement = eTypePaiement;
this.eModePaiement = eModePaiement;
}
public Employe(Employe e){
this.setNomEmploye(e.nomEmploye);
this.setPrenomEmploye(e.prenomEmploye);
this.setCin(e.cin);
this.setDateNaissance(e.dateNaissance);
this.setSituationFamiliale(e.situationFamiliale);
this.setNombreEnfant(e.nombreEnfant);
this.setDateEntree(e.dateEntree);
this.setDateSortie(e.dateSortie);
this.setNumCIMR(e.numCIMR);
this.setNumCNSS(e.numCNSS);
this.setNumMUT(e.numMUT);
this.setProfile(e.profile);
this.setResteConge(e.resteConge);
this.setBanque(e.banque);
this.setNumCpteBanc(e.numCpteBanc);
this.setSalaire(e.salaire);
this.setIndTransport(e.indTransport);
this.setIndRepresent(e.indRepresent);
this.setIndPanier(e.indPanier);
//this.setFonction(e.fonction);
this.seteDepartement(e.eDepartement);
this.seteFonction(e.eFonction);
this.seteService(e.eService);
this.seteModePaiement(e.eModePaiement);
this.seteTypePaiement(e.eTypePaiement);
}
public Employe() {
super();
}
/**
* {@exception} Throwable
*/
public void finalize() throws Throwable{
}}
this is Departement.hbm.xml
<?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 5 ao?t 2015 11:05:44 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.my.dao.Departement" table="DEPARTEMENT">
<id name="id" type="int">
<column name="ID" />
<generator class="native" />
</id>
<property name="nomDepartement" type="java.lang.String">
<column name="NOMDEPARTEMENT" />
</property>
<set name="Employe" inverse="true">
<key column="ID" not-null="true"/>
<one-to-many class="com.my.dao.Employe" />
</set>
</class>
</hibernate-mapping>
this is Employe.hbm.xml
<?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 5 ao?t 2015 11:05:44 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.my.dao.Employe" table="EMPLOYE">
<id name="id" type="int">
<column name="ID" />
<generator class="native" />
</id>
<property name="nomEmploye" type="java.lang.String">
<column name="NOMEMPLOYE" />
</property>
<property name="prenomEmploye" type="java.lang.String">
<column name="PRENOMEMPLOYE" />
</property>
<property name="matriculeMY" type="int">
<column name="MATRICULEMY" />
</property>
<property name="adresse" type="java.lang.String">
<column name="ADRESSE" />
</property>
<property name="sexe" type="java.lang.String">
<column name="SEXE" />
</property>
<property name="cin" type="java.lang.String">
<column name="CIN" />
</property>
<property name="dateNaissance" type="java.lang.String">
<column name="DATENAISSANCE" />
</property>
<property name="situationFamiliale" type="java.lang.String">
<column name="SITUATIONFAMILIALE" />
</property>
<property name="dateEntree" type="java.lang.String">
<column name="DATEENTREE" />
</property>
<property name="dateSortie" type="java.lang.String">
<column name="DATESORTIE" />
</property>
<property name="numCIMR" type="java.lang.String">
<column name="NUMCIMR" />
</property>
<property name="numCNSS" type="java.lang.String">
<column name="NUMCNSS" />
</property>
<property name="numMUT" type="java.lang.String">
<column name="NUMMUT" />
</property>
<property name="profile" type="java.lang.String">
<column name="PROFILE" />
</property>
<property name="resteConge" type="java.lang.String">
<column name="RESTECONGE" />
</property>
<property name="banque" type="java.lang.String">
<column name="BANQUE" />
</property>
<property name="numCpteBanc" type="java.lang.String">
<column name="NUMCPTEBANC" />
</property>
<!-- <property name="fonction" type="java.lang.String">
<column name="FONCTION" />
</property> -->
<property name="salaire" type="float">
<column name="SALAIRE" />
</property>
<property name="indTransport" type="float">
<column name="INDTRANSPORT" />
</property>
<property name="indRepresent" type="float">
<column name="INDREPRESENT" />
</property>
<property name="indPanier" type="float">
<column name="INDPANIER" />
</property>
<many-to-one name="eDepartement" class="com.my.dao.Departement" access="field" fetch="join">
<column name="EDEPARTEMENT" />
</many-to-one>
<many-to-one name="eFonction" class="com.my.dao.Fonction" access="field" fetch="join">
<column name="EFONCTION" />
</many-to-one>
<many-to-one name="eService" class="com.my.dao.Service" access="field" fetch="join">
<column name="ESERVICE" />
</many-to-one>
<many-to-one name="eTypePaiement" class="com.my.dao.TypePaiement" access="field" fetch="join">
<column name="ETYPEPAIEMENT" />
</many-to-one>
<many-to-one name="eModePaiement" class="com.my.dao.ModePaiement" access="field" fetch="join">
<column name="EMODEPAIEMENT" />
</many-to-one>
</class>
</hibernate-mapping>
I'm beginner and it's my first project in spring
I think i had a problem on hibernate-mapping,
but i can't find where is the problem, can you help PLZ?
解决方案
In your log we can see
I think Hibernate can't initialize your mapping.
In your Departement.hbm.xml you put
<set name="Employe" inverse="true">
<key column="ID" not-null="true"/>
<one-to-many class="com.my.dao.Employe" />
</set>
But in Department.java there is not attribut Employe. So you have to add one like this:
private Set<Employe> Employe;
And adding getter/setter for it
By the way you should rename attribut Employe like employes (starting with lowercase).
这篇关于嵌套异常是java.lang.NoClassDefFoundError:无法初始化类com.my.util.HibernateUtil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!