REST Dispatch and Reply activity failing with error "Internal Server error occurred: java.lang.NullPointerException at com.tibco.plugin.json.rest.server.runtime.http.XiRESTRouter.routing"

REST Dispatch and Reply activity failing with error "Internal Server error occurred: java.lang.NullPointerException at com.tibco.plugin.json.rest.server.runtime.http.XiRESTRouter.routing"

book

Article ID: KB0076553

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON -

Description

When REST service created using REST Dispatch and Reply activity of REST and JSON Plugin is invoked using any REST API client, following error is being thrown in REST Dispatch and Reply activity:
**********************************************
<?xml version = "1.0" encoding = "UTF-8"?>
<ns0:ErrorReport xmlns:ns0 = "http://www.tibco.com/pe/EngineTypes">
    <Msg>Internal Server error occurred: java.lang.NullPointerException
    at com.tibco.plugin.json.rest.server.runtime.http.XiRESTRouter.routing(XiRESTRouter.java:192)
    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpServlet.doMatch(XiHttpServlet.java:148)
    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpServlet.service(XiHttpServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
    at com.tibco.plugin.json.rest.server.runtime.http.XiHttpSession.open(XiHttpSession.java:106)
    at com.tibco.plugin.json.rest.server.runtime.RESTApplicationImpl.openProcessSession(RESTApplicationImpl.java:276)
    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)
    </Msg>
    <MsgCode>BW-RESTJSON-3000001</MsgCode>
</ns0:ErrorReport>
**********************************************

Issue/Introduction

Sometimes REST Dispatch and Reply activity fails with error "Internal Server error occurred: java.lang.NullPointerException at com.tibco.plugin.json.rest.server.runtime.http.XiRESTRouter.routing"

Environment

ALL

Resolution

This issue is due to blank space ' ' at the end of Base URL value given for the created REST Service. For example, suppose the base url is "http://localhost:1234". Instead of this value of base url, "http://localhost:1234 " is provided then we get above mentioned error.

So to resolve the issue please make sure that there is no blank space at the end of Base URL value(which can be hardcoded/provided using Global Variable) in the problematic REST Service.