|
1javax.Servlet.ServletException: Error creating bean with name 'userServiceProxy' defined in class path resource [spring/applicationContext_user.xml]: Can't resolve reference to bean 'transactionManager' while setting property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [spring/applicationContext_user.xml]: Can't resolve reference to bean 'sessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationContext_user.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Could not determine type for: Long, for columns: [org.hibernate.mapping.Column(DEPTID)]
2javax.servlet.ServletException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.lyh.service.userservice.entity.LyhUser.setDeptid; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.lyh.service.userservice.entity.LyhUser.setDeptid
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
3org.springframework.orm.hibernate3.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.lyh.service.userservice.entity.LyhUser.setDeptid; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.lyh.service.userservice.entity.LyhUser.setDeptid
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:413)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:370)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:817)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:809)
com.lyh.service.userservice.dao.impl.UserDAOImpl.login(UserDAOImpl.java:41)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585) \
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
$Proxy3.login(Unknown Source)
com.lyh.service.userservice.manage.impl.UserManageImpl.login(UserManageImpl.java:29)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
$Proxy2.login(Unknown Source)
com.lyh.service.userservice.impl.UserServiceImpl.login(UserServiceImpl.java:47)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
$Proxy1.login(Unknown Source)
com.lyh.web.action.UserAction.login(UserAction.java:59)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
查询结果中包含null的值,对于一些数字或boolean包含null,定义该项时必须使用wrapper类型,而不能是primitive类型,例如使用Integer而不能是int,Boolean而不能是boolean否则会抛出exception
导致原因: 数字型字段值为空.
解决方法:
补充下,主要是数据库中的long ,int等原始数据类型为null,如果hibernate映射文件的字段类型为long,由于null不能赋值给原始类型,所以报错。解决方法1:让字段不为空,方法2:把映射文件的字段改为对象。如long 改为 Long ,int 改为Integer,
double改为 Double
例子:
(原先)
<property name="cityid" type="long" >
<column name="CITYID" precision="22" scale="0" />
</property>
改为:
<property name="cityid" type="java.lang.Long" not-null="true">
<column name="CITYID" precision="22" scale="0" /> |
|