NutzCN Logo
问答 updateWithVersion(Object obj) 空指针问题
发布于 1397天前 作者 SiriusYJN 1369 次浏览 复制 上一个帖子 下一个帖子
标签:
    @Column("version")
    @Comment("乐观锁")
    private long version;
org.nutz.dao.impl.NutDao.updateWithVersion(NutDao.java.1138)
org.nutz.dao.impl.NutDao.updateWithVersion(NutDao.java.1134)
5 回复

用dao.updateAndIncrIfMatch(obj, null, "version"); 没有空指针异常,追溯源码,updateWithVersion 会走 updateAndIncriMatch方法

贴详细报错信息

java.lang.NullPointerException
	at org.nutz.dao.impl.NutDao.updateWithVersion(NutDao.java:1138) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.dao.impl.NutDao.updateWithVersion(NutDao.java:1134) ~[nutz-1.r.66.jar:1.r.66]
	...
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:126) ~[nutz-integration-shiro-1.r.66.jar:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at cn.com.cmbc.creditcard.koi.processor.LogTimeProcessor.process(LogTimeProcessor.java:19) ~[classes/:?]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) [nutz-1.r.66.jar:1.r.66]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.10]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.10]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-all-1.4.1.jar:?]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-all-1.4.1.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.10]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.10]
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.9.jar:1.1.9]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.10]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.10]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.6.jar:2.6]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.10]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.10]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:9.0.10]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.10]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491) [catalina.jar:9.0.10]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.10]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.10]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668) [catalina.jar:9.0.10]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:9.0.10]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.10]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-coyote.jar:9.0.10]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:9.0.10]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764) [tomcat-coyote.jar:9.0.10]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388) [tomcat-coyote.jar:9.0.10]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.10]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.10]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
java.lang.NullPointerException
public int updateWithVersion(Object obj, FieldFilter fieldFilter) {
        return this.updateAndIncrIfMatch(obj, fieldFilter, this.getEntity(Lang.first(obj).getClass()).getVersionField().getName());
    }

打断点,到这的时候出现异常,this.getEntity(Lang.first(obj).getClass()).getVersionField().getName()这块有问题

缺注解啊, 没标明哪个字段是version

添加回复
请先登陆
回到顶部