How to resolve "Internal Server error occurred: java.lang.NullPointerException at com.tibco.plugin.json.rest.util.PathUtils.trimSlash" for REST Dispatch and Reply

How to resolve "Internal Server error occurred: java.lang.NullPointerException at com.tibco.plugin.json.rest.util.PathUtils.trimSlash" for REST Dispatch and Reply

book

Article ID: KB0082561

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON 2.0.0, 2.0.1, 2.1.0

Description

Sometimes the REST Dispatch and Reply will throw below error when handling HTTP request.

=========
Job-368 Error in [..../REST Dispatch and Reply]Internal Server error occurred: java.lang.NullPointerException    at com.tibco.plugin.json.rest.util.PathUtils.trimSlash(PathUtils.java:192)    at com.tibco.plugin.json.rest.util.PathUtils.trimSlash(PathUtils.java:164)    at com.tibco.plugin.json.rest.server.runtime.http.RESTRoutes.matchPathParams(RESTRoutes.java:141)    at com.tibco.plugin.json.rest.server.runtime.http.XiRESTRouter.routing(XiRESTRouter.java:127)    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpServlet.doMatch(XiHttpServlet.java:142)    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpServlet.service(XiHttpServlet.java:57)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpSession.open(XiHttpSession.java:102)    at com.tibco.plugin.json.rest.server.runtime.RESTApplicationImpl.openProcessSession(RESTApplicationImpl.java:260)    at com.tibco.plugin.json.rest.server.activities.RestAdapterActivity.eval(RestAdapterActivity.java:81)    at
com.tibco.pe.plugin.Activity.eval(Unknown Source)    at
com.tibco.pe.core.TaskImpl.eval(Unknown Source)    at
com.tibco.pe.core.Job.a(Unknown Source)    at
com.tibco.pe.core.Job.k(Unknown Source)    at
com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source)    at
com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)    at
com.tibco.plugin.json.rest.server.runtime.http.XiHttpSession.assignRESTException(XiHttpSession.java:158)    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpSession.open(XiHttpSession.java:110)    at com.tibco.plugin.json.rest.server.runtime.RESTApplicationImpl.openProcessSession(RESTApplicationImpl.java:260)    at com.tibco.plugin.json.rest.server.activities.RestAdapterActivity.eval(RestAdapterActivity.java:81)    at
com.tibco.pe.plugin.Activity.eval(Unknown Source)    at
com.tibco.pe.core.TaskImpl.eval(Unknown Source)    at
com.tibco.pe.core.Job.a(Unknown Source)    at
com.tibco.pe.core.Job.k(Unknown Source)    at
com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source)    at
com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)
......
=========

Issue/Introduction

How to resolve "Internal Server error occurred: java.lang.NullPointerException at com.tibco.plugin.json.rest.util.PathUtils.trimSlash" for REST Dispatch and Reply

Environment

Operation Systems: All

Resolution

This issue is due to incomplete incoming HTTP Request, for example the expected URI configured for REST Dispatch and Reply is "http://localhost:1234/test/post", if the request like "http://localhost:1234", the issue will happen.

When encountering this issue, please double check if the incoming HTTP request is complete and valid.