匪夷所思的错误,
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentExce
ption occurred while calling setter of youngfriend.server.business.hrmanager.ent
ity.Role.hr; nested exception is org.hibernate.PropertyAccessException: IllegalA
rgumentException occurred while calling setter of abc.hr
manager.entity.Role.hr
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while c
alling setter of abc.hr
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPro
pertyAccessor.java:104)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(A
bstractEntityTuplizer.java:337)
at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoE
ntityTuplizer.java:200)
at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyVal
ues(AbstractEntityPersister.java:3560)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:
129)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.j
ava:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1851)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityL
oader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityL
oader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractE
ntityPersister.java:3038)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(D
efaultLoadEventListener.java:395)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEv
entListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEven
tListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultL
oadEventListener.java:179)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEv
entListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(
HibernateTemplate.java:451)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(Hibernat
eTemplate.java:365)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTem
plate.java:445)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTem
plate.java:439)
错误指向的运行位置是:
Role role = (Role) daoUtil.get(Role.class, roleid);
一行简单的不能再简单的语句了。
查看了网上有很多的说法:
1、类型传递不对, 比如整数型的, 但是set了一个字符型
2、配置文件不对,比如多对一、或者类写的不对
等等。
相关的网址:
http://boyadn.blog.163.com/blog/static/7423073620127182347667/
http://669341085.iteye.com/blog/858564
http://zhanghua.1199.blog.163.com/blog/static/46449807201212232514180/
但是, 我们这个程序已经运行N年了。 为啥就突然出现这个问题。几费周折, 最终定为到程序运行目录, 里面含有中文。 这个晕啊。
jdk1.7的运行环境, 目录含有中文的时候, 竟然hibernate通过类路径加载的时候回报这个错误呢?