问题描述
各位大侠们?麻烦帮我看下可以吗?上传文件时报这个错,谢谢:严重:Servlet.service()forservletactionthrewexceptioncom.mysql.jdbc.MysqlDataTruncation:Datatruncation:Datatoolongforcolumn'filepath'atrow1atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2973)atcom.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)atcom.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1125)atcom.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:677)atcom.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1357)atcom.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1274)atcom.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1259)atorg.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)atorg.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)atorg.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)atorg.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)atorg.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)atorg.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)atorg.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)atorg.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)atorg.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)atorg.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)atorg.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)atorg.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)atorg.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)atorg.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)atorg.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)atorg.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)atorg.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)atorg.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:198)at$Proxy18.persist(UnknownSource)atcom.service.base.DaoSupport.save(DaoSupport.java:40)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)atorg.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)atorg.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)atorg.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)at$Proxy22.save(UnknownSource)atcom.web.action.upfile.UpFileAction.upFile(UpFileAction.java:51)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)atorg.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)atorg.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)atorg.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)atorg.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)atorg.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:710)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atcom.web.filter.SetCodeFilter.doFilter(SetCodeFilter.java:28)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)atjava.lang.Thread.run(Thread.java:619)
解决方案
解决方案二:
提示好像是数据库中没有filepath这个列
解决方案三:
还是其他啥哦呵呵,反正意思就是数据库filepath这个列的问题~
解决方案四:
是不是你的filepath字段长度不够?
解决方案五:
数据库的问题Datatoolongforcolumn'filepath'你的filepath数据长度大于数据库字段可以接受的长度