从网络i2p访问时java.lang.NullPointerException

时间:2015-08-01 14:37:50

标签: java jetty spark-java

从服务器隧道i2p(https://geti2p.net)访问时访问应用程序时出错。当我没有隧道时访问这么好。

提供静态文件没有任何问题。该问题仅出现在动态内容中。

我正在使用spark -framework

在浏览器中:

HTTP ERROR: 500

Problem accessing /. Reason:

java.lang.NullPointerException
Powered by Jetty://

在日志中:

[qtp721779748-28] WARN org.eclipse.jetty.server.HttpChannel - /acerca
java.lang.NullPointerException
at spark.utils.GzipUtils$StringMatch.test(GzipUtils.java:79)
at spark.utils.GzipUtils$StringMatch.test(GzipUtils.java:76)
at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1351)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:529)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:516)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449)
at spark.utils.GzipUtils.checkAndWrap(GzipUtils.java:63)
at spark.webserver.MatcherFilter.doFilter(MatcherFilter.java:248)
at spark.webserver.JettyHandler.doHandle(JettyHandler.java:60)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:179)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:451)
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:252)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:266)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:240)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:596)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:527)
at java.lang.Thread.run(Thread.java:745)

在代码中:

get("/", (req, res) -> {        
            logger.info(req.ip() + " - " + req.headers("X-I2P-DestB32") + " - GET / - " + req.userAgent());
            res.status(200);
            res.type("text/html");
            ObjectMapper mapper = new ObjectMapper();
            Canales canales = mapper.readValue(new File("/tmp/canales.json"), Canales.class);
            Canal[] cnls = canales.lista.toArray(new Canal[canales.lista.size()]);
            Arrays.sort(cnls);            
            logger.info("Preparando para mostrar " + cnls.length + " canales " );
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("posts", "");
            attributes.put("canales",cnls);
            return freeMarkerEngine.render(new ModelAndView(attributes, "index.ftl.html"));
        });

有什么建议吗?

0 个答案:

没有答案