1. What happens: When I add a product or modify a project, the browser appears in HTTP Status 500-request processing failed; Nested exception is org.hibernate.exception.GenericJDBCException:could not execute statement;
Ecplise appears this:
December 20, 2017 1:51:02 pm Org.apache.catalina.core.StandardWrapperValve invoke
Critical: Servlet.service () for servlets [shopping] in the context with path [/shopping] threw exception [Request processing failed; Nested exception is org.hibernate.exception.GenericJDBCException:could No execute statement] with root cause
Java.sql.SQLException:Incorrect string value: ' \xe5\x86\xac\xe8\xa3\x85 ' for column ' cname ' at row 1
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:963)
At Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:3966)
At Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:3902)
At Com.mysql.jdbc.MysqlIO.sendCommand (mysqlio.java:2526)
At Com.mysql.jdbc.MysqlIO.sqlQueryDirect (mysqlio.java:2673)
At Com.mysql.jdbc.ConnectionImpl.execSQL (connectionimpl.java:2549)
At Com.mysql.jdbc.PreparedStatement.executeInternal (preparedstatement.java:1861)
At Com.mysql.jdbc.PreparedStatement.executeUpdateInternal (preparedstatement.java:2073)
At Com.mysql.jdbc.PreparedStatement.executeUpdateInternal (preparedstatement.java:2009)
At Com.mysql.jdbc.PreparedStatement.executeLargeUpdate (preparedstatement.java:5098)
At Com.mysql.jdbc.PreparedStatement.executeUpdate (preparedstatement.java:1994)
At Com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate (newproxypreparedstatement.java:147)
At Org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate (resultsetreturnimpl.java:204)
At Org.hibernate.dialect.identity.GetGeneratedKeysDelegate.executeAndExtract (getgeneratedkeysdelegate.java:57)
At Org.hibernate.id.insert.AbstractReturningDelegate.performInsert (abstractreturningdelegate.java:42)
At Org.hibernate.persister.entity.AbstractEntityPersister.insert (abstractentitypersister.java:2855)
At Org.hibernate.persister.entity.AbstractEntityPersister.insert (abstractentitypersister.java:3426)
At Org.hibernate.action.internal.EntityIdentityInsertAction.execute (entityidentityinsertaction.java:81)
At Org.hibernate.engine.spi.ActionQueue.execute (actionqueue.java:619)
At Org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction (actionqueue.java:273)
At Org.hibernate.engine.spi.ActionQueue.addInsertAction (actionqueue.java:254)
At Org.hibernate.engine.spi.ActionQueue.addAction (actionqueue.java:299)
At Org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction (abstractsaveeventlistener.java:317)
At Org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate (Abstractsaveeventlistener.java : 272)
At Org.hibernate.event.internal.AbstractSaveEventListener.performSave (abstractsaveeventlistener.java:178)
At Org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId (Abstractsaveeventlistener.java : 109)
At Org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId ( defaultsaveorupdateeventlistener.java:192)
At Org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId ( DEFAULTSAVEEVENTLISTENER.JAVA:38)
At Org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient ( defaultsaveorupdateeventlistener.java:177)
At Org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate (defaultsaveeventlistener.java:32)
At Org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate ( defaultsaveorupdateeventlistener.java:73)
At Org.hibernate.internal.SessionImpl.fireSave (sessionimpl.java:679)
At Org.hibernate.internal.SessionImpl.save (sessionimpl.java:671)
At Org.hibernate.internal.SessionImpl.save (sessionimpl.java:666)
At Com.tz.shopping.dao.impl.BaseDaoImpl.save (basedaoimpl.java:54)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:62)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:498)
At Org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection (aoputils.java:302)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (Reflectivemethodinvocation.java : 190)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:157)
At Org.springframework.transaction.interceptor.transactioninterceptor$1.proceedwithinvocation ( TRANSACTIONINTERCEPTOR.JAVA:99)
At Org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction ( transactionaspectsupport.java:281)
At Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (transactioninterceptor.java:96)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:179)
At Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (jdkdynamicaopproxy.java:208)
At Com.sun.proxy. $Proxy 30.save (Unknown Source)
At Com.tz.shopping.service.impl.CategorysServiceImpl.addCategory (categorysserviceimpl.java:46)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:62)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:498)
At Org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection (aoputils.java:302)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (Reflectivemethodinvocation.java : 190)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:157)
At Org.springframework.transaction.interceptor.transactioninterceptor$1.proceedwithinvocation ( TRANSACTIONINTERCEPTOR.JAVA:99)
At Org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction ( transactionaspectsupport.java:281)
At Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (transactioninterceptor.java:96)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:179)
At Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (jdkdynamicaopproxy.java:208)
At Com.sun.proxy. $Proxy 40.addCategory (Unknown Source)
At Com.tz.shopping.controller.admin.CategorysController.addCategory (categoryscontroller.java:60)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:62)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:498)
At Org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (invocablehandlermethod.java:221)
At Org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (Invocablehandlermethod.java : 136)
At Org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle ( SERVLETINVOCABLEHANDLERMETHOD.JAVA:110)
At Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod ( requestmappinghandleradapter.java:832)
At Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal ( requestmappinghandleradapter.java:743)
At Org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle ( ABSTRACTHANDLERMETHODADAPTER.JAVA:85)
At Org.springframework.web.servlet.DispatcherServlet.doDispatch (dispatcherservlet.java:961)
At Org.springframework.web.servlet.DispatcherServlet.doService (dispatcherservlet.java:895)
At Org.springframework.web.servlet.FrameworkServlet.processRequest (frameworkservlet.java:967)
At Org.springframework.web.servlet.FrameworkServlet.doPost (frameworkservlet.java:869)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:648)
At Org.springframework.web.servlet.FrameworkServlet.service (frameworkservlet.java:843)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:729)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:292)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:207)
At Org.apache.tomcat.websocket.server.WsFilter.doFilter (wsfilter.java:52)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:240)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:207)
At Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (characterencodingfilter.java:121)
At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:240)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:207)
At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:212)
At Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:94)
At Org.apache.catalina.authenticator.AuthenticatorBase.invoke (authenticatorbase.java:504)
At Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:141)
At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:79)
At Org.apache.catalina.valves.AbstractAccessLogValve.invoke (abstractaccesslogvalve.java:620)
At Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:88)
At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:502)
At Org.apache.coyote.http11.AbstractHttp11Processor.process (abstracthttp11processor.java:1132)
At Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:684)
At Org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun (nioendpoint.java:1533)
At Org.apache.tomcat.util.net.nioendpoint$socketprocessor.run (nioendpoint.java:1489)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1149)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:624)
At Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (taskthread.java:61)
At Java.lang.Thread.run (thread.java:748)
解决办法:后面我查了资料,然后我在根据在数据直接添加,添加中文时报出:1366-lncstring value: ‘\xE5\x86\xAC\xE8‘ for column ‘cname‘ at row 1,后面我发现数据的属性不是UTF-8;然后我改成UTF-8,就成功;
HTTP Status 500-request processing failed; Nested exception is org.hibernate.exception.GenericJDBCException:could not execute statement