# Implement Flowable as servlet in a Java application

**URL:** https://forum.flowable.org/t/implement-flowable-as-servlet-in-a-java-application/11304
**Category:** Uncategorized
**Created:** [February 25, 2024, 10:29pm UTC](https://forum.flowable.org/t/implement-flowable-as-servlet-in-a-java-application/11304 "2024-02-25T22:29:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![editheast](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@editheast](https://forum.flowable.org/u/editheast)
#### Post date: [February 25, 2024, 10:29pm UTC](https://forum.flowable.org/t/implement-flowable-as-servlet-in-a-java-application/11304/1 "2024-02-25T22:29:42Z")

</div>

Hello there.  
I am curious if it would be possible, to implement Flowable as a servlet in a Java application.  
My approach is to take the Flowable-UI war file and to start it with an embedded jetty servlet in java.  
Currently my code looks like this:

Main method to start jetty:

```auto
public static void main(String[] args) throws Exception {
        Server server = new Server(8080);

        ContextHandler contextHandler = new ContextHandler();

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SECURITY);
        context.setContextPath("/");
        context.addServlet(new ServletHolder(new ApplicationServlet()), "/*");
        server.setHandler(context);

        installFlowable(server);

        // Start the server
        server.start();
        server.join();

        logger.info("Started server");
    }

```

Method to start Flowable war file:

```auto
    private static void installFlowable(Server server) throws Exception {
        File warFile = new File(
                "path-to-flowble-war-file");
        if (warFile.exists()) {
            HandlerContainer container = (HandlerContainer) server.getHandler();
            ContextHandler contextHandler = new ContextHandler(container, "");
            WebAppContext context = new WebAppContext();
            context.setContextPath("/flowable");
            context.setWar(warFile.getAbsolutePath());
            contextHandler.setHandler(context);
        }
        logger.info("flowable work servlet added");
    }

```

When I execute the code, it looks like this:  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/c/c6d539597d4f5eb3a418fb3b6f888dff03cb1fcb.png)

Does anyone knows, what I am doing wrong?

---

<div class="post-metadata">

### Author: ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)
#### Post date: [June 11, 2024, 2:58pm UTC](https://forum.flowable.org/t/implement-flowable-as-servlet-in-a-java-application/11304/2 "2024-06-11T14:58:08Z")

</div>

Hey @editheast,

Why are you doing this manually? Why not just do `java - jar flowable.war`? Flowable is a Spring Boot application, which is packaged as an executable WAR file.

Cheers,  
Filip
