OHDSI Home | Forums | Wiki | Github

Error when trying to access the WebAPI for testing

HI,
As part of the Atlas installation for our project I started with WebAPI installation. I was able to deploy the WebAPI.war file after which the source and source_diamon tables got created. I inserted the necessary data in to those tables and restartd the WebAPI. After this when I try to access the WebAPI using the url:
http://localhost:8080/WebAPI/source/sources (replaced the local host with our server ip), I am getting the "HTTP Status 404 - Not Found).
Not sure what I am missing. I did all the steps in the documentation.

Our OHDSI DB is PostgreSQL
Source (CDM) database is Oracle

Any help in this will be appreciated.

Thanks and Regards

Sarath Manikonda

That looks like a response trying to fetch some html doc root file instead of what you would get back if you went to an invalid path that was handled by WebAPI. Like this for example:

Do you have your tomcat instance configured to server HTML pages, and did you possibly set up a wwwroot to /WebAPI and therefore the wwwroot is handling the request instead of WebAPI? And, are you sure you have deployed your WebAPI.WAR file to tomcat? I’m guessing this is so since starting WebAPI created those tables, but it’s just a strange 404 message you get when you should get some exception thrown from WebAPI.

We deployed the .war file again and here are the errors that we are seeing. The tables are getting created, but there are other errors:

04-Mar-2019 15:40:22.170 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /apache-tomcat-8.0.53/webapps/WebAPI.war

java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Look further around in your error log. It could be that the port is already in use (which may be the case because you got what appears to be a docroot from accessing port 8080, and possibly the WebAPI is trying to start up and open a port to 8080 as well. There is a setting in pom.xml called server.port which defaults to 8080. I do not know if when you deploy your WAR file if you are maing an embedded server launch… how are you deploying your WAR file? Do you go to localhost:8080/manager to stop/start/undeploy/deploy the war file?

@smanikonda
I recently deployed the same and went through such errors.
Do the following checks:
open http://localhost:8080 -->should show the Apache Tomcat Page
Check the connection string you entered in webapi,source
Ensure the username and password entered can access the OHDSI database.
Vocabularies tables should have data in it.

May be that helps.

@ambuj,

Here are the responses:

  1. http://localhost:8080 - is showing the Apache Tomcat Page
  2. For the second one, you mentioned connection string in webapi.source - here is what I have loaded in the webapi.source table for the source: (OHDSI is on PostgreSQL and CDM is on Oracle)

1 | cdm | MY_CDM | jdbc:oracle:thin:username/pwd@DB_SERVER:1521/SID | oracle | |

  1. The username I am using does have access to the OHDSI DB and Webapi schema.

  2. I have a question on Vocab tables - is it mandatory for the Vocab tables to have data. We might get No data found or something similar when we don’t have the data, instead of erroring out, right?

Here is the settings.xml that I have been using: (The highlighted part is left unchanged, from what is provided in the documentation)

@Chris_Knoll,
tomcat is using port 8080, so when WebAPI tries to open the same port there is an issue. Also the way our sys admins deploy the wire file is: they just restart tomcat and the file is automatically depolyed.

One Q i have is: Is it Ok if I change the server.port in pom.xml to something else, say 8085?

You could try it (rember to rebuild war file if you change properties), but I’m not an expert on tomcat configuration. When I set it up for myself, I just installed tomcat, went to the default port (8080)/manager and uploaded a WAR file. I can’t remember if there were any additional configuration changes i needed.

@Ajit_Londhe, you did some of the setup of Tomcat (even with certificates) in our environment, could you provide any insight on if the WebAPI starts up with a port conflict in tomcat?

Is your Atlas also sitting on port 8080?

You can definitely change the port for WebAPI, I’ve done that on my local machine, and at Janssen, we have it set to 8443 for SSL.

@Ajit_Londhe,
That’s right. It looks like there is clash with the port 8080. I have changed the port to 8089 now. Will rebuild the .war file, deploy it and update you.
Thanks for your help.

No Luck.
I changed the port to 8089 - it did not work. And also with 8443, did not work either.
With any port other than 8080, I am getting the ‘Site Cannot be reached’ error.

One Q though:
In pom.xml, I updated the server.port as below:
<server.port>8443</server.port>

but I see there are other places where port 8080 is referred like below:
<executionengine.updateStatusCallback>http://localhost:8080/WebAPI/executionservice/callbacks/submission/{id}/status/update/{password}</executionengine.updateStatusCallback>

<executionengine.resultCallback>http://localhost:8080/WebAPI/executionservice/callbacks/submission/{id}/result/{password}</executionengine.resultCallback>

Do I need to change the port in these places also?

04-Mar-2019 15:40:22.170 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /apache-tomcat-8.0.53/webapps/WebAPI.war

java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

@smanikonda I think there will be a detailed error above or below the error. Could you show me that part?

The version of Postgresql that we are having (and is used for WebAPI DB) is:

version

PostgreSQL 9.2.24 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28), 64-bit

where as the one mentioned in the documentation is PostgewSql 9.3.

does this cause any issues in WebAPI installation?

@NEONKID

Here is the catalina.out file which I could get from our server (also, can you please check if I have missed anything in the settings.xml file, uploaded above).

Appreciate your help in this.

08Mar19_catalina_out.pdf (189.8 KB)

This is the failure:
Caused by: java.io.FileNotFoundException: /apache-tomcat-8.0.53/webapps/WebAPI/WEBINF/lib/spring-integration-core-4.3.8.RELEASE.jar (No such file or directory)

This is happening when the WAR file is deployed, based on this:
08-Mar-2019 16:00:24.856 SEVERE [localhost-startStop-2]
org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /apachetomcat-8.0.53/webapps/WebAPI.war

I’m not sure why when you compiled, you didn’t have all dependencies bundled with your .WAR file. Could you open up the .war file with winzip, and check to see that the .jar’ file is in the /lib folder?

@Chris_Knoll ,
I am sorry I did not get a chance to see your response till now.
I extracted the .WAR file to a temp folder and I could see the .jar file mentioned in the lib folder. Please see the attached screenshot.

@Chris_Knoll
I have made some changes and tried deploying the .war file again. But still not able to access the WebApi using the url:
http://:8080/WebAPI/source/sources
I am getting the same error I got earlier. “HTTP Status 404 – Not Found”
Here is the latest from the log file. Any help is greatly appreciated.

25Mar19_catalina_out.pdf (113.5 KB)

Log file says: [SELECT distinct JOB_NAME from webapi.BATCH_JOB_INSTANCE order by
JOB_NAME]; nested exception is org.postgresql.util.PSQLException: ERROR:
permission denied for relation batch_job_instance. Can you select from webapi.BATCH_JOB_INSTANCE when connected as ‘ohdsi_app_user’?

@DTorok is correct (thank you for looking into this, Don). During startup, the application polled some information from the database table, which resulted in error during startup, which caused the application to shut down (which may be why you receive a 404 from tomcat: the service isn’t online to take requests, so Tomcat replys with 404 (not found)).

Check your permissions on the tables, and carefully review the setup instructions for postgresql. It describes how you set up the user accounts and how you should create the schema before starting up WebAPI.

@DTorok, @Chris_Knoll
Yes that was the issue. I verified the permissions from command line and fixed it. Now the WebAPI part is completed.
I had one Q though:
As per my understanding, the sequence of steps are:

  1. Deploy the war file
  2. Load the source and source_daimon tables
  3. Access the URL (localhost:8080/WebAPI/source/sources) , which display the source information.

At the time of war file deployment, is there any interaction between the application (war file programs) and the data loaded to source and source_daimon tables?

Can I add more sources and source_daimons later, when I want to use data from another source, may be a new claims data or something like that.

Thanks a lot for being patient with me and helping me overcome the issues faced. I really appreciate that.

t