尝试从此路径获取数据时:
/maxrest/rest/mbo/taskscheduler
我能够很好地获取xml中的数据。 但是当我尝试使用此参数将其转换为JSON时:
/maxrest/rest/mbo/taskscheduler?_format=json
当我尝试转换为json时,我的日志中出现500服务器错误和空指针异常。在获取其他mbo数据(如人员,资产等)时,我已经开始工作了......但是taskcheduler mbo给了我一些问题。我想也许有一些错误的数据被返回,但是当我将其过滤掉以便从taskscheduler返回任务名字符串时,它仍然会抛出错误。所以这似乎是taskscheduler mbo的一个问题。有什么想法吗?
修改
这是stacktrace:
05 Oct 2016 15:25:10:802 [ERROR] [MXServer] [CID-MXREST-73697]
java.lang.NullPointerException
at com.ibm.tivoli.maximo.rest.MboJSONStructure.setJSONObjectAttribute(MboJSONStructure.java:601)
at com.ibm.tivoli.maximo.rest.MboJSONStructure.mbo2JSONObject(MboJSONStructure.java:491)
at com.ibm.tivoli.maximo.rest.MboJSONStructure.serializeMboSetAsJSONObject(MboJSONStructure.java:294)
at com.ibm.tivoli.maximo.rest.MboJSONStructure.serializeMboSetAsJSONObject(MboJSONStructure.java:126)
at com.ibm.tivoli.maximo.rest.MboJSONSerializer.serializeResource(MboJSONSerializer.java:76)
at com.ibm.tivoli.maximo.rest.MboSerializer.serialize(MboSerializer.java:274)
at com.ibm.tivoli.maximo.rest.BaseResourceRequestHandler.generateResponse(BaseResourceRequestHandler.java:456)
at com.ibm.tivoli.maximo.rest.BaseResourceRequestHandler.handleRequest(BaseResourceRequestHandler.java:343)
at com.ibm.tivoli.maximo.rest.MaximoRestServlet.invokeRequestHandler(MaximoRestServlet.java:783)
at com.ibm.tivoli.maximo.rest.MaximoRestServlet.doGet(MaximoRestServlet.java:336)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1114)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:940)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:643)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
05 Oct 2016 15:25:10:802 [INFO] [MXServer] [CID-MXREST-73697] Correlated data: BEGIN HttpSessionId:cGV-jEFXtHCp2ao6aqoDkL9 RequestParams:_lid=username&_lpwd=password&_format=json UserName:username ClientIP: RequestURI:/maxrest/rest/mbo/taskscheduler ElapsedTime:63 ms END
答案 0 :(得分:0)
在系统属性中,尝试将mxe.rest.mbo.defaultformat=xml
编辑为mxe.rest.mbo.defaultformat=json
。
现在,您无需添加_format=json
就可以执行请求。