[ 
https://issues.apache.org/jira/browse/NUTCH-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14978824#comment-14978824
 ] 

Aron Ahmadia commented on NUTCH-2154:
-------------------------------------

Looks like it's assumed that "args" is passed in to the REST query, even though 
it's for optional arguments.  

In [3]: cc.jobClient.stats()
nutch.py: POST Endpoint: /db/crawldb
nutch.py: POST Request data: {'args': {}, 'type': 'stats', 'crawlId': 
'crawl_aahmadia_2015-10-28T13_27_31.807902', 'confId': 'default'}
nutch.py: POST Request headers: {'Accept': 'application/json'}
nutch.py: Response headers: {'Date': 'Wed, 28 Oct 2015 17:27:36 GMT', 
'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json', 'Server': 
'Jetty(8.1.15.v20140411)'}
nutch.py: Response status: 200
nutch.py: Response JSON: {u'status': {u'1': {u'count': u'2', u'statusValue': 
u'db_unfetched'}}, u'retry 0': u'2', u'avgScore': u'1.0', u'totalUrls': u'2', 
u'minScore': u'1.0', u'maxScore': u'1.0'}
Out[3]:
{u'avgScore': u'1.0',
 u'maxScore': u'1.0',
 u'minScore': u'1.0',
 u'retry 0': u'2',
 u'status': {u'1': {u'count': u'2', u'statusValue': u'db_unfetched'}},
 u'totalUrls': u'2'}

Perhaps the right thing to do is write some protection around args being 
undefined and initialize it as an empty hash map?

> Nutch REST API (DB) suffering NullPointerException
> --------------------------------------------------
>
>                 Key: NUTCH-2154
>                 URL: https://issues.apache.org/jira/browse/NUTCH-2154
>             Project: Nutch
>          Issue Type: Bug
>          Components: REST_api
>    Affects Versions: 1.11
>            Reporter: Aron Ahmadia
>            Assignee: Chris A. Mattmann
>            Priority: Minor
>              Labels: memex
>             Fix For: 1.11
>
>
> Not sure what's causing this.  I tried this request both before and after a 
> crawl had completed.
> nutch.py: POST Endpoint: /db/crawldb
> nutch.py: POST Request data: {'type': 'stats', 'crawlId': 
> 'crawl_aahmadia_2015-10-28T13_17_15.034351', 'confId': 'default'}
> nutch.py: POST Request headers: {'Accept': 'application/json'}
> nutch.py: Response headers: {'Date': 'Wed, 28 Oct 2015 17:18:54 GMT', 
> 'Content-Length': '0', 'Server': 'Jetty(8.1.15.v20140411)'}
> nutch.py: Response status: 500
> nutch log:
> java.lang.NullPointerException
>       at org.apache.nutch.crawl.CrawlDbReader.query(CrawlDbReader.java:747)
>       at 
> org.apache.nutch.service.resources.DbResource.crawlDbStats(DbResource.java:95)
>       at 
> org.apache.nutch.service.resources.DbResource.readdb(DbResource.java:52)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:497)
>       at 
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)
>       at 
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)
>       at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
>       at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
>       at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>       at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
>       at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
>       at 
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>       at 
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)
>       at 
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)
>       at 
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
>       at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
>       at org.eclipse.jetty.server.Server.handle(Server.java:370)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
>       at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
>       at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
>       at 
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
>       at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
>       at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>       at java.lang.Thread.run(Thread.java:745)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to