错误:java.lang.IllegalArgumentException: attempt to create create event with null entity

来源:互联网 发布:网络借贷信息披露细则 编辑:程序博客网 时间:2024/06/05 18:11

1.错误信息:

java.lang.IllegalArgumentException: attempt to create create event with null entityorg.hibernate.event.spi.PersistEvent.<init>(PersistEvent.java:44)org.hibernate.event.spi.PersistEvent.<init>(PersistEvent.java:37)org.hibernate.internal.SessionImpl.persist(SessionImpl.java:826)org.hibernate.internal.SessionImpl.persist(SessionImpl.java:830)org.springframework.orm.hibernate4.HibernateTemplate$20.doInHibernate(HibernateTemplate.java:737)org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:340)org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:308)org.springframework.orm.hibernate4.HibernateTemplate.persist(HibernateTemplate.java:733)com.sise.dao.impl.CustomerDaoImpl.addCustomer(CustomerDaoImpl.java:32)com.sise.service.impl.CustomerServiceImpl.addCustomer(CustomerServiceImpl.java:30)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:597)org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)$Proxy10.addCustomer(Unknown Source)com.sise.action.CustomerAction.add(CustomerAction.java:67)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:597)com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.

2.问题分析

attempt to create create event with null entity的大概意思是创建空值,即某个地方的传参出现错误。

3.方法

检查hbm.xml配置文件、类的构造方法、jsp页面name值是否一致,另外,jsp页面的name值应该加上action中变量的名. ,例如:<input type="text" name="product.name" />,其中,product是action中的变量。
我的错误就是将<s:textfield name="customer.customerName"/>写成<s:textfield name="customerName"/>少了"customer."

4.原文

http://hi.baidu.com/ihanhan06/item/bd6cdbc6baf3903a0831c628
0 0
原创粉丝点击