puki
puki

Reputation: 33

Deployed application in websphere it's not found when requesting it

I'm deploying a worklight http adapter that has a single method to retrieve something from DB and it's mapped to path /foo/bar/1

In websphere console i can see that the my application has started and no errors in the logs, however when i invoke the adapter from a Mobile First App, i get this json response :

{
   "errors": [
      "Runtime: Failed to parse JSON string
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /foo/bar/1 was not found on this server.</p>
<hr>
<address>IBM_HTTP_Server at my.server.edu Port XXX</address>
</body></html>"
   ],
   "info": [
   ],
   "isSuccessful": false,
   "warnings": [
   ]
}

I know the adapter is working, because it returns at least this error response. But the question is why my application is not found if i'm seeing it started in the websphere console? I have tried stopping it and starting it again and checked the deployment descriptor and looks fine.

<application id="Application_ID" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" >
 <display-name> myApp</display-name>
<module>
<web>
 <web-uri> myApp.war</web-uri>
 <context-root> foo</context-root>
 </web>
 </module>
 </application> 

After calling the adapter, in logs i can see

[Wed Jun 15 10:00:28 2016] [error] [client XX.XX.XXX.XXX] File does not exist: /opt/IBM/HTTPServer/htdocs/foo

XX.XX.XXX.XXX - - [15/Jun/2016:12:03:10 -0500] "GET /foo/bar/1 HTTP/1.1" 404 301

I have googled for info to troubleshoot but i still cannot figure out the root cause. Any help to continue troubleshooting it's appreciated.

Upvotes: 0

Views: 1661

Answers (2)

curt-miles
curt-miles

Reputation: 21

What version of 'Worklight' (or the IBM MobileFirst Platform) are you using? Given that it sounds like you are trying to invoke an adapter as a REST call, I'm assuming you're on 7.0 or later, since that is when REST support for adapters was first introduced.

You mention that you have your adapter mapped to /foo/bar/1, but note that the adapter URL follows this pattern:

http(s)://<server>:<port>/<Context>/adapters/<adapter-name>/*

where <Context> is the name of your project, and * is the name of the method in your Javascript adapter.

If you're calling your adapter from a mobile app using the WLResourceRequest client-side API, you should only need to provide the <adapter-name>/* parts and the rest will be taken care of automatically.

More info available here: http://www.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.dev.doc/devref/c_adapters_endpoint.html

Upvotes: 1

covener
covener

Reputation: 17871

The error_log entry means the WAS WebServer Plug-in (assuming it's configured in your Apache-based server) did not think it was responsible for the request to /foo.

Normally the plugin reads application context roots from plugin-cfg.xml which is generated on the applciation server. Is yours up to date on the webserver system and aware of /foo as a context root?

Upvotes: 2

Related Questions