0

I have created a sample project with an SQL adapter and a hybrid worklight application. The application is a simple login form that accept userid and password and validate them against the value stored in database using the SQL adapter.

Now when I tested this application on the default worklight server installed in eclispe plugin for worklight it is working fine.

But when I install the SQL adapter and worklight application on an enterprise worklight server and testing it, I am getting the following error:

NetworkError: 404 Not Found - http://[localhost:9080]/apps/services/api/SampleHybrid/common/query

The above error I fetched through Firebug.

SampleHybrid is the name of the worklight hybrid application. SampleHybridAdapter is the name of the SQL adapter.

The server’s response is:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>CWWKT0018E: The application or context root for this request has not been found: &#047;apps&#047;services&#047;api&#047;SampleHybrid&#047;common&#047;query</p><h‌​r /><address>WebSphere Application Server at 127.0.0.1 port 9080</address></body></html>
Ry-
  • 218,210
  • 55
  • 464
  • 476

1 Answers1

2

You mentioned you have moved to running Worklight on an application server - this requires using a context root. I do not see a context root in the 404 error you have provided.

The request to the server was supposed to look like this: http://[localhost:9080]/yourContext/apps/services/api/SampleHybrid/common/query Because the context root (in this case, "yourContext") is missing, you get a 404 error, since the application is trying to reach a location that does not exist.

The context root value is set in both application-descriptor.xml and worklight.properties.

yourProject\apps\yourApp\application-descriptor.xml

  • Change the value of the worklightServerRootURL property to include your context root. It should look like this http://your-host-name-here:port/yourContext

yourProject\apps\server\conf\worklight.properties

  • Set your context root as the value for the publicWorkLightContext property (also make sure to uncomment it)

After doing the above, you need to re-deploy the .war file to your application server. The .war file can be found in the bin folder of your Worklight project.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89