为了账号安全,请及时绑定邮箱和手机立即绑定

在Configuration.xml中一但注册拦截器就报空指针异常

abc

abc

abc

abc

org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in com/imooc/config/Message.xml

### The error may involve com.imooc.dao.IMessage.queryMessageListByPage

### The error occurred while executing a query

### Cause: java.lang.NullPointerException

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)

at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)

at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)

at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)

at com.sun.proxy.$Proxy12.queryMessageListByPage(Unknown Source)

at com.imooc.dao.MessageDao.queryMessageListByPage(MessageDao.java:79)

at com.imooc.service.QueryService.queryMessageListByPage(QueryService.java:55)

at com.imooc.servlet.ListServlet.doGet(ListServlet.java:37)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

at com.imooc.filter.CharacterFilter.doFilter(CharacterFilter.java:25)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

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:87)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NullPointerException

at org.apache.ibatis.reflection.MetaClass.<init>(MetaClass.java:39)

at org.apache.ibatis.reflection.MetaClass.forClass(MetaClass.java:43)

at org.apache.ibatis.reflection.wrapper.BeanWrapper.<init>(BeanWrapper.java:40)

at org.apache.ibatis.reflection.MetaObject.<init>(MetaObject.java:56)

at org.apache.ibatis.reflection.MetaObject.forObject(MetaObject.java:64)

at com.imooc.interceptor.PageInterceptor.intercept(PageInterceptor.java:38)

at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)

at com.sun.proxy.$Proxy13.prepare(Unknown Source)

at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85)

at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)

at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)

at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)


at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)

... 35 more



正在回答

5 回答

你要贴代码呀,大兄弟

0 回复 有任何疑惑可以回复我~
#1

明天会更好_9 提问者

非常感谢!
2016-10-27 回复 有任何疑惑可以回复我~
#2

qq_青云路_03753951

我也遇到相同问题请问怎么解决呢
2017-02-18 回复 有任何疑惑可以回复我~

这个问题是因为MetaObject.forObject这个方法老师的只有三个参数,而我们有四个,最后一个写new DefaultReflectorFactory()就可以了。我遇到这个问题了,看了后面别人问的找出来的。

0 回复 有任何疑惑可以回复我~

同问。。怎么解决的啊

0 回复 有任何疑惑可以回复我~

怎么解决的啊什么问题导致的呢

0 回复 有任何疑惑可以回复我~

已解决

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

在Configuration.xml中一但注册拦截器就报空指针异常

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信