Maven webapp

Maven webapplications are usually not executed by starting the JVM directly. Instead, an application server like Apache Tomcat is started in which webapplications are deployed. An application server provides services to operators who want to configure webapplications without rebuilding them.

Webapplications do network communication using the Hypertext Transfer Protocol (HTTP). First, update the Main class of subsection Maven basics to talk HTTP:

  1. Undo the changes of subsection Execute program by restoring the copy you made at the beginning of that subsection.

  2. Change file work/src/main/java/org/frankframework/maven/webapp/example/ to become as follows:

    package org.wearefrank.maven.webapp.example;
    import org.apache.commons.lang3.StringUtils;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Main extends HttpServlet {
        public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException, ServletException {
            PrintWriter pw = res.getWriter();
            pw.println(StringUtils.upperCase("Hello World!"));
  3. Link this servlet to the URL that should trigger it. Do so by creating file work/src/main/webapp/WEB-INF/web.xml and give it the following contents:

    <web-app xmlns=""

Next, the pom.xml is updated:

  1. Update work/pom.xml to tell Maven that a .war file should be produced. Unlike the .jar produced in the previous subsection, the .war file includes all dependencies. Update the file as shown:

  2. Add an additional dependency:


The Java compiler has to resolve the import of class javax.servlet.http.HttpServlet and some other classes. These are found in artifact javax.servlet. Therefore, this artifact is added as a dependency. The artifat does not have to be packaged in the .war however, because every application server should provide the classes of this artifact. This common feature of application servers is required by the Jakarta EE Servlet specification. It explains why there is an additional line <scope>provided</scope> in the pom.xml.

The webapplication is done. It can be executed as follows:

  1. On a command prompt in directory work, run mvn clean install. A file target/mavenWebappExample-1.0-SNAPSHOT.war should be generated.

  2. Download and unzip Apache Tomcat from These instructions were tested on January 30 2024 for Tomcat version 9.0.85. In that test, the source code was built with Java 11.

  3. Go to the root directory of the unzipped Tomcat download, for example C:\Users\martijn\temp\apache-tomcat-9.0.85.

  4. That directory has subdirectory webapps. Put your .war file inside subdirectory webapps and name it mavenWebappExample.war.

  5. The Tomcat installation directory also has a subdirectory bin. Enter that directory.

  6. Start Tomcat by running startup.bat (under Windows).

  7. Open a webbrowser with URL http://localhost:8080/mavenWebappExample/api/hello. This should produce a webpage with the text HELLO WORLD!, the output from the servlet in class The number 8080 is the port number. The URL /api/hello has been configured in web.xml by tag <url-pattern>.

The Frank!Framework is a Maven webapplication. You have a basic understanding now of what that means. Please study Frank2Example4 at now to see how to package Frank configurations inside .war files for deployment. That code can be executed using the Frank!Runner, but it also shows how to organize your files for execution in production without the Frank!Runner.