Sorry, I failed to include URLs.

My main source would be this one
https://github.com/fertapric/Mahout-MongoDB-Recommender

here is the 1st example of usage,
https://github.com/fertapric/Mahout-MongoDB-Recommender/blob/master/src/TestStarter.java#L321
and 2nd
https://github.com/fertapric/Mahout-MongoDB-Recommender/blob/master/src/com/paradigma/recommender/rest/UserResource.java#L68

But I think i found my mistake... the refreshData method is called when
there is NoSuchUserException thrown... this means I haven't populated
mongodb's collection properly... I'll try that if not, I may come back for
more questions :)

Thank you for your time!

On Sat, Sep 24, 2011 at 3:59 AM, Sean Owen <[email protected]> wrote:

> Yes, looks like your GeneralRecommender is passing null to refreshData()
> for
> items. What examples do you mean?
>
> The fix would be to not do that!
>
> On Sat, Sep 24, 2011 at 4:56 AM, Octavian Covalschi <
> [email protected]> wrote:
>
> > Hey guys,
> >
> > Has anyone succeeded to use MongoDBDataModel at all?
> >
> > Basically I'm getting a NPE:
> >
> > java.lang.NullPointerException
> >    at
> > com.google.common.base.Preconditions.checkNotNull(Preconditions.java:186)
> >    at
> > me.demo.taste.core.MongoDBDataModel.checkData(MongoDBDataModel.java:738)
> >    at
> >
> me.demo.taste.core.MongoDBDataModel.refreshData(MongoDBDataModel.java:356)
> >    at
> >
> >
> me.demo.taste.core.GeneralRecommender.recommend(GeneralRecommender.java:151)
> >    at
> > me.demo.taste.web.RecommenderServlet.doGet(RecommenderServlet.java:80)
> >    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> >    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> >    at
> >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> >    at
> >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >    at
> >
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> >    at
> >
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> >    at
> >
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> >    at
> >
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >    at
> >
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >    at
> >
> >
> com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:64)
> >    at
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
> >    at
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
> >    at
> >
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
> >    at
> >
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:409)
> >    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)
> >
> >
> > This is the code I'm using:
> >
> >    GeneralRecommender recommender = new GeneralRecommender();
> >        try {
> >            recommender.start(new MongoDBDataModel());
> >        } catch (UnknownHostException e) {
> >            // TODO Auto-generated catch block
> >            e.printStackTrace();
> >        } catch (MongoException e) {
> >            // TODO Auto-generated catch block
> >            e.printStackTrace();
> >        }
> >
> >        try {
> >            ArrayList<ArrayList<String>> items =
> > recommender.recommend(userIDString, null, true);
> >            items.size();
> >        } catch (NullPointerException e) {
> >            // TODO Auto-generated catch block
> >            e.printStackTrace();
> >        } catch (NoSuchUserException e) {
> >            // TODO Auto-generated catch block
> >            e.printStackTrace();
> >        } catch (NoSuchItemException e) {
> >            // TODO Auto-generated catch block
> >            e.printStackTrace();
> >        } catch (IllegalArgumentException e) {
> >            // TODO Auto-generated catch block
> >            e.printStackTrace();
> >        }
> >
> >
> > From what I can tell the error seems to be correct, since it does check
> for
> > the passed items, however examples of it's usage all have items = null,
> so
> > I'm confused a bit, should I or should not pass null for items ?
> >
> > Thank you in advance.
> >
>

Reply via email to