使用tomcat时出现NullPointerException

发布于 2024-11-28 16:37:53 字数 3600 浏览 2 评论 0原文

我在调用请求时收到这样的错误:

SEVERE: Servlet.service() for servlet [getRecomendations] in context with path [/my-webapp] threw exception
java.lang.NullPointerException
    at com.mysql.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:2803)
    at com.mysql.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:2790)
    at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:228)
    at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:228)
    at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel.getLongColumn(AbstractJDBCDataModel.java:725)
    at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel$ResultSetIDIterator.nextLong(AbstractJDBCDataModel.java:803)
    at org.apache.mahout.cf.taste.impl.recommender.slopeone.MemoryDiffStorage.buildAverageDiffs(MemoryDiffStorage.java:320)
    at org.apache.mahout.cf.taste.impl.recommender.slopeone.MemoryDiffStorage.<init>(MemoryDiffStorage.java:119)
    at org.apache.mahout.cf.taste.impl.recommender.slopeone.SlopeOneRecommender.<init>(SlopeOneRecommender.java:72)
    at org.apache.mahout.cf.taste.pwcms.core.recomender.PurchaseRecomender.<init>(PurchaseRecomender.java:31)
    at org.apache.mahout.cf.taste.pwcms.core.recomender.PurchaseRecomender.<init>(PurchaseRecomender.java:27)
    at org.apache.mahout.cf.taste.pwcms.core.PurchaseRecomenderSingleton.<init>(PurchaseRecomenderSingleton.java:19)
    at org.apache.mahout.cf.taste.pwcms.core.PurchaseRecomenderSingleton.initializeIfNeeded(PurchaseRecomenderSingleton.java:14)
    at org.apache.mahout.cf.taste.pwcms.common.PWCMSRecomendManager.initPurchaseRecommender(PWCMSRecomendManager.java:46)
    at org.apache.mahout.cf.taste.pwcms.common.PWCMSRecomendManager.getRecommendations(PWCMSRecomendManager.java:129)
    at org.apache.mahout.cf.taste.pwcms.common.PWCMSRecomender.getRecommendations(PWCMSRecomender.java:19)
    at pwcms.GetRecommendations.doPost(GetRecommendations.java:41)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:851)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:278)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

任何人都可以告诉我为什么会发生这种情况吗?

谢谢。

I receive an error like this when invoking a request:

SEVERE: Servlet.service() for servlet [getRecomendations] in context with path [/my-webapp] threw exception
java.lang.NullPointerException
    at com.mysql.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:2803)
    at com.mysql.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:2790)
    at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:228)
    at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:228)
    at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel.getLongColumn(AbstractJDBCDataModel.java:725)
    at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel$ResultSetIDIterator.nextLong(AbstractJDBCDataModel.java:803)
    at org.apache.mahout.cf.taste.impl.recommender.slopeone.MemoryDiffStorage.buildAverageDiffs(MemoryDiffStorage.java:320)
    at org.apache.mahout.cf.taste.impl.recommender.slopeone.MemoryDiffStorage.<init>(MemoryDiffStorage.java:119)
    at org.apache.mahout.cf.taste.impl.recommender.slopeone.SlopeOneRecommender.<init>(SlopeOneRecommender.java:72)
    at org.apache.mahout.cf.taste.pwcms.core.recomender.PurchaseRecomender.<init>(PurchaseRecomender.java:31)
    at org.apache.mahout.cf.taste.pwcms.core.recomender.PurchaseRecomender.<init>(PurchaseRecomender.java:27)
    at org.apache.mahout.cf.taste.pwcms.core.PurchaseRecomenderSingleton.<init>(PurchaseRecomenderSingleton.java:19)
    at org.apache.mahout.cf.taste.pwcms.core.PurchaseRecomenderSingleton.initializeIfNeeded(PurchaseRecomenderSingleton.java:14)
    at org.apache.mahout.cf.taste.pwcms.common.PWCMSRecomendManager.initPurchaseRecommender(PWCMSRecomendManager.java:46)
    at org.apache.mahout.cf.taste.pwcms.common.PWCMSRecomendManager.getRecommendations(PWCMSRecomendManager.java:129)
    at org.apache.mahout.cf.taste.pwcms.common.PWCMSRecomender.getRecommendations(PWCMSRecomender.java:19)
    at pwcms.GetRecommendations.doPost(GetRecommendations.java:41)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:851)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:278)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

Can anyone tell why this happens?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

彩扇题诗 2024-12-05 16:37:53

您的问题从这里开始:

at pwcms.GetRecommendations.doPost(GetRecommendations.java:41)

看起来它试图在没有推荐的情况下找到推荐 - 或者推荐的属性在不应该设置为空时被设置为空。我 100% 这不是 Tomcat 问题。尝试在数据库中获取峰值以检查所有数据是否设置正确。

Your problem kicks off here:

at pwcms.GetRecommendations.doPost(GetRecommendations.java:41)

Looks like its trying to find a recommendation when there isn't one there - or an attribute of the recommendation is set to null when it shouldn't be. I'm 100% this isn't a tomcat issue. Try taking a peak in your database to check all the data is setup correctly.

或十年 2024-12-05 16:37:53

看起来像是部署问题。或者可能是tomcat的问题。
您可以重新安装并尝试吗?

looks like deployment issue. Or may be issue with tomcat.
Can you reinstall and try?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文