IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> JAVA-You can change this value on the server by setting the ‘max_allowed_packet‘ variable. -> 正文阅读

[Java知识库]JAVA-You can change this value on the server by setting the ‘max_allowed_packet‘ variable.

上传图片把数据存储到数据库时,报错

?Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (5,922,670 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.
; Packet for query is too large (5,922,670 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.; nested exception is com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (5,922,670 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.
?? ?at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:110)
?? ?at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
?? ?at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
?? ?at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
?? ?at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
?? ?at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
?? ?at com.sun.proxy.$Proxy110.insert(Unknown Source)
?? ?at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
?? ?at com.baomidou.mybatisplus.core.override.PageMapperMethod.execute(PageMapperMethod.java:68)
?? ?at com.baomidou.mybatisplus.core.override.PageMapperProxy.invoke(PageMapperProxy.java:64)
?? ?at com.sun.proxy.$Proxy200.insert(Unknown Source)
?? ?at com.seal.user.service.impl.LogoServiceImpl.saveLogo(LogoServiceImpl.java:60)
?? ?at com.seal.user.service.impl.LogoServiceImpl$$FastClassBySpringCGLIB$$8667ca14.invoke(<generated>)
?? ?at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
?? ?at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
?? ?at com.seal.user.service.impl.LogoServiceImpl$$EnhancerBySpringCGLIB$$285f9285.saveLogo(<generated>)
?? ?at com.seal.user.service.impl.LogoServiceImpl$$FastClassBySpringCGLIB$$8667ca14.invoke(<generated>)
?? ?at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
?? ?at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
?? ?at com.seal.user.service.impl.LogoServiceImpl$$EnhancerBySpringCGLIB$$1287ac5b.saveLogo(<generated>)
?? ?at com.seal.user.service.impl.LogoServiceImpl$$FastClassBySpringCGLIB$$8667ca14.invoke(<generated>)
?? ?at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
?? ?at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
?? ?at com.seal.user.service.impl.LogoServiceImpl$$EnhancerBySpringCGLIB$$1287ac5b.saveLogo(<generated>)
?? ?at com.seal.user.controller.LogoController.save(LogoController.java:26)
?? ?at com.seal.user.controller.LogoController$$FastClassBySpringCGLIB$$3fbd481a.invoke(<generated>)
?? ?at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
?? ?at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
?? ?at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
?? ?at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
?? ?at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
?? ?at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)
?? ?at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
?? ?at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:55)
?? ?at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
?? ?at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
?? ?at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
?? ?at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
?? ?at com.seal.user.controller.LogoController$$EnhancerBySpringCGLIB$$8056279b.save(<generated>)
?? ?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?? ?at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
?? ?at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
?? ?at java.lang.reflect.Method.invoke(Unknown Source)
?? ?at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
?? ?at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
?? ?at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
?? ?at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
?? ?at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
?? ?at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
?? ?at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)
?? ?at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
?? ?at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
?? ?at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
?? ?at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
?? ?at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
?? ?at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at brave.servlet.TracingFilter.doFilter(TracingFilter.java:65)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
?? ?at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
?? ?at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
?? ?at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
?? ?at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
?? ?at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
?? ?at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
?? ?at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
?? ?at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
?? ?at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
?? ?at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
?? ?at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:450)
?? ?at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
?? ?at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
?? ?at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
?? ?at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
?? ?at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
?? ?at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at com.seal.common.config.filter.CorsFilter.doFilter(CorsFilter.java:42)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)
?? ?at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
?? ?at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
?? ?at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
?? ?at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:50)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at brave.servlet.TracingFilter.doFilter(TracingFilter.java:82)
?? ?at org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration$LazyTracingFilter.doFilter(TraceWebServletAutoConfiguration.java:143)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)
?? ?at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)
?? ?at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
?? ?at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)
?? ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
?? ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
?? ?at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
?? ?at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
?? ?at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
?? ?at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
?? ?at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
?? ?at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
?? ?at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
?? ?at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
?? ?at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
?? ?at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
?? ?at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)
?? ?at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
?? ?at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
?? ?at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
?? ?at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
?? ?at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (5,922,670 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.

?这是longblob和blob字段类型的数据默认大小的问题.

命令:

show variables like '%max_allowed_packet%';

?修改下默认大小,改为12M,命令:

set global max_allowed_packet = 12*1024*1024;

最后重启mysql

net stop mysql;
net start mysql;

=========================================================================

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2022-03-30 18:09:58  更:2022-03-30 18:13:19 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 6:51:14-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码