Deploying HAPI FHIR as a WAR on Tomcat or Jetty

Hospital IT teams that already run Tomcat or Jetty can deploy the HAPI FHIR JPA starter as a WAR inside infrastructure they control. This page covers when that beats the container image, how to build ROOT.war, and what to confirm before go-live.

On this page

Deploying HAPI FHIR as a WAR on Tomcat or Jetty: when your hospital runs its own application server

If your hospital already runs Tomcat, Jetty or Wildfly under change control and existing monitoring, you may want HAPI FHIR inside that estate rather than as a separate container platform. The JPA server starter can be deployed as a WAR on Tomcat, Jetty or Wildfly, alongside the other supported routes: the hapiproject/hapi Docker image, Docker Compose, Spring Boot and Kubernetes with a Helm chart. The WAR route is a packaging and hosting choice. It gives your team the application server it already knows, its deployment tooling, its log locations and its service accounts, but it does not change what the FHIR server does, how it stores data or which security controls you must add.

Before you commit, confirm the parts of the estate the WAR route depends on. Check that your application server version and Java runtime match the requirements of the HAPI FHIR release you plan to use. The HAPI FHIR versions documentation lists the JDK requirement for each release, and HAPI FHIR 8.2.0 requires JDK 17. Confirm the context path you will publish, because the WAR is normally built as ROOT.war, which serves at the root of the server, and a different context path changes the base URL that clients, links and Bundle entries use. Also confirm that the server's public address is set correctly once it sits behind your existing proxy. The starter's configuration is still driven by application.yaml or environment overrides, so the application server does not replace that work.

Plan the database and the operational controls separately from the application server. The starter defaults to an embedded H2 database, which is not a production choice, and the supported production options are PostgreSQL and Microsoft SQL Server. Your application server's connection pooling, JNDI settings and secrets handling must be aligned with the datasource the JPA server uses. Ask whether your monitoring agent can read the health endpoint and whether your change process supports replacing a WAR on a rolling basis. HAPI FHIR also states that it offers building blocks for security rather than a complete security layer, so the authentication, authorization, consent and audit interceptors remain your responsibility on any hosting route. Confirm these with your own security and clinical teams before go-live, and with your application server vendor for support terms.

When a WAR beats the container image for hospital IT

The WAR and the container image run the same HAPI FHIR JPA server, so the choice comes down to how your organization patches, approves and operates software. The four decision points below are where hospital IT teams usually feel that difference first. Work through them with your platform, security and change advisory teams before you pick a path.

Existing Tomcat or Jetty standards

If your hospital already runs Tomcat or Jetty with a patch cycle, hardening baseline and monitoring agents, a WAR fits inside that estate without a second runtime to govern. Check which servlet container version your team supports and whether it matches the Java level the HAPI FHIR release you plan to use requires. Confirm who owns security patches for the container, since the WAR inherits that cycle rather than a container image rebuild.

Required for 8.2.0
JDK 17
HAPI FHIR versions

Application server in the change process

Many hospital change processes already name an application server as the approved deployment target, and a new image pipeline may need a separate review. A WAR dropped into that server can often move through the existing change template. Ask your change advisory board whether a WAR deployment, a context path change or a restart of a shared server counts as a standard or a normal change.

Data center without container platforms

In data centers that do not run Docker or Kubernetes, the WAR avoids a new platform decision and its operating burden. Your team still needs a supported Java runtime, a PostgreSQL or Microsoft SQL Server instance, and TLS termination in front of the server. If the site later adds a container platform, the same WAR can be redeployed, but the database and proxy design will carry over unchanged.

Existing WAR deployment pipeline

If your teams already build, sign and promote WAR files through a pipeline, adding the HAPI FHIR ROOT.war as one more artifact keeps the release process familiar. Check that the pipeline can carry the configuration that the starter reads at startup, such as external application settings and database credentials, without baking secrets into the archive. Test the promotion path with a non-production database before the first go-live.

When the image or Helm chart fits better

The hapiproject/hapi image or the Kubernetes Helm chart is usually the better fit when your organization already runs a container platform, needs repeatable environments per team, or wants health probes and rolling restarts handled by the orchestrator. Choose by operating model, not feature set: both paths run the same JPA server features. Ask your platform team which path they can monitor, patch and recover on a schedule they can sustain.

Which application server and configuration route fits

This table compares Tomcat, Jetty and Wildfly as hosts for a HAPI FHIR WAR, along with the configuration routes and the settings to check before choosing. Read each row against your existing platform standards and the HAPI FHIR release you plan to pin. The main takeaway is that the host matters less than confirming the JDK, database and context path for your version before the build starts.

OptionFits whenWatch for
TomcatYour hospital IT team already runs Tomcat with standard patching, monitoring and TLS practiceConfirm the Tomcat version and JDK pairing for your pinned HAPI FHIR release
JettyYour team already standardizes on Jetty or wants a lighter servlet container to reviewConfirm the supported Jetty and servlet API versions in the release notes
WildflyYour organization already operates Wildfly as its Java application platformConfirm the Wildfly release and its Jakarta namespace support before you commit
Java runtimeEvery host must run a JDK that the chosen HAPI FHIR release supports; 8.2.0 requires JDK 17Ask for the exact JDK list for your version and align host and runtime upgrades
DatabasePostgreSQL or Microsoft SQL Server for production; the embedded H2 default is for trials onlyMySQL is not supported; set the datasource outside the WAR so it can change per environment
Environment variablesSecrets and environment-specific values are injected by the host or your deployment toolingMap each variable to its setting and test every override in staging before go-live
application.yamlYour security team wants a reviewed, versioned settings file they can inspectKeep credentials out of the file and confirm which location the host loads it from
Context pathRoot path (ROOT.war) suits a dedicated host; a named path suits a shared application serverConfirm the deployed path matches the public server address used for links and Bundle entries

How context paths change URLs, clients and the public base address

When the WAR is named ROOT.war, Tomcat and Jetty deploy the application at the root of the host, so it answers at the host address with no prefix. The FHIR endpoint then sits directly under the host name, and the server base address is the scheme, host and port plus the FHIR path. Clients need no path changes as long as the host name stays the same, which keeps client configuration simple for a single-application server.

  • Base address: Links and Bundle entries use the address you configure, such as ` (illustrative), so set the public address before the first client connects.
  • Single owner of the root: Only one application can own the root context, so any other WAR on the same server must use a named context.
  • Servlet mapping: Confirm the FHIR servlet mapping in your starter version, because the segment after the root determines where clients send requests.
  • Actuator paths: Health and metrics endpoints follow the same root, so monitoring tools must use the prefix you publish.

Check that a metadata request returns a CapabilityStatement whose links use the public base address you set, not the internal host name.

Build, deploy and verify ROOT.war on Tomcat or Jetty

This sequence takes a team from a confirmed JDK and application server pairing to a running HAPI FHIR JPA server deployed as ROOT.war, with externalized configuration, a production database and verified logs.

  1. Confirm JDK and application server versions

    The platform engineer checks the HAPI FHIR version you plan to run against the versions documentation, which states that HAPI FHIR 8.2.0 requires JDK 17, and then confirms that your Tomcat or Jetty release supports that JDK and the Servlet specification the starter targets. Record the chosen HAPI FHIR release tag from the GitHub releases page, since v8.8.2 is the latest release named in the researched facts. Confirm with the application server vendor or your internal standards team that the pairing is approved. Done when you have a written version matrix (JDK, server, HAPI FHIR tag) signed off by the owner of the server platform.

  2. Build ROOT.war from the starter

    The developer clones the hapi-fhir-jpaserver-starter repository, checks out the release tag that matches your version matrix, and runs the Maven build with the WAR packaging profile described in the project README. Pin any custom interceptors or overlays in the same repository so the build is reproducible. Confirm the output artifact name is ROOT.war in the target directory. Done when the build completes without errors and the WAR file's checksum is recorded in your artifact store.

  3. Externalize configuration and the production database

    The developer moves settings out of the packaged WAR into an external application.yaml on the server, or into environment variables the application server passes through, following the starter's configuration model. Set the datasource to PostgreSQL or Microsoft SQL Server rather than the embedded H2 default, because the starter does not support MySQL. Set the public server address and keep database credentials in your secrets store, not in the file itself. Done when the file is in a location outside the WAR, its permissions are restricted to the service account, and a dry review confirms no credentials are stored in plain text.

  4. Deploy the WAR to the webapps directory

    The server administrator stops nothing unless an existing ROOT deployment is present, then copies ROOT.war into the server's webapps directory (or the equivalent deployment directory for Jetty) and points the server at the external configuration location through its startup options. Deploying as ROOT makes the server answer at the context root, so keep a note of the path if you choose a different context name. Done when the server lists the ROOT application as deployed in its startup or deployment log without errors.

  5. Start the server and check the capability statement

    The operator starts the application server and waits for schema creation or migration to finish against the production database, which can take noticeable time on the first start. Request the metadata endpoint at the server base URL with the path /metadata, and confirm the response is a CapabilityStatement that lists the FHIR version you configured and the resource types you enabled. Done when the endpoint returns HTTP 200 with the expected FHIR version in the body.

  6. Create and read a test resource

    A test operator creates one non-patient test resource, such as a Patient with a clearly synthetic name, through a POST to the server, then reads it back by its logical ID and runs a simple search on a known parameter. Use test data only and remove it afterward, because the database is now a real store. Done when the create returns the expected 201 status with a location header, the read returns the same content, and the search result includes the resource.

  7. Confirm startup and request logs

    The operator reviews the application server logs and the HAPI FHIR startup output for errors, warnings about missing configuration, database connection failures and unexpected schema actions, and confirms the test requests appear in the access logs with the expected status codes. Record the baseline log state so later deployments can be compared against it. Done when the logs show a clean startup, no unresolved warnings about the datasource or public address, and the test requests are traceable.

How a client request reaches the JPA server inside the application server

A request starts at the EHR or other client, passes through a reverse proxy or load balancer that terminates TLS, and reaches the application server running ROOT.war. Inside that server, the HAPI FHIR JPA server applies its interceptors before it reads or writes the database. The boundary to check is between the hospital network and the database tier, because the application server holds the database credentials and is the only component that should open connections to it.

Request path from client to database, with the hospital network boundary marked.

Security controls the WAR does not provide on its own

HAPI FHIR states that it does not ship a single one-size-fits-all security layer. It offers interceptors and settings that you combine with your identity provider, your audit requirements and your application server configuration, and the operator designs how they fit together. Deploying the WAR without this design leaves gaps that the server will not close for you.

Authentication and authorization rules

Authentication is not enforced by the FHIR server by default, so every request path needs an explicit decision. The AuthorizationInterceptor lets you define which users or systems can read, write or search which resource types and compartments, but the rules must be written for your data model and tested against each FHIR operation. Confirm how your identity provider's tokens are validated and which roles map to which rules before the first clinical user signs in.

HAPI FHIR security docs

Consent and search narrowing

Consent and search narrowing interceptors restrict what a caller can see, including limiting search results to records they are permitted to access. These controls sit inside the server, so they only work if every route into the data passes through the server and the interceptors are registered in the deployed WAR. Test searches, includes and history queries separately, because a rule that covers read may not cover search results or related resources.

BALP audit logging

BALP is the Basic Audit Log Patterns approach for recording who accessed which FHIR resources and when. Enabling it is a configuration decision, but the destination, retention period and review process belong to your organization and must match your privacy and audit obligations. Confirm where audit events are written, that they cannot be altered by application users, and that they are included in your backup and log retention plans.

CORS settings for browser clients

Browser apps calling the server cross origins need CORS headers, and overly permissive settings let any website call the API with a user's session. Restrict allowed origins to the exact front-end hosts, limit allowed methods and headers to what your apps use, and review whether credentials are allowed. Check the configuration against the public address your reverse proxy presents, since mismatches cause either broken apps or open access.

Secrets kept outside the WAR

Database passwords, identity provider client secrets and keystore passwords should not be packaged inside ROOT.war or committed to configuration files in source control. Supply them through environment variables, the application server's secret mechanisms or a secrets manager that your team already operates, and restrict who can read the Tomcat or Jetty configuration files. Ask your team to document how each secret is rotated and which systems must be updated when it changes.

Application server hardening

Tomcat and Jetty ship with administrative features that the FHIR server does not need, and an exposed manager console or default ports widen the attack surface. Remove or disable unused web applications and management interfaces, restrict remaining admin access to specific networks, run the server under a non-root account, and keep the server version patched. Ask your platform team to include the application server in the same vulnerability scanning and patch cycle as the rest of your estate.

Running, patching and upgrading the WAR without surprises

The operator owns every layer under the WAR, and that ownership is the main thing to plan for. Your team patches the Tomcat or Jetty server, applies JDK updates on the host or image, and rebuilds and redeploys ROOT.war each time you move to a new HAPI FHIR version. HAPI FHIR does not patch the application server for you, and a vendor update to the application server does not change the HAPI FHIR build you deployed. Confirm the JDK version your target HAPI FHIR release requires before you schedule any change. The versions page in the HAPI FHIR documentation lists the Java requirement for each release line, and the release notes on GitHub show what changed in each build.

Schema migration runs when the new WAR starts against the existing database, so a redeploy is also a database change. Confirm in the upgrade notes whether the target version applies schema changes automatically at startup, and whether any step needs to run before the new WAR starts. Treat the first start as a write operation: it can take longer than a normal restart, and a failed migration can leave the database in a state that the old WAR cannot read. Keep the previous WAR and a tested rollback plan, and check that the database backup taken before the change can be restored within your recovery objectives.

Plan each upgrade from the release notes for every version between your current build and the target, not only the latest one. Breaking changes, configuration keys that were renamed or removed, and changes to enabled modules all affect the application.yaml you carry forward. Test the full sequence in a non-production environment that uses a recent copy of the production database, including the Tomcat or Jetty upgrade, the JDK change and the WAR swap, then run your own FHIR read, search and write checks against it. Only after those checks pass should you change production, in the same order you rehearsed.

Limits to confirm in your environment before committing to a WAR

A WAR deployment moves several platform decisions onto your team: the application server, the Java runtime and the database. Each card names one limit to confirm with the release you plan to run and your hospital's standard server image before you commit to this path.

Application server versions for the target release

The supported Tomcat and Jetty versions change with each HAPI FHIR release, so the server version you already run may not be the one the release was built and tested against. Ask for the supported application server list for your exact target version and compare it with what your platform team operates. Also confirm whether your servers are patched on a schedule that will still support that release's servlet API.

HAPI FHIR versions

JDK version required by the release

HAPI FHIR 8.2.0 requires JDK 17, and newer releases can raise that baseline. Confirm the JDK version for the release you intend to build, not the one from an older guide. A WAR built for one Java level will not run safely on a server still configured for an older one, so record the JDK in your build and deployment notes.

Standard hospital server image

Many hospitals build servers from a hardened standard image that ships a fixed JDK and application server. Check whether that image includes the JDK your release needs, whether it allows you to install a second Tomcat or Jetty instance, and whether change control will approve a different JDK for one application. If it does not, the WAR path may require a separate server build with its own patching owner.

MySQL is not supported

The JPA server starter supports PostgreSQL and Microsoft SQL Server for production, and does not support MySQL. If your hospital database standard is MySQL or MariaDB, this is a blocking decision that must be settled before the application server choice matters. Confirm the database platform with your DBA team first, since it affects the schema, backup and licensing work that follows.

JPA starter on GitHub

H2 default is not production grade

The starter defaults to an embedded H2 database, which is suitable for trials and development only. Before you deploy the WAR, you must replace it with a supported production database and confirm that the connection settings, credentials and schema migration run under your server's configuration. Ask whether your servers can reach the database over the network with the required TLS settings, and who owns those credentials.

Monitoring and health checks inside the server

Containers commonly expose health endpoints and probes that orchestrators call, but a WAR on Tomcat or Jetty sits behind a different set of tools. Confirm that your monitoring agent can reach the actuator health endpoint, that your load balancer health checks use the same path, and that the server's JMX or metrics exposure meets your security policy. Agree on which team gets paged when the application starts but the database is unavailable.

Questions hospital IT teams ask before deploying the WAR

Does deploying a WAR on Tomcat cost less than running the container image?

Not necessarily. The WAR removes a container runtime from the stack, but it does not remove work. Your team still builds ROOT.war from the starter, provisions Tomcat or Jetty, sets up a database, and runs the JVM and application server patch cycle. The license cost of HAPI FHIR is zero because it is Apache Software License 2.0 licensed, so the difference is in labor and operations. A container route usually shifts effort into image pipelines and orchestration, while the WAR route shifts it into application server administration. Ask which platform your hospital already operates well, because the cheaper option is usually the one that fits existing skills and change processes. Any quote should separate one-time build and configuration work from recurring patching, monitoring and upgrade work.

What skills does our internal team need to run HAPI FHIR as a WAR?

Your team needs Java operations experience, a working knowledge of the Tomcat or Jetty deployment model, and database administration for PostgreSQL or Microsoft SQL Server. The HAPI FHIR JPA server starter defaults to an embedded H2 database, so production configuration must point to one of the supported production databases. Someone also needs to understand FHIR well enough to review the FHIR version, enabled modules and server base URL. Plan for JDK 17 at minimum for HAPI FHIR 8.2.0, and confirm the JDK your application server image or host supports. Security engineers should own authentication, authorization and audit settings, because HAPI FHIR provides building blocks rather than a complete security layer. Map these roles to named people before the build starts.

How long does a WAR deployment take, and what drives the duration?

Duration depends on scope and environment, and no fixed figure applies to every hospital. The main drivers are the number of environments (development, test, production), the database decision and its approvals, the authentication model, the number of enabled modules, and whether an implementation guide must be loaded at startup. Change management also matters: many hospitals require security review, change tickets and clinical sign-off before a new interface reaches production. Ask any partner for a written plan that lists these milestones, the environments in scope and the acceptance tests for each. Treat the timeline as something to confirm against your own change calendar rather than a number to accept from a generic estimate.

Can our team set this up without outside help?

Yes, many teams can, provided they have the skills described above and time to test thoroughly. The HAPI FHIR documentation and the hapi-fhir-jpaserver-starter project describe the WAR option, and the starter can be built and deployed by a capable Java team. The harder parts are usually not the first deployment but the surrounding work: a production database with tuned settings, a reverse proxy that sets the public server address correctly, TLS, audit logging, backups and a documented rollback. If those pieces are new to your team, an outside partner can plan and build them as a fixed-scope engagement, with deliverables and timelines agreed in writing before work starts, then hand over runbooks so your staff can operate the server.

What happens to the WAR at each HAPI FHIR upgrade?

Each upgrade means building a new ROOT.war from the target starter version, checking the Java requirement, reviewing breaking changes, and running the database schema migration before the new application starts. Because the WAR is replaced inside the application server, rollback depends on a tested database backup taken before the migration, since a schema change may not reverse cleanly. Plan a staging run with a copy of production data, confirm that custom interceptors still compile and load, and keep the previous WAR available. Recheck the server base URL, authentication settings and enabled modules after each change. Review the upgrade notes for each version you cross and confirm the support position with the vendor or your partner before scheduling a production window.

Which parts of the WAR setup create the most risk for a hospital?

The highest-risk areas are the ones the starter leaves to you. HAPI FHIR does not provide a single security layer, so authentication, the AuthorizationInterceptor, consent and search narrowing, and BALP audit logging must be designed and tested for your data. Misconfigured database settings or an incorrect public server address can produce broken links and Bundle entries that affect downstream systems. Application server hardening, including default applications, administrative consoles and file permissions on the WAR, is also a common gap. Build a risk register early, assign an owner to each item, and test access control with real role scenarios before any clinical data is loaded.

Does the WAR route help with compliance evidence?

It can make evidence easier to collect because you control the host, the application server configuration and the logs. It does not make the system compliant on its own. HAPI FHIR is a building block, and your organization must decide how it meets privacy and security obligations, then document those controls. Auditors and certification bodies issue any formal attestation, while DeployOpen prepares systems, controls and evidence for those assessments but does not issue audit reports or certifications. Ask your compliance lead which control evidence they need, such as access reviews, change records, backup restore tests and audit log samples, and confirm those can be produced from the WAR environment.

How DeployOpen scopes and delivers a WAR deployment of HAPI FHIR

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including the application server and database a WAR deployment of HAPI FHIR runs on. The work starts with a written scope that fixes what is built, tested and handed over before any changes are made to your servers.

How we scope

  • Confirm which application server version, Java runtime and JDK your hospital IT standards allow before choosing a HAPI FHIR release.
  • Record the FHIR versions, enabled JPA modules and database engine (PostgreSQL or Microsoft SQL Server) that the WAR must support.
  • Agree in writing how the context path, TLS termination and authentication layer will be provided by your existing infrastructure.

How we build

  • Build ROOT.war from the starter with your configuration, custom interceptors and any implementation guides packaged in as agreed.
  • Deploy to a staging Tomcat or Jetty instance that mirrors production, then test FHIR endpoints, base URLs and database schema creation.
  • Verify startup behavior, memory settings and log output against the production checklist your team approves.

How we hand over

  • Deliver runbooks for deploying, redeploying and rolling back the WAR, including the exact application server configuration used.
  • Document the configuration keys, environment variables and external files your operations team owns after handover.
  • Walk your platform and security teams through the access controls, audit logging and backup points that the deployment depends on.

How we support

  • Engagements are fixed-scope, and the written scope sets the deliverables, timelines and acceptance tests before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer, which can cover new HAPI FHIR releases and application server patches.
  • Ask any partner to confirm how they handle Java and application server end-of-life dates in their upgrade plan before you sign.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.