Slim application server for demonstrating a web app?

I have a little pet web app project I'd like to show someone who doesn't have an application server themselves (and who has no clue about application servers).

What is the easiest and quickest way for them to get my WAR file running with zero configuration, preferably something I could send along with or bundle with the WAR file? Is there a slimmed down version of Jetty, for example? Something else?

Asked by: Michelle501 | Posted: 28-01-2022

Answer 1

You can create the slimmed down version yourself easily.

To run embedded Jetty you need only the following jars on the classpath:

* servlet-api-2.5-6.x.jar
* jetty-util-6.x.jar
* jetty-6.x.jar

/usr/local/jetty-6.1.4/lib> ls -la servlet-api-2.5-6.1.4.jar jetty-*
-rw-rw-r--  1 wwwrun admin 476213 2007-06-15 08:42 jetty-6.1.4.jar
-rw-rw-r--  1 wwwrun admin 128026 2007-06-15 08:40 jetty-util-6.1.4.jar
-rw-rw-r--  1 wwwrun admin 131977 2007-06-15 08:40 servlet-api-2.5-6.1.4.jar

Very light...

Alternatively, the Maven plugin can work as well.

Answered by: Arnold989 | Posted: 01-03-2022

Answer 2

If you're using maven, there's a jetty maven plugin that can deploy your war to an embedded instance of jetty.

But even otherwise, depending on what sort of stuff your app needs, jetty or even tomcat will do.

Answered by: Anna639 | Posted: 01-03-2022

Answer 3

If you don't know or do not want to mess with maven you could try Jetty-runner

jetty-runner.jar is one jar file that you can run from command line like so:

java -jar jetty-runner.jar my.war

Answered by: Owen210 | Posted: 01-03-2022

Answer 4

I would definitely just create an executable jar that embeds jetty and uses your war. The maven thing might be ok, but it's pretty easy to just write the single main function yourself.

Answered by: Blake505 | Posted: 01-03-2022

Similar questions

Demonstrating package names collision in java

I got this question as an assignment: Packages/Naming We have created lot of packages and defined classes and interfaces in them. We have also discussed the point we have to remember while naming them. In this assignment we will see how important naming is. Please change the package names in your previous assignment such that two packages have same name an...

java - Demonstrating problems with improperly published objects

JCIP warns us against improperly published objects (see here). If an object is mutable, the JVM might decide to publish the object before its initialization was finished. So the code class Holder {public int h = 0;public Holder(int _h) {h = _h;}} a = new Holder(10); could become effectively a = new Holder(); //...

java - Demonstrating usage of cache, with ArrayList, 2 dimensional array and basic loops

So, it's one of our labs at Computers Systems Architecture, in which we are required to illustrate the process of cache(ArrayList of string) working with main memory(2 dimensional array of int) each [i][j] of that contains 4 int elements(cyan, magenta, yellow, black) of class Color. Therefore, we must show number of hits, misses, hit/miss-ratio and total accessed arr...

java - Example demonstrating the use of ReadWriteLock

I am trying to understand the concept of ReadWriteLock and implemented the below simple example. From what I have understood, whenever a thread has a readlock, another thread can acquire the readlock. But for a thread with writelock, no other thread can acquire the write/read lock, until the other thread releases the lock. However from the output of the below...

java - Demonstrating microservices in spring and eclipse is not working

I am trying to build a proof of concept for microservices in java (eclipse) using Spring libraries and following this tutorial. Due to certain restrictions, I am not using Maven, but I rather downloaded the following jar files manually and imported them to my java project.

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)