HTTP error 404 Not Found when using REST API
search cancel

HTTP error 404 Not Found when using REST API

book

Article ID: 19999

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

Representational State Transfer (REST) API lets application, integration, and web developers build UIs and applications for devices such as tablet computers and smartphones. Users such as analysts, employees, and customers can then use the UI or application on these devices. For example, application developers can develop a CA SDM UI that lets analysts use devices to update tickets.

The CA SDM System Administrator enables REST Web Services during the CA SDM configuration, by enabling the Configure REST Web Services option, and following the prompts. During the deploy of the REST Web Services module, any unexpected errors during the deploy may not be trapped properly.

This document shows couple of scenarios to watch out for to ensure that the deploy was successful, which in turn would prevent the HTTP error " 404 Not Found" when trying to use CA SDM REST Web Services.

Environment

CA Service Desk Manager - All Versions.

Cause

  1. Check for existence of NX_ROOT/bopcfg/www/CATALINA_BASE_REST/webapps/caisd-rest. If this directory does NOT exist, that's a very good indication that the REST deploy did not work properly.

  2. Review NX_ROOT/log/jrest.log file and look for any unexpected errors there.

    A BAD Case of a REST deploy would have errors like this:
    08/21 10:17:08.472 [main] INFO  Pdm_rest_util 566 Pdm_rest_util started. Arguments: -deploy 
    08/21 10:17:08.535 [main] INFO  Pdm_rest_util 566 Generating Java source files for all Majic factories to C:/PROGRA~2/CA/SERVIC~1\temp\REST_APP\source\ 
    08/21 10:17:09.611 [main] ERROR TCP_port 411 java.net.ConnectException: Connection refused: connect 
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    

    A GOOD case should have something like below:
    08/21 11:34:03.777 [main] INFO  Pdm_rest_util 566 Pdm_rest_util started. Arguments: -deploy 
    08/21 11:34:03.880 [main] INFO  Pdm_rest_util 566 Generating Java source files for all Majic factories to C:/PROGRA~2/CA/SERVIC~1\temp\REST_APP\source\ 
    08/21 11:34:04.086 [main] INFO  JavaCodeGeneratorImpl 215 SLUMP login as 'pdm_rest_util:SDM_HostName' succeeded! 
    08/21 11:34:04.803 [main] INFO  JavaCodeGeneratorImpl 183 Object initialization done. Successfully retrieved all Majic definitions from domsrvr. 
    08/21 11:34:20.029 [main] INFO  JavaCodeGeneratorImpl 342 Template copied: C:/PROGRA~2/CA/SERVIC~1\temp\REST_APP\source\com/ca/ServicePlus/rest/sdm/service/FileUploadUtils.java 
    08/21 11:34:20.131 [main] INFO  JavaCodeGeneratorImpl 241 Successfully disconnected from SLUMP! 
    ...
    08/21 11:36:41.670 [main] INFO  Pdm_rest_util 566 Cleaning up temp directories. 
    08/21 11:36:45.648 [main] INFO  Pdm_rest_util 566 Done.

Resolution

To FIX the errors in jrest.log you need re-deploy REST manually.

We need to use a command line CA SDM program pdm_rest_util. CA SDM normally uses this utility automatically during Configuration. This utility deploys the REST application to the dedicated REST Tomcat instance. A batch file in the NX_ROOT\bin directory (pdm_rest_util.bat for Windows or ./pdm_rest_util.sh for UNIX) lets you invoke the utility. This command has the following formats and options:

    pdm_rest_util -h | [-deploy] | [-undeploy]
    -h
    Prints command-line help.
    -deploy
        Generates, compiles, and deploys all Majic factories.
    -undeploy
        Undeploys REST Web Services on the local server.

You could follow below two steps to undeploy first and then deploy REST again.

        pdm_rest_util -undeploy
        pdm_rest_util -deploy

Review the jrest.log again to ensure the deploy this time was successful.

Now we could restart CA SDM application or restart CA SDM REST Tomcat and retest the access to REST via CA SDM Mobile Enabler and/or your custom REST application.

Note: pdm_tomcat_nxd -c stop -t REST followed by pdm_tomcat_nxd -c start -t REST would restart CA SDM REST Tomcat.

Additional Information

Please see KB Article 272478 if you had also updated Tomcat manually as well.