Stream: hapi
Topic: Basic install question
Rik Smithies (Apr 20 2019 at 17:47):
Trying to build a Windows HAPI server. Followed http://hapifhir.io/doc_jpa.html
I have a HAPI server running in Tomcat but /metadata is not working (and neither is any other resource).
What am I missing?
What I've done:
Downloaded from https://github.com/hapifhir/hapi-fhir-jpaserver-starter
mvn install, then compiled: mvn clean install
Put the .war into Tomcat
I go here http://localhost:8080/hapi-fhir-jpaserver/
and it shows me a page, and says that FHIR base is http://localhost:8080/fhir/
So it seems to be running.
But when I try to get http://localhost:8080/fhir/metadata it's a 404.
Any post e.g. to http://localhost:8080/fhir/Patient fails 404.
I think I am using the default derby data store.
I am unclear whether I have to add data somewhere.
Any help appreciated!
Patrick Werner (Apr 20 2019 at 18:48):
Hi Rik,
just tried to reproduce and i couldn't. I run the current master, both as war and with mvn jetty:run
.
Are you sure you tried http://localhost:8080
and didn't forget the port? How is you catalina.out looking? Should be errors there.
Rik Smithies (Apr 21 2019 at 12:26):
hi @Patrick Werner thanks - help is appreciated. I've had no luck in Jetty or Tomcat. Tried 2 machines.
I tried with jetty first but it gives a whole load of errors - thousands, which take several minutes to go by on the console.
e.g. "scanned from multiple locations"
([WARNING] javax.activation.DataSource scanned from multiple locations:
[jar:...C:/Users/micro/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar!/javax/activation/DataSource.class,
jar:...C:/Users/micro/.m2/repository/com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.jar!/javax/activation/DataSource.class])
(Tried to debug that, no clear answer via google. I tried to remove one set of files, suspecting a clash. But it just downloads them again…)
Then at the end of all the messages it seems to have started, but I get:
http://localhost:8080/fhir/metadata
HTTP ERROR 503
Problem accessing /fhir/metadata. Reason:
Service Unavailable
Powered by Jetty:// 9.4.8.v20180619
So switched to Tomcat - yes definitely using the port.
here I see Tomcat: http://localhost:8080/
here I see Tomcat manager: http://localhost:8080/manager/html
which shows /hapi-fhir-jpaserver as one of the applications and it says "Running - true"
That links to http://localhost:8080/hapi-fhir-jpaserver/
But there is says:
"Warning!
Failed to load conformance statement, error was: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404"
and
FHIR Base http://localhost:8080/fhir/
There is also the blue Conformance button
clicking that gives a formatted page and "Response HTTP 404"
Going to http://localhost:8080/fhir/metadata says 404
Logs seem ok (thanks for tip there).
Re-starting Tomcats gives this in catalina.2019-04-21.log:
21-Apr-2019 12:57:19.880 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.19
21-Apr-2019 12:57:19.883 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Apr 12 2019 14:22:48 UTC
21-Apr-2019 12:57:19.883 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.19.0
21-Apr-2019 12:57:19.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
21-Apr-2019 12:57:19.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
21-Apr-2019 12:57:19.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
21-Apr-2019 12:57:19.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jre1.8.0_201
21-Apr-2019 12:57:19.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_201-b09
21-Apr-2019 12:57:19.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Program Files\Apache Software Foundation\Tomcat 9.0
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 9.0
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging.properties
21-Apr-2019 12:57:19.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
21-Apr-2019 12:57:19.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: abort
21-Apr-2019 12:57:19.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
21-Apr-2019 12:57:19.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
21-Apr-2019 12:57:19.888 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\TortoiseGit\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;D:\winbin\maven\apache-maven-3.6.1\bin;C:\Users\micro\AppData\Local\Microsoft\WindowsApps;C:\Users\micro\.dotnet\tools;.]
21-Apr-2019 12:57:20.007 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
21-Apr-2019 12:57:20.145 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
21-Apr-2019 12:57:20.148 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [661] milliseconds
21-Apr-2019 12:57:20.178 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
21-Apr-2019 12:57:20.178 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.19]
21-Apr-2019 12:57:20.193 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\hapi-fhir-jpaserver.war]
21-Apr-2019 12:57:26.990 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
21-Apr-2019 12:57:42.745 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\hapi-fhir-jpaserver.war] has finished in [22,551] ms
21-Apr-2019 12:57:42.745 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\docs]
21-Apr-2019 12:57:42.771 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\docs] has finished in [26] ms
21-Apr-2019 12:57:42.771 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\manager]
21-Apr-2019 12:57:42.811 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\manager] has finished in [39] ms
21-Apr-2019 12:57:42.811 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT]
21-Apr-2019 12:57:42.829 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT] has finished in [18] ms
21-Apr-2019 12:57:42.834 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
21-Apr-2019 12:57:42.845 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
21-Apr-2019 12:57:42.848 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [22,699] milliseconds
Rob Hausam (Apr 22 2019 at 16:17):
Hi, Rik. I have my HAPI server running on Linux and deployed in Tomcat. I haven't tried to set one up on Windows, so I'm not sure about specific issues there may be with that. But I could try to help you work through some of it.
Rik Smithies (Apr 22 2019 at 19:33):
Thanks Rob! I may end up using Linux then, eventually. But I would like to try to get this Windows install working. I am wondering how HAPI gets its data, and how I can check that the default Derby database is running properly. Does it need to be loaded with a CapabilityStatement resource for instance, or is that hard coded somehow?
Kevin Mayfield (Apr 23 2019 at 11:40):
Sounds like your server isn't running. Check your tomcat log files (mine is located C:\Program Files\Apache Software Foundation\Tomcat 9.0\logs)
Kevin Mayfield (Apr 23 2019 at 11:42):
the tomcat9-stdout*.log should give you details.
I'd be tempted to look at postgres or mysql as the database, they have better UI tools for looking at the data.
Kevin Mayfield (Apr 23 2019 at 11:44):
To use you need to add in the relevant JDBC and dialect settings in the FhirServerConfig class (and create a db+user in mysql or postgreSql).
Kevin Mayfield (Apr 23 2019 at 11:48):
The CapabilityStatement is built from the providers it has. The JPA Demo uses a lot of optimisation so it's not clear to see what they are.... The UK CareConnect demo server shows some of these in a more raw format: e.g. for Patient https://github.com/nhsconnect/careconnect-reference-implementation/blob/master/ccri-fhirserver/src/main/java/uk/nhs/careconnect/ccri/fhirserver/provider/PatientProvider.java
It's annotations such as @Validate @Search etc show it supports these methods/operations
Kevin Mayfield (Apr 23 2019 at 11:49):
and these get reflected in the CapabilityStatement
Patrick Werner (Apr 23 2019 at 12:59):
hey @Rik Smithies i had to look into a similar issue today an had to set up a fresh server anyway (linux).
I'm pretty sure you are running into this issue: Caused by: ERROR XBM0H: Directory /var/lib/tomcat9/target/jpaserver_derby_files cannot be created.
To fix this you have to create the target folder by hand.
Patrick Werner (Apr 23 2019 at 13:01):
i mislead you in my last post: the errors are actually under the localhost config, not catalina.out
Rik Smithies (Apr 23 2019 at 13:02):
Hi Patrick thanks. My issue is on Windows. There is an equivalent folder C:\Program Files\Apache Software Foundation\Tomcat 9.0\target\jpaserver_derby_files. That does exist
Rik Smithies (Apr 23 2019 at 13:04):
localhost log seems clear (other than the 404 errors that is):
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:08 +0100] "GET /manager/html HTTP/1.1" 401 2562
0:0:0:0:0:0:0:1 - tomcatadmin [23/Apr/2019:14:03:10 +0100] "GET /manager/html HTTP/1.1" 200 19829
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:10 +0100] "GET /manager/images/asf-logo.svg HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:10 +0100] "GET /manager/images/tomcat.gif HTTP/1.1" 304 -
127.0.0.1 - - [23/Apr/2019:14:03:13 +0100] "GET /fhir/metadata HTTP/1.1" 404 1091
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:14 +0100] "GET /hapi-fhir-jpaserver/ HTTP/1.1" 200 16118
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:14 +0100] "GET /hapi-fhir-jpaserver/js/moment-with-locales.min.js HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:14 +0100] "GET /hapi-fhir-jpaserver/img/sample-logo.jpg HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:17 +0100] "GET /fhir/ HTTP/1.1" 404 1083
127.0.0.1 - - [23/Apr/2019:14:03:23 +0100] "GET /fhir/metadata HTTP/1.1" 404 1091
127.0.0.1 - - [23/Apr/2019:14:03:23 +0100] "GET /fhir/metadata HTTP/1.1" 404 1091
0:0:0:0:0:0:0:1 - - [23/Apr/2019:14:03:23 +0100] "GET /hapi-fhir-jpaserver/conformance?serverId=home HTTP/1.1" 200 15725
Kevin Mayfield (Apr 23 2019 at 13:06):
I think your base is http://localhost:8080/hapi-fhir-jpaserver/fhir/ conformance http://localhost:8080/hapi-fhir-jpaserver/fhir/metadata
Rik Smithies (Apr 23 2019 at 13:10):
Kevin - that seems to be the answer!
Rik Smithies (Apr 23 2019 at 13:11):
It is strange because that is not what my FHIR homepage says
Rik Smithies (Apr 23 2019 at 13:12):
When I go here:
http://localhost:8085/hapi-fhir-jpaserver/conformance?serverId=home
it shows the FHIR logo and says to go to
http://localhost:8080/fhir/metadata
Kevin Mayfield (Apr 23 2019 at 13:12):
Ah good.... I just looked through the code and thought this was more accurate http://localhost:8080/hapi-fhir-jpaserver/baseDstu3
Rik Smithies (Apr 23 2019 at 13:12):
it doesn't seem to need the baseDstu3 part
Kevin Mayfield (Apr 23 2019 at 13:15):
odd. That's in the default web.xml, not sure why the UI is showing this wrong also. That's hard coded to baseDstu3 (in here https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/FhirTesterConfig.java)
Kevin Mayfield (Apr 23 2019 at 13:16):
You are using this project? https://github.com/jamesagnew/hapi-fhir/tree/master/hapi-fhir-jpaserver-example
Rik Smithies (Apr 23 2019 at 13:16):
I am using this: https://github.com/hapifhir/hapi-fhir-jpaserver-starter
Rik Smithies (Apr 23 2019 at 13:17):
When I go to your link (where I started) it says it is no longer supported
Kevin Mayfield (Apr 23 2019 at 13:19):
Just noticed :)
Kevin Mayfield (Apr 23 2019 at 13:20):
and that explains why I couldn't find the r5 convertors @Grahame Grieve mentioned.
Rik Smithies (Apr 23 2019 at 13:20):
:-)
Patrick Werner (Apr 23 2019 at 13:29):
glad you resolved the error, not a good default behaviour of the server
Kevin Mayfield (Apr 23 2019 at 13:33):
The older version used to get the server address but now it's using a properties file (https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/hapi.properties)
Rob Hausam (Apr 23 2019 at 19:51):
glad you have it working - there wasn't hapi-fhir-jpaserver-starter when I started with it, so I haven't actually tried that one
Grahame Grieve (Apr 23 2019 at 20:43):
why I couldn't find the r5 convertors @Grahame Grieve mentioned.
Have you found them now?
Last updated: Apr 12 2022 at 19:14 UTC