解决
最后问题解决的有点出乎意料,与下面描述的报错其实没有关系(当然下面也是莫名其妙的 BUG)
[DEBUG]-[2017-12-05 13:45:58]-[org.b3log.solo.SoloServletListener:126]: Request [
method=OPTIONS,
浏览器使用了 options 方式去请求登录,应该是 post
于是给 login 方法增加了 options 方法的支持,为什么会用 options 还要再看
@RequestProcessing(value = "/login", method = {HTTPRequestMethod.POST,HTTPRequestMethod.OPTIONS}) public void login(final HTTPRequestContext context) {
描述
环境:jdk1.8,tomcat9.0.1,H2 数据库
问题:服务长时间开启后,后台无法登录,login 方法报 404
后台报错
[ERROR]-[2017-12-02 10:35:17]-[org.b3log.solo.processor.ArticleProcessor:1101]:
java.lang.NullPointerException
at org.b3log.solo.repository.impl.ArticleRepositoryImpl.getNextArticle(ArticleRepositoryImpl.java:216)
at org.b3log.solo.repository.impl.ArticleRepositoryImpl_$$_jvst2b4_3f._d16getNextArticle(ArticleRepositoryImpl_$$_jvst2b4_3f.java)
at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.b3log.latke.ioc.bean.JavassistMethodHandler.invoke(JavassistMethodHandler.java:106)
at org.b3log.solo.repository.impl.ArticleRepositoryImpl_$$_jvst2b4_3f.getNextArticle(ArticleRepositoryImpl_$$_jvst2b4_3f.java)
at org.b3log.solo.service.ArticleQueryService.getNextArticle(ArticleQueryService.java:911)
at org.b3log.solo.service.ArticleQueryService_$$_jvst2b4_1e._d16getNextArticle(ArticleQueryService_$$_jvst2b4_1e.java)
at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.b3log.latke.ioc.bean.JavassistMethodHandler.invoke(JavassistMethodHandler.java:106)
at org.b3log.solo.service.ArticleQueryService_$$_jvst2b4_1e.getNextArticle(ArticleQueryService_$$_jvst2b4_1e.java)
at org.b3log.solo.processor.ArticleProcessor.prepareShowArticle(ArticleProcessor.java:1287)
at org.b3log.solo.processor.ArticleProcessor.showArticle(ArticleProcessor.java:1078)
at org.b3log.solo.processor.ArticleProcessor_$$_jvst2b4_f._d16showArticle(ArticleProcessor_$$_jvst2b4_f.java)
at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
04-Dec-2017 07:14:47.861 INFO [http-nio-80-exec-17] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:410)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
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)
临时解决方案
给 org.b3log.solo.repository.impl.ArticleRepositoryImpl.getNextArticle 方法添加非空校验
更新
获取上一篇又开始报错,咱不知道无效的 articleId 从哪来的,增加了日志信息,并把日志模式调成了 trace,有问题再更新
[ERROR]-[2017-12-04 14:42:29]-[org.b3log.solo.processor.ArticleProcessor:1101]:
java.lang.NullPointerException
at org.b3log.solo.repository.impl.ArticleRepositoryImpl.getPreviousArticle(ArticleRepositoryImpl.java:187)
at org.b3log.solo.repository.impl.ArticleRepositoryImpl_$$_jvst2b4_3f._d17getPreviousArticle(ArticleRepositoryImpl_$$_jvst2b4_3f.java)
at sun.reflect.GeneratedMethodAccessor127.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.b3log.latke.ioc.bean.JavassistMethodHandler.invoke(JavassistMethodHandler.java:106)
at org.b3log.solo.repository.impl.ArticleRepositoryImpl_$$_jvst2b4_3f.getPreviousArticle(ArticleRepositoryImpl_$$_jvst2b4_3f.java)
at org.b3log.solo.service.ArticleQueryService.getPreviousArticle(ArticleQueryService.java:936)
at org.b3log.solo.service.ArticleQueryService_$$_jvst2b4_1e._d17getPreviousArticle(ArticleQueryService_$$_jvst2b4_1e.java)
at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于