Publish and Host XML Data Using Tomcat – The Easy Way

Why I missed this easy solution beats me, however, as my team mate Freddy points out in his (e-mail) answer to my comment on his blog about HTTP Filtered Value Sets it is even easier to publish XML data – or any other data – on Tomcat than by creating a web application as described in my last post.

* Update *: See Publishing XML and Other Data With the WAS Liberty Profile for how to do this with the WAS Liberty Profile.


Basically what you have to do is to publish it in the folder $CATALINA_HOME/webapps/ROOT/. In the context of a Jazz Team Server that is the folder /server/tomcat/webapps/ROOT/. If you have a file test.xml you want to publish on your Tomcat server you can copy it directly into that folder or into a sub folder structure.


To publish the given file makers.xml from the last post as  https://localhost:9443/PEWEnactmentData/makers.xml, assuming a standard Jazz Tomcat deployment.

  • Create a folder PEWEnactmentData in the folder <InstallDir>/server/tomcat/webapps/ROOT/
  • Copy the file makers.xml into the newly created folder

The File is now accessible as https://localhost:9443/PEWEnactmentData/makers.xml as intended. Replace localhost with your fully qualified hostname in your deployment.

Note: Please make sure that your Folder Name does not conflict with the context root of any web application you have deployed on Tomcat.


Given this approach it is as easy to use Tomcat to maintain your data for HTTP Filtered value providers as using Apache.

This is also a good example how hard it can be to find information in the Internet. I tried to search for publishing XML on Tomcat with what I learned from Freddy, and I did not find an answer to the question really. All the discussions are around deploying applications.


Publish XML Data Using Tomcat – Hotfix for The Process Enactment Workshop

Can you publish XML files for the HTTP Filtered Value Set on Tomcat? This was a question I asked myself when working on Lab 4 of the Process Enactment Workshop. My first answer, and also response to this forum question was: No.

Dead Wrong. It is of course possible to do so. I just did not know how to do that. This post shows how you can indeed do this.

You can download a WAR File that contains the data for the Process Enactment Workshop here.

* Update *: See this post for an even easier way to publish your data on Tomcat.

* Update *: See Publishing XML and Other Data With the WAS Liberty Profile for how to do this with the WAS Liberty Profile.


I needed to provide an example for the HTTP Filtered Value Set in the workshop. Since this Value Set requires the XML published by a HTTP server, I basically saw two options: download and install Apache as described here, and place the XML document into the htdocs sub-directory for publishing. I could also use an existing example like I did not want to add the effort and time to install Apache, even if it is quite straight forward. I thought about publishing on Tomcat but digging the internet did not show an easy way to do it. So I chose to use Some days ago the inevitable happened. That web site does not provide the information I need any longer.

Available Options

Now I was again down to the two choices:

  1. Install Apache
  2. Find a solution with Tomcat.

I still did not like the Apache solution, at least for the workshop, as it adds a lot of waiting time due to the install, although I will describe it shortly below. So I decided to take a deeper look at Tomcat. I found a relatively easy solution to make it possible with Tomcat too.

Apache Solution

Download and install Apache, e.g. into the folder C:/Apache and provide a reasonable host name during the install. After the install is done, by default the sub-directory C:/Apache/htdocs is used as root for publishing. If you run C:/Apache/bin/httpd and place a document, for example makers.xml into the folder it is accessible as http://:8080/makers.xml and you are done.

Install Apache HTTP Server
Install Apache HTTP Server

You can easily maintain the documents there, update them and as long as the server is accessible use them in an HTTP Filtered Value Set.

Tomcat Solution

With Tomcat it is not quite that easy to create a solution, but if you have Tomcat already installed, once you have a solution, it is just trivial to deploy and use.

1. Install

Install The Web, XML, and Java EE Development Tools as described in the Process Enactment Workshop Lab 5, at the beginning.

Select Help>Install New Software and add an update site. I used the Helios Update Site for RTC 4.0. up to 4.0.3 vanilla zip install. Make sure to pick the right version for your Eclipse version. Select the update site. Select and install the whole package Web, XML, and Java EE Development Tools, not just JavaScript. Restart Eclipse.

I tried to use the Tomcat that comes with RTC for testing, but had issues, so I would suggest to Download a vanilla Tomcat for testing. I used the ZIP version and unpacked it into the folder C:/Apache Tomcat.

Tomcat Installed
Tomcat Installed

2. Create Dynamic Web Project

In your Eclipse RTC Client open the J2EE Perspective. Use File>New>Dynamic Web Project to create a new project.

Create Dynamic Web Project
Create Dynamic Web Project

In the wizard enter a project name. Check the default settings and create a new Target Runtime based on Tomcat v7.0 or whatever version you are using.  As Tomcat Installation Directory provide C:/Apache Tomcat or wherever you installed to. Back in the wizard should show something similar to this image.

Dynamic Web Project Wizard Step 1
Dynamic Web Project Wizard Step 1

Click Next until you reach the wizard page Web Module.

If you want to fix your context root, you can do that now. The context root is the name of the folder in which the data will later be published to the web. It is case-sensitive and you need to remember the name later. In my example my data will be published at HTTPS://:9443/PEWEnactmentData/ once I deploy on my RTC Tomcat. Make sure to choose WebContent or webcontent in the Content Directory. Check Generate web.xml deployment descriptor. See the image below as example.

Dynamic Web Project Wizard Web Module Page
Dynamic Web Project Wizard Web Module Page

Press Finish.

You have now successfully created a Dynamic Web Project, that will later be used to publish the content.  Browse the project. You are only interested in the folder WebContent.

New Web Project
New Web Project

3. Provide The Data

You now need to provide your XML data. Put the file you want to publish into the folder WebContent. To make it easier for users to locate the files I added a file index.html too. This file just has some text that points to the XML files that are hosted. The link is relative as shown in the screenshot below.

Project With Data Ready To Publish
Project With Data Ready To Publish

4. Publish And Test

Now that you are ready to publish and test, select the Project node and use the context menu to run it on your test server.

Run On Server Step 1
Run On Server

In the Wizard check that he correct runtime environment is selected and that the configuration works. Press Next and check your project is Configured to be deployed. Press Finish.

Your Server starts and after a few seconds the index page should come up like below.

Your Web Site
Your Web Site

You can click on the link in your index page to bring up your xml code. If you don’t have an Index.html, you can directly open your XML page. For example using the URL http://localhost:8080/PEWEnactmentData/makers.xml.

Now that everything works, you are ready to export the project and deploy it on your RTC Tomcat server.

5. Create A War File and Deploy

Right Click on your project again. Select Export>WAR file Enter a suitable destination folder. You can directly export into the /server/tomcat/webapps folder if you like. I chose a temporary folder. You can play around with the other options too e.g. if you want to deploy on WAS. Press Finish to run the export.

Export WAR File
Export WAR File

If you have exported to /server/tomcat/webapps you have already also deployed. If not, copy and paste your war file into /server/tomcat/webapps. If the server is running the deployment process starts right away. If not, start the server.

Once the server is up, you should be able to open your web resources using your server URL and the context root you chose. In my example https://localhost:9443/PEWEnactmentData opens the index page and https://localhost:9443/PEWEnactmentData/makers.xml opens the XML file.

Configuring the HTTP Filtered Value Set

Please be aware, that if you use HTTPS with your HTTP Filtered Value Set, you might have to check the check box to Ignore  invalid SSL certification if you did not fix your certificate.


I hope I could show that it is easily possible to store your XML files required for access from an HTTP Filtered Value Set. I have to go now and fix the Process Enactment Workshop.