Mybatis Plus 更新时间 updateTime字段报错 Could not set property 'updateTime'

背景

遇到这个问题折腾好几个小时,差点被逼疯。记录一下。

先说下环境,MySQL数据库,表中字段名为update_time,类型为datetime。Java实体类中对应的变量是java.util.Date类型的updateTime。

环境交代完毕,使用update语句更新记录的时候,一直报错,说类型不匹配。贴上报错信息:

  1 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property ‘updateTime‘ of ‘class com.sinosoft.secloud.admin.api.entity.CtgAppInfo‘ with value ‘2019-11-07T10:12:39.257‘ Cause: java.lang.IllegalArgumentException: argument type mismatch
  2     at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
  3     at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
  4     at com.sun.proxy.$Proxy187.update(Unknown Source)
  5     at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294)
  6     at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:69)
  7     at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:61)
  8     at com.sun.proxy.$Proxy195.updateById(Unknown Source)
  9     at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.updateById(ServiceImpl.java:208)
 10     at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl$$FastClassBySpringCGLIB$$76535273.invoke(<generated>)
 11     at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 12     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
 13     at com.sinosoft.secloud.admin.service.impl.AppInfoServiceImpl$$EnhancerBySpringCGLIB$$2ee21674.updateById(<generated>)
 14     at com.sinosoft.secloud.admin.controller.AppInfoController.update(AppInfoController.java:96)
 15     at com.sinosoft.secloud.admin.controller.AppInfoController$$FastClassBySpringCGLIB$$4d69b343.invoke(<generated>)
 16     at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 17     at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
 18     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
 19     at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
 20     at com.sinosoft.secloud.common.log.aspect.SysLogAspect.around(SysLogAspect.java:36)
 21     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 22     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 23     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 24     at java.lang.reflect.Method.invoke(Method.java:497)
 25     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
 26     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
 27     at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
 28     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
 29     at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
 30     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
 31     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
 32     at com.sinosoft.secloud.admin.controller.AppInfoController$$EnhancerBySpringCGLIB$$8e8549a.update(<generated>)
 33     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 34     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 35     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 36     at java.lang.reflect.Method.invoke(Method.java:497)
 37     at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
 38     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
 39     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
 40     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
 41     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
 42     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
 43     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
 44     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
 45     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
 46     at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:919)
 47     at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
 48     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
 49     at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
 50     at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
 51     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
 52     at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
 53     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 54     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 55     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 56     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
 57     at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
 58     at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
 59     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 60     at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
 61     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 62     at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
 63     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 64     at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
 65     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 66     at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
 67     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 68     at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
 69     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 70     at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
 71     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 72     at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
 73     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 74     at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74)
 75     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 76     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 77     at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
 78     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 79     at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
 80     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 81     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 82     at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
 83     at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
 84     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
 85     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
 86     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 87     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 88     at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
 89     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 90     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 91     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 92     at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
 93     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 94     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 95     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 96     at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
 97     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 98     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 99     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
100     at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:50)
101     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
102     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
103     at brave.servlet.TracingFilter.doFilter(TracingFilter.java:86)
104     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
105     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
106     at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
107     at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
108     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
109     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
110     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
111     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
112     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
113     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
114     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
115     at com.sinosoft.secloud.common.data.tenant.TenantContextHolderFilter.doFilter(TenantContextHolderFilter.java:41)
116     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
117     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
118     at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
119     at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
120     at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
121     at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
122     at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
123     at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
124     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
125     at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
126     at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
127     at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
128     at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
129     at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
130     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
131     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
132     at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
133     at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
134     at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
135     at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
136     at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
137     at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
138     at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
139     at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
140     at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
141     at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
142     at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
143     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
144     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
145     at java.lang.Thread.run(Thread.java:745)
146 Caused by: org.apache.ibatis.reflection.ReflectionException: Could not set property ‘updateTime‘ of ‘class com.sinosoft.secloud.admin.api.entity.CtgAppInfo‘ with value ‘2019-11-07T10:12:39.257‘ Cause: java.lang.IllegalArgumentException: argument type mismatch
147     at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:185)
148     at org.apache.ibatis.reflection.wrapper.BeanWrapper.set(BeanWrapper.java:59)
149     at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:140)
150     at com.baomidou.mybatisplus.core.handlers.MetaObjectHandler.setFieldValByName(MetaObjectHandler.java:72)
151     at com.sinosoft.secloud.common.data.mybatis.ModelMetaObjectHandler.updateFill(ModelMetaObjectHandler.java:54)
152     at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.populateKeys(MybatisDefaultParameterHandler.java:192)
153     at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.processBatch(MybatisDefaultParameterHandler.java:120)
154     at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.<init>(MybatisDefaultParameterHandler.java:51)
155     at com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver.createParameterHandler(MybatisXMLLanguageDriver.java:34)
156     at com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver.createParameterHandler(MybatisXMLLanguageDriver.java:28)
157     at org.apache.ibatis.session.Configuration.newParameterHandler(Configuration.java:550)
158     at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:69)
159     at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:41)
160     at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:46)
161     at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:563)
162     at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48)
163     at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
164     at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
165     at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
166     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
167     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
168     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
169     at java.lang.reflect.Method.invoke(Method.java:497)
170     at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
171     ... 142 common frames omitted
172 Caused by: java.lang.IllegalArgumentException: argument type mismatch
173     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
174     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
175     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
176     at java.lang.reflect.Method.invoke(Method.java:497)
177     at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:44)
178     at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:180)
179     ... 165 common frames omitted

反复检查,数据库中的类型和Java实体类中的类型都没有错,缓存也清理了,都无效,一直就这个错。然后直接在逻辑层不更新这个时间了,只更新其他字段,结果没用,依旧报这个错!于是怀疑可能Mybaits Plus框架有问题,同事说可能会自动添加更新时间,可我在官网找半天也没找到相关描述。最后还是自己琢磨出解决办法了。下面附上解决方法:


方法一:

修改字段名为其他的,比如改成update_date或update_times

方法二:

字段名保持不变,将Java中的字段类型改为java.time.LocalDateTime,赋值的话LocalDateTime.now()即可。

原因猜测

个人还是觉得Mybaits Plus插件内部存在一个更新时间字段,导致冲突了。但没有证实。哪位大佬知道还请告知下。

Mybatis Plus 更新时间 updateTime字段报错 Could not set property 'updateTime'

原文地址:https://www.cnblogs.com/plumsq/p/11811121.html

时间: 2024-10-12 09:42:31

Mybatis Plus 更新时间 updateTime字段报错 Could not set property 'updateTime'的相关文章

Mysql 升级到 5.6 后插入语句时间字段报错:Incorrect datetime value: &#39;&#39; for column &#39;createtime&#39;

今天部署服务器项目运行,当遇见有时间数据对象的插入和更新操作的时候,就报错,如下: Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'createtime' at row 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2868) at com.mysql.jdbc.My

mysql 插入中文字段报错 &quot;Incorrect string value: &#39;\\xE6\\xB5\\x8B\\xE8\\xAF\\x95...&#39; for column &#39;title&#39; at row 1&quot;

1. 查看一个 database 或一个 table 的编码show create database mytestdb;show create table testapp_article; mysql> show create table testapp_article;+-----------------+-----------------------------------------------------------------------------------------------

Mybatis 批量更新多个字段值

Mybatis 批量更新多个字段值 Controller /** * * @Description: 生产物资-指标 发布接口 * @Creator: tangsw * @CreateTime: 2019-12-25 10:37:34 * @Modifier: * @ModifyTime: * @Reasons: * @param output 产品生产产量 * @param capacity 产能利用率 * @param contract 按期履约率 * @param vendor 供应商不良

报错之-Cannot set property &#39;onclick&#39; of null

当js文件放在head里面时,如果绑定了onclick或者onmouseover事件,就会出现如下图类似的错误,是因为浏览器的加载你写的html文档的顺序是从上往下,加载完按钮节点才执行的js,所以当浏览器自顶向下解析时,找不到onclick绑定的按钮节点,于是报错.解决办法有:第一,把js文件放在底部加载:第二,使用window.onload=function(){}包裹js内容. 报错之-Cannot set property 'onclick' of null

Echarts报错 Can&#39;t read property &#39;getWidth&#39; of null

统计图报错: 这里的报错与echarts无关,与zrender有关,zrender是echarts依赖的canvas绘图库 你不需要了解zrender,这个问题是你代码出了错 谨记::代码的错 Echarts报错 Can't read property 'getWidth' of null 原文地址:https://www.cnblogs.com/mangwusuozhi/p/9717410.html

VUE.JS 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property &#39;xxxx&#39; of undefined 的解决办法

正常情况下在data里面都有做了定义 在函数里面进行赋值 这时候你运行时会发现,数据可以请求到,但是会报错 TypeError: Cannot set property 'listgroup' of undefined 主要原因是: 在 then的内部不能使用Vue的实例化的this, 因为在内部 this 没有被绑定.可以看下 Stackoverflow 的解释: 解决办法: 1.用ES6箭头函数,箭头方法可以和父方法共享变量 2.在请求axios外面定义一下 var that=this 问题

TP5.0 报错Trying to get property &#39;obj&#39; of non-object解决办法

写一段简单代码举例一下: $id=$_POST['id'];$sql="SELECT * FORM user WHERE id='$id'";$result=$mysqli->query($sql);$user=$result->name; 如果报错:Trying to get property 'name' of non-object 可能造成报错的原因是你查询出来的结果不是个对象,所以不能用“->”这种方式,解决办法:进入数据库查看一下表结构,看看查出来的是什么数

vue 报错:Cannot read property &#39;__ob__&#39; of undefined

我的原因:引入组件后未注册 <script> import ComFirst from "../../components/ComFirst.vue" import ComSecond from "../../components/ComSecond.vue" export default { name: 'VueFirst', data() { return {} }, components: { //<<这一步未做 ComFirst, C

使用webpack命令打包时,报错TypeError: Cannot read property &#39;presetToOptions&#39; of undefined的解决办法

我只安装了webpack,没有安装webpack-cli,第一次输入webpack打包时,提示 One CLI for webpack must be installed. These are recommended choices, delivered as separate packages: - webpack-cli (https://github.com/webpack/webpack-cli) The original webpack full-featured CLI. We wi