我在调用请求时收到类似的错误:
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)
有人能说出为什么会这样吗?
感谢。
答案 0 :(得分:1)
你的问题在这里开始了:
at pwcms.GetRecommendations.doPost(GetRecommendations.java:41)
看起来它试图在没有推荐时找到推荐 - 或推荐的属性设置为null,当它不应该时。我是100%这不是一个tomcat问题。尝试在数据库中达到峰值,检查所有数据是否设置正确。
答案 1 :(得分:0)
看起来像部署问题。或者可能是tomcat的问题。 你可以重新安装并试试吗?