Java – Best Way to Deliver and Deploy JEE Applications to Clients

dockerjavajava-eespring

I've worked for a few companies and even developed projects on my own – these projects were based on Java Enterprise Edition. Sometimes with Spring Framework involved, sometimes it was a pure JEE. However, building Java-based applications has one major flaw for me – too many heterogenous environments.

  1. Different applications servers. Each with its own different set of problems and bugs.
  2. Different clients have different JDK. It should be easy operation for administrator to swap JDK. In practice, it is a pain in the ass.

This way, we're sometimes forced to base our projects on JDK 1.6 and deploy to already existing outdated application servers. Even if our clients set up the environment for us from scratch, installing newest JDK and a decent AS like WildFly, it may be deprecated in months (JDK) or few years (App.Server).

And since some clients only have Tomcat or other servlet containers, Spring Framework needs to be used, leaving no choice for the future, like new Java Micro service libraries. I don't really see how this is a problem, but completely changing the environment is potentially dangerous – especially in banking sector. Everything has to be tested again and it costs money.

Therefore, I'm looking for a way to pack a Java application and present it as a black box for the client's administrators. Maybe with minimal amount of (external) configuration.

WildFly Swarm (link)
This looks promising. WildFly offers servlet-only distribution, it is therefore suitable for Spring Framework projects, if needed. In fact, it may be the best server out there right now. The resulting fat jar can be accompanied with any JDK and can be ran via some native shell script/executable file. This looks promising. External dependencies like database are not an issue usually – we don't usually have strong need for newest database servers.

I'm not sure if this supports multiple wars in one WildFly swarm.

Docker
Whole application server, java applications (wars, ears) are simply put into one Docker image. This requires docker installed, but again, docker is installed once and can be easily updated without retesting whole application ecosystem. Dockerizing has one big plus – if I want to include something like a database (Mongo), I can.

Summary

The overall idea is to have control over the environment the client has. Not to set it up now and try hard to update everything few years later. With every application upgrade, I want to simply update the JDK if I want. So I want to update my application server/servlet container. Being able to add some other programs to the bundle is a plus, but not necessary.

However, I don't have any experience with this way of application distribution.

  • Does anyone have experience with such application deployment ?
  • Is there possibly any other/better approach for Java applications ?
  • What do you use ?

Best Answer

Swarm, Spring Boot, Dropwizard - they're just microcontainers, instead of packaging your app as a war and running that in a container you are packaging the AS tooling inside your app.

There's a good comparison here: https://github.com/simundi/micro-containers