📜 ⬆️ ⬇️

Great Java Application Server Debate with Tomcat, Jboss, GlassFish, Jetty and Liberty Profile

All good!
Well, we have another new Java Enterprise course, which means that there is something that we are happy to share with you. Please do not pay special attention to versions and dates, since the essence of this does not change much (or, if you think that changes, then we are waiting for comments).

Introduction: Let the debate begin ...

What type of Java application server should you choose for the next project? It depends on which application you are developing, what your needs are, what organization you are working in and many other factors. No debate can not do. Therefore trickle your ears and listen carefully.
')
What makes an application server an application server, Mr. Lebowski?

What constitutes an application server is a matter of many disputes due to inaccurate definitions. Wikipedia, as the undisputed source of knowledge, says the following:
Java Platform, Enterprise Edition, abbreviated Java EE (up to version 5.0 - Java 2 Enterprise Edition or J2EE) is a set of specifications and corresponding documentation for the Java language, which describes the architecture of the server platform for medium and large enterprise tasks.
Sorry, Wikipedia, but for the purposes of this article, we don’t care about pedantic descriptions and full implementation of Java EE. We care more about the needs and desires of developers.
Most developers work on web applications and abruptly use all the advanced features of the EE specification. In fact, the currently available servers with only basic functionality are the most used, as our Developer Performance Report showed:



You can find out what worries real developers, for example:



We will compare and contrast the different aspects of these servers, set ratings and allocate places based on our results. And after that you can ask the main questions: Which application server is the best? Are the needs of an employee of a large company different from the needs of an enthusiast home developer? How to evaluate what is important for different types of people? And so on…

Application servers that we will discuss include: Tomcat, Jetty, GlassFish, IBM WAS Liberty Profile, and JBoss (also known as WildFly):



First, we planned to include IBM WebSphere and Oracle WebLogic in this report based on the same criteria as for other application servers. But that would be unfair, since these servers are clearly aimed at large enterprises and applications in production, rather than lightweight development. However, we do not want to completely lose sight of them, so we will devote a separate section to them :-)

Part I: Getting Started

When you are new to a new tool, things like installation, setup, tool support, and documentation can greatly affect your experience. Part I focuses on getting started with each of the application servers.

In this section, all the listed application servers will be compared and compared, in each of the areas they can receive a maximum of 5 points in addition to our comments. And since we are completely behind the productivity of the developers, we take the Rebel as the unit of measurement:





Next, in Part II, we will reveal deeper topics like ninja, making our way under cover.

Download and install

The first contact is very important, it is he who gives an idea of ​​how the whole further experience can develop!

Jetty

Jetty weighs only 8MB! The process is simple:
  1. Download the installation package;
  2. Unpack the archive;
  3. Everything is ready to go!


Jetty has retained its simplicity and on launch: java -jar start.jar

Rating:



Reason: the smallest boot file, integration of maven dependencies, installation unpacking and good startup scripts.

Tomcat

The experience with Tomcat is almost identical to Jetty, but version 12.8 weighs a bit more.

  1. Download the installation package;
  2. Unpack the archive;
  3. Everything is ready to go!


To run Tomcat, just type: run bin / startup.sh is very easy.

Rating:



The reason: a small download file, integration of maven dependencies, installation unpacking and good startup scripts.

Jboss

JBoss AS 7.1.1.Final, released on March 9, 2012, is still the latest version of the community. The archive weighs 127MB.

  1. Download the installation package;
  2. Unpack the archive;
  3. Everything is ready to go!


RedHat made it easy to start using the bin / standalone.sh script, but not in cases where you go to start a cluster environment. In the “standalone / configuration” directory, you can find several default configuration files that allow you to enable or disable clustering, choose between the web and full EE profiles, so that everyone can choose what they need and configure it to the minimum.

Rating:



Reason: The largest download file, installation unpacking, slower, stand-alone startup scripts.

Liberty Profile

  1. Accept the license agreement;
  2. Download the installation package;
  3. Unpack the archive;
  4. Take the license agreement again - seriously?
  5. Everything is ready to go!


Despite the fact that you have to accept a license agreement twice, everything is not so bad, still, most people, without looking, click “Accept” :) Does anyone read this at all? The download file weighs only 41.1MB, which is not so bad, given its additional tools that are not in the same Tomcat or Jetty.

Rating:



Reason: adequate download file size, double acceptance of license agreement, docks needed for launch scripts :(

Glassfish

Two options are available: GlassFish Open Source Edition and Oracle GlassFish Server. We took the installation package GlassFish Server Open Source Edition and were surprised by its small size - only 53MB! The boot package is a self-extracting archive. After downloading, you need to run a large .sh “script” and, after a few steps of the graphical wizard, GlassFish is ready for use. If you are not attracted to the idea of ​​the installer, you can select the unpack installation option, which weighs about 30MB more. This method is accompanied by the experience of three familiar steps:
  1. Download the installation package;
  2. Unpack the archive;
  3. Everything is ready to go!


Rating:



Reason: There is no easy way to start the server, several installation methods, including a good decompression method, a reasonable download file size, but still too large.

Download and Install Ratings: Winning Jetty and Tomcat



Tool support

The developers are committed not only to their servers, but also to the IDE. Therefore, server support for basic IDEs is very important in order not to force developers to use unloved platforms, or to completely lose support for the tool.

For many, good integration with embedded tools can be just as important as good IDE integration, and sometimes even more important. The two main build tools we will consider are maven and ant.

Jetty

Jetty has an Eclipse WTP plugin that allows you to launch a web application directly from Eclipse. Also, check out Run Jetty Run, another Eclipse plugin.

JetBrains also has a plug-in for IntelliJ , as well as NetBeans, which can be used in conjunction with the Maven plug-in from Jetty.

Jetty's build tool integration is pretty good. There is integration with Ant and Maven, but, in general, integration can be performed with any desired tool without much effort.
You can set up a development environment similar to the one used in production. The maven plugin for Jetty allows you to configure almost everything in the pom.xml file.
In the Maven plugin for Jetty, we appreciated how tiny Jetty is. Maven does not take much time to download all the Internet.

Rating:


Reason: The Eclipse plugin for earlier versions of Jetty is not the best, basic support for server management.

Tomcat

Three major IDEs: Eclipse, IntelliJ IDEA and Netbeans have integration support for Tomcat. This means that you can import the server into the tools and deploy the projects to the server. NetBeans offers a distribution package that wraps the Tomcat image, which allows you to deploy immediately after installing NetBeans: o) Eclipse also has an additional download option that allows you to download and install Tomcat from tools, which means you don’t have to do this using a browser and import.
Tomcat is tightly integrated with Ant, and most of the documentation includes pr
imery with Ant, not Maven. But, nevertheless, integration with Maven is also not bad.

Rating:


Reason: Excellent IDE support, loading / installing via eclipse provides a positive experience.

Jboss

A project for several Eclipse plug-ins called jboss-tools includes JBoss Developer Studio, which has a server adapter for JBoss Servers and allows you to manage jboss from the IDE. IDEA offers the “JBoss Integration” closed source plugin for managing servers, and NetBeans has integration and the ability to manage application servers starting from version 7.2.1.

There is a maven plugin for managing jboss instances. Its functionality includes starting and stopping, deploying and redirecting applications, managing resources and executing commands via the jboss command line.

Rating:


Reason: Good IDE support, basic ability to change server settings, good maven support.

Liberty Profile

The Liberty Profile tools, called IBM WebSphere Application Server Developer Tools for Eclipse (the name of a product that almost needs punctuation), are supported only by the Eclipse platform. If you're a fan of IntelliJ IDEA or NetBeans - no luck. The tools make it easy to download and install the entire server and offer rich functionality for the programming models supported by the Liberty Profile. They also provide rich editing support for modifying server configurations in a style similar to the deployment descriptor, which you probably used (or at least saw). Overall, the tool is good, but only for Eclipse.

The Liberty profile also represents the Maven plugin, which allows you to perform some actions on the server — install, start, stop, create packages and server using predefined targets. Managing this is pretty easy:
mvn liberty:package-server -DserverHome=/path/to/server_home -DserverName=[server_name] -DpackageFile=/path/to/packaged server file location 


Rating:


Reason: Excellent eclipse support and flexible server configurations. Good Maven support, but not enough IDE support.

Glassfish

GlassFish offers plugins for all major IDEs. But the main problem is the dispersal of information about them. The plugin for NetBeans is immediately integrated into the IDE, which is expected given its supplier, but to install the rest, you need to search for the corresponding site. Fortunately, GlassFish Tools are available on the Eclipse Marketplace for all Eclipse users - which makes their life much easier.

IntelliJ IDEA users are also lucky, the necessary plugin is already in the IDE.

GlassFish offers fairly good plugins for Maven and Ant , which have basic functionality - deploy, redo, start and stop the server.

Rating:



Reason: Little information about where to find plugins, excellent IDE support, if you managed to find these plugins (especially for NetBeans and Eclipse).

Server configuration

Jetty

You can create your own .xml configuration file and transfer it with a startup command:
 java -jar start.jar /path/to/your-jetty-conf.xml 
.

The most impatient can run their instance with the settings of the JVM argument passed in the additional config. In addition, it is possible to transfer several configuration files to Jetty as a configuration for HTTP and HTTPS, which is very useful for exchanging config fragments within a command.

XML-based Jetty configuration - reflection-based. This means that all the parameters in XML actually correspond to the fields of the Java class.

The main disadvantage of the reflection-based (rather poorly documented) approach is an understanding of how Jetty works from the inside out. But hey - if you know your server well, you will never stumble upon anomalies, which means you won’t let the server get out of control, right?

Rating:


Reason: The ability to create a Jetty config, but you need to know the insides of Jetty, a reboot is often required, the JVM arguments for overwriting the config are a nice feature, the config is small.

Tomcat

The configuration in Tomcat is distributed in several files in the tomcat / conf directory, but for the most part is in the server.xml file. This file can be modular, allowing reuse and sharing in the development team. If you want to make a small edit, which you will probably have to cancel on the next restart of the test, the best way is to add a system property at the start of the JVM when the system properties overwrite the xml configuration.

The default configuration file is very long, but for the most part consists of lines of instruction comments. If you look at the active xml lines, it turns out that, in fact, the file is quite small.

All changes server.xml requires you to restart the server, since the configuration files are checked only at the start of the server.

Rating:


Reason: A reboot is required to change configs, distributed among several files, easy to update, good examples in the comments.

Jboss

Domain model is simple and clear, so it will be easy to recreate the setting of your dreams. Here's how one could allow ssl connections on a random port. Find the next part of standalone / configuration / standalone.xml and add a connector for “https” (the bold line in the following table).

 <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false"> <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" enable-lookups="false" secure="true"></connector> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name="example.com"/> </virtual-server> </subsystem> 


This will enable the connector, but if you also want to change the port to which https binds, change the “” element to the required value. The entire default configuration is only 15KB (300 lines) xml and is located in a predictable place. There are also large examples of configs for clustering. Changes are quite static, configuration files are read at startup and are not automatically re-read. However, the CLI command:
 [jboss-as-7.1.3.Final]$ bin/jboss-cli.sh --connect :reload 
will help resolve this issue without resorting to rebooting the server.

Rating:


Reason: One file, 300 xml lines :( Easy to configure, well-structured “subsystem” of settings, CLI overloads instead of restarting (manually), several non-standard examples.

Liberty Profile

The Liberty Profile has one configuration file called server.xml. If you wish, you can add other configuration files to this file so that the setting is logically divided or combined within the command. The default config is tiny, and the most interesting part of it is the functional manager:

 <featureManager> <feature>jsp-2.2</feature> </featureManager> 


The user can create his own application server with the features he wants to run, so only the jsp-2.2 function is initially enabled. And by the way, when changing and updating server.xml, all edits will be immediately reflected on the running server. Cool!

Rating:


Reason: High-end configuration model, dynamic update that does not require restarting, small file size, simple config.

Glassfish

Everything you need to manage and support the GlassFish server is located in the asadmin utility. With its help, you can even manage remote servers, which is good!
One thing that has worked particularly well in asadmin is scripting. Yes, it is possible to write various scripts to manage deployments and servers. These scripts can be executed inside asadmin as a simple shell script.

Real XML fans can customize everything in domain.xls:

 <network-listener port="8800" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener> 

Some configuration changes require a restart of the DAS or GlassFish server instances to take effect. Other changes are applied dynamically without restarting the DAS or the instances.

You can find out if a domain or instance is required to restart in asadmin.

 asadmin> list-domains domain1 running, restart required to apply configuration changes Command list-domains executed successfully. asadmin> list-instances pmd-i1 pmd-i1 running; requires restart Command list-instances executed successfully 

With this dynamic configuration, all changes take effect when running the DAS or instance. The following configuration changes in the interests of the developer do not require a restart:



Rating:


Reason: The config is difficult to get, it is difficult to read the xml file, asadmin is the recommended approach, but it is difficult to deal with it without docks and experience.

Documentation and community

Jetty

The Jetty team did a great job of improving and structuring the documentation. As a result, Jetty Documentation Hub is easy to write and easy to navigate. It has documents for different versions of Jetty. There are various mailing lists for developers. But, unfortunately, the official forum could not be found.

To get professional commercial support, you can contact a third-party company. But there is no list of them on the Jetty website.

Rating:


Reason: There is no list of “real experts” or companies capable of providing support.

Tomcat

Tomcat has excellent documentation (especially for new users), which is supported by a large community. The same community provides support for Tomcat: answering questions, code changes, bug fixes. Most people are satisfied with this approach, but if you want something more reliable, there are warranty service contracts in which Tomcat committers are regularly involved.

Rating:


Reason: Excellent, vibrant community. Good documentation, easy to use site, community support, third-party contracts are available for better support.

Jboss

The JBoss community is one of the best things about JBoss AS7. Everything is working smoothly and a huge number of projects are under their wing. If not all, then almost everything can be found on forums and group discussions. If nothing else helps, the answer can be found in the documentation, it is also not bad.

Rating:


Reason: Slow releases, but good docks and a large community.

Glassfish

Attempting to get through the documentation, forums, and mailing lists gives a sense of security. Active forums, a variety of mailing lists specializing in various aspects of GlassFish, tolerable documentation.

Rating:


Reason: good documentation, but inconvenient navigation, some documents are outdated, a large enough community, mailing lists, active forums.

Liberty Profile

The documentation, for the most part, is on the new community site - WASdev.net, which is launched by the development team, therefore more useful than it might seem at first glance. There you can find a traditional info-center with more formal documentation. For support, you can contact the fairly active WASdev forum, do not forget, there you can chat with the development team. This is the best support option without guarantees. If you have enough money, you can get full support from IBM, the only time that you can scream at IBM and still get help: o)

Rating:


Reason: High quality documentation and sample code, a small but rapidly growing community, fast responses on the forum, but often too formal corporate, slow editing of bugs.

THE END

The end of the first part. As always, we are waiting for your slippers and opinions in the comments or at the open door .

Source: https://habr.com/ru/post/343890/


All Articles