Apache Web Server Java

Posted on  by admin

1. Overview

In this quick article, we'll describe the different popular servers for Java development.

2. Web vs. Application Server

About James stands for Java Apache Mail Enterprise Server! It has a modular architecture based on a rich set of modern and efficient components which provides at the end complete, stable, secure and extendable Mail Servers running on the JVM. Sep 30, 2020 Tomcat vs. Apache HTTP Server. The biggest difference between Tomcat and Apache HTTP Server is that Tomcat runs on a JVM. Apache HTTP Server - also known as the Apache web server -requires only a modern Windows, Linux distribution or Unix to run. Tomcat users will need to deploy a JDK and properly configure the JAVAHOME variable to run. In this article, we will discuss a step by step guide to setup Apache Tomcat server in Eclipse IDE. Eclipse IDE: Eclipse is an open-source Integrated Development Environment that is popular for Java application development (Java SE and Java EE) and Android apps. It also supports C/C, PHP, Python, Perl, and other web project developments via.

We're going to see what are the differences between a web and application servers and which Java EE specifications they support.

Simply put, the core difference is that application servers have full support for the Java EE spec, whereas web servers support a small subset of that functionality:

3. Apache Tomcat

One of the more popular web servers in the Java ecosystem is Apache Tomcat.

You can check the latest version of Apache Tomcat and the support Java version(s) on the project's website.

Here's a nice table with the exact specs Tomcat supports in each version.

You can also contribute to the project here.

4. Jetty

The Jetty web server is developed under the Eclipse Foundation.

Because it's so lightweight, it can be easily embedded in devices, frameworks, and application servers. Some of the products that use Jetty are Apache ActiveMQ, Eclipse, Google App Engine, Apache Hadoop and Atlassian Jira.

Naturally, the project is open-source and you can contribute to it here.

Let's now move on from web servers to application servers.

5. Apache TomEE

The Apache TomEE is a full application server built on top of the standard Apache Tomcat, and primarily supported by Tomitribe. You can check the website here for the latest version.

TomEE enables us to use some of the features of Java EE that aren't supported by Tomcat.

This application server is, as the name suggests, under the umbrella of the Apache Foundation.

You can contribute to the project here.

6. Oracle WebLogic

WebLogic 12 is also worth mentioning, as it's the primary application server offering from Oracle.

The latest release and supported Java versions can be found here.


7. WebSphere

IBM has also developed its own application server, called WebSphere. The latest release and supported Java versions can be found here.

WebSphere is not an open-source project, but it has given the WebSphere Liberty application to Eclipse – which makes some essential code of WebSphere open for developers to use and contribute to.

You can contribute to that project here.

8. WildFly

Wildfly is an open-source Java application server, developed by Red Hat.

Wildfly is gaining popularity for Java EE applications, with the latest release version to be found here.

You can also contribute to the project here.

9. Apache Geronimo

Apache Geronimo is developed by the Apache Software Foundation under the Apache license, which makes it an open-source project so we can also contribute, the same as in the previous application servers.

The latest release available can be found here.

You can contribute to the project here.

10. GlassFish

Glassfish is an open-source application server, also sponsored by Oracle. The latest release available can be found here.

You can contribute to the project here.

11. Conclusion

In this quick, list-style article, we had a very high-level look at the web and application server landscape in the Java ecosystem.

Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:


The load balancer plug-inbundled with Application Server 9.1 supports Apache Web Server 2.0.x. To useApache Web Server, you must perform certain configuration steps before andafter installing the load balancer plug-in. The load balancer plug-in installationalso makes additional modifications to the Apache Web Server. After the plug-inis installed, you must perform additional configuration steps.

Apache Web Server Tutorial

Note –

Apache 2 has multithreaded behavior if compiled with the --with-mpm=worker option.

Apache Web Server Java Application

Requirements for Using Apache Web Server

For the Apache Web Server, your installation must meet the minimum requirements.

With Apache, the load balancer plug-in requires:

  • openssl-0.9.7e (source)

  • httpd-2.0.59 (source)

  • gcc-3.3-sol9-sparc-local packages (forSolaris 9 SPARC).

  • gcc-3.3-sol9-intel-local packages (forSolaris 9 x86)

  • The pre-installed gcc (for Solaris 10)

  • flex-2.5.4a-sol9-sparc-local packages (forSolaris 9 SPARC)

  • flex-2.5.4a-sol9-intel-local packages (forSolaris 9 x86)

  • The pre-installed flex (for Solaris 10)

The software sources are available at http://www.sunfreeware.com

In addition, before compiling Apache:

  • On the Linux platform, install Sun Java System Application Server onthe same machine.

  • On the Solaris 9 operating system, use pkgadd toinstall gcc and flex. Note that pkgadd requires root access.

  • On the Solaris 9 operating system, ensure that gcc version3.3 and make are in the PATH, and flex is installed.

  • On the Solaris 10 operating system, before running make forOpenSSL, run mkheaders, located in /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3/install-tools on Solaris SPARC or /usr/local/lib/gcc-lib/i386-pc-solaris2.9/3.3/install-tools on Solaris x86.

  • If you are using gcc on Red Hat EnterpriseLinux Advanced Server 2.1, the version must be later than gcc 3.0.

Note –

To use a C compiler other than gcc, set thepath of the C compiler and make utility in the PATH environmentvariable.

Applying the Apache Web Server Patch

Before installing the load balancer plug-in for Apache, apply the patchfor the Apache Web Server issue 12355. More details about this issue are availableat http://issues.apache.org/bugzilla/show_bug.cgi?id=12355. This patch is required for the Auto Apply feature towork. To apply the patch, follow these steps.

  1. Untar http-2.0.59.tar and go to the directoryhttpd-2.0.59.

  2. Download the patch from http://issues.apache.org/bugzilla/attachment.cgi?id=16495 andsave it as a file, for example, 12355.diff.

  3. From the directory httpd-2.0.59/modules/ssl,run the following command:

Configuring Apache before Installing the Load BalancerPlug-in

The Apache source must be compiled and built to run with SSL. This sectiondescribes the minimum requirements and high-level steps needed to successfullycompile Apache Web Server to run the load balancer plug-in. These requirementsand steps only apply to the Solaris and Linux versions of the software. Forinformation on the Windows version of Apache, see the Apache web site.

Note –

The instructions included here are adapted from the instructionsat http://httpd.apache.org/docs. For detailedinstructions on installing SSL-aware Apache, please see that web site.

To Install SSL-aware Apache

Apache Web Server Windows 10

Before You Begin

You must have already downloaded and uncompressed the Apache software.

  1. Download and unpack the OpenSSL source, available at http://openssl.org.

  2. Compile and build OpenSSL.

    For full installationinstructions, see the file named INSTALL in the directorywhere you uncompressed OpenSSL. That file has information on installing OpenSSLin a user-specified location.

    For more information about OpenSSL,see the http://www.openssl.org/.

  3. Download and unpack Apache.

    Apache is available from http://httpd.apache.org.

  4. Compile and build Apache. Configure the source tree:

    1. cd http-2.0_x.

    2. Run the following command:

      ./configure --with-ssl=OpenSSL-install-path--prefix=Apache-install-path--enable-ssl --enable-so

      In the above commands, x is the Apache versionnumber, open-ssl-install-path is the absolute pathto directory where OpenSSL is installed, and Apache-install-path isthe directory in which to install Apache.

      Note that you only needto use the --enable-ssl --enable-so options if your Apache2 server will be accepting HTTPS requests.

  5. For Apache on Linux 2.1, before compiling:

    1. Open src/MakeFile and find the end of the automaticallygenerated section.

    2. Add the following lines after the first four lines after the automaticallygenerated section:

      Note that -L/opt/sun/private/lib is only requiredif you installed Application Server as part of a Java Enterprise System installation.

      For example:

    3. Set environment variable LD_LIBRARY_PATH.

      With stand–alone installations, set it to the Application Server: as-install/lib

      With Java Enterprise System installations, set itto the Application Server: as-install/lib:opt/sun/private/lib.

      If you are using Solaris 9, add /usr/local/lib tothe LD_LIBRARY_PATH.

  6. Compile Apache as described in the installation instructions forthe version you are using.

    For more information, see the http://httpd.apache.org/

    Ingeneral, the steps are:

    1. make

    2. make install

  7. Make sure Apache's ssl.conf and httpd.conf files contain the correct values for your environment.

    • In ssl.conf, for VirtualHost default:port replacethe default hostname and port with the hostname of the local system whereApache is installed and the server's port number.

      Without thischange, the load balancer will not work. On Solaris Apache may not start andon Linux, HTTPS requests may not work.

    • In ssl.conf, for ServerName www.example.com:443, replace www.example.com with the hostname ofthe local system where Apache is installed.

      Without this change,the following warning appears when you start Apache if a security certificateis installed:

      For more information on installing certificates for Apache, see To Create a Security Certificate for Apache .

    • In httpd.conf, for ServerNamewww.example.com:80, replace www.example.com withthe hostname of the local system where Apache is installed.

      Withoutthis change, you see warnings when you start Apache that the system couldnot determine the server's fully qualified domain name, and that there areoverlapping VirtualHost entries.

  8. Ensure that the Apache user has the required access permissionsto the apache-install-location/conf/ directoryand files in this directory.

    The Apache user is the UNIX userunder which the Apache server responds to requests. This user is defined inthe file httpd.conf.

    If you installed Apacheas a root user, read the note about configuring the Apache user and groupin apache-install-location/conf/httpd.conf.

    Note –

    Ensure that your configuration of users and groups meets the securityrequirements for this directory. For example, to restrict access to this directory,add the Apache user to the same user group as the owner of the directory.

    1. To ensure that the Auto Apply feature operates correctly, grantthe Apache user read access, write access, and execute access to the apache-install-location/conf/ directory.

      • If the Apache user is in the same group as the owner of this directory,change the mode to 775.

      • If the Apache user is in a different group than the owner of thisdirectory, change the mode to 777.

    2. To ensure that the load balancer plug-in is initialized when Apacheis started, grant the Apache user read access and write access to the followingfiles:

      • apache-install-location/conf/loadbalancer.xml

      • apache-install-location/conf/sun-loadbalancer_1_2.dtd

Exporting and Importing the DAS Certificate

You must manually export the DAS certificate using the following command:

This certificate will be required at the time of installing the loadbalancer plug-in.

The Application Server 9.1 installation program performs the followingtasks for you.

  • Imports the DAS certificate by copying sjsas.crt tothe apache-install-dir/conf/ssl.crt directory.

  • Appends the following lines to httpd.conf.

Modifications Made by the Load Balancer Plug-in Installer

The load balancerplug-in installation program extracts the necessary files to the modules directory in the web server’s root directory:

It adds the following entries to the web server instance’s httpd.conf file:


Configuring Apache After Installing the Load BalancerPlug-In

Apache Web Server must have the correct security files to workwith the load balancer plug-in. The load balancer depends on the NSS (NetworkSecurity Service) library, which requires these security database files. Youneed to get these security database files from Application Server, so an installationof Application Server must be available in a location accessible by the Web Server.

To configure Apache security files to work with the load balancer, dothe following:

Append /usr/lib/mps to LD_LIBRARY_PATH inthe Apache-install-dir/bin/apachectl script.

To Create a Security Certificate for Apache

These steps are required to support HTTPS requests on Apache.

For detailed information on setting up a security certificate on Apache,see the instructions on http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html and http://www.modssl.org/docs/2.8/ssl_faq.html. Thefollowing procedure is adapted from those web sites.

  1. Set up the following environment variable:


  2. Create the server certificate and key by executing the followingcommand:

    openssl req -new -x509 -keyout newreq.pem-out newreq.pem -days 365

    When asked for a commonname, give the host name on which you plan to run Apache. For all other prompts,enter values that meet any specific requirements you have.

    Thiscommand creates newreq.pem.

  3. Open the newly-created newreq.pem from thelocation where the openssl command was run.

  4. Copy the lines beginning with BEGIN CERTIFICATE and ending withEND CERTIFICATE and paste them in Apache-install-dir/conf/ssl.crt/server.crt. For example:

  5. Copy the lines beginning with BEGIN RSA PRIVATE KEY and END RSAPRIVATE KEY and paste them in Apache-install-dir/conf/ssl.key/server.key. For example:

  6. Make sure that the variables SSLCertificateKeyFileand SSLCertificateFile in Apache-install-dir/conf/ssl.conf have the correct values.

  7. Ensure that the ServerName is not www.example.com. The ServerNameshould be the actual host name where Apache will run, matching the CommonName you entered when creating the server certificate and key.

Modifying httpd.conf parameters to enable stickyround robin

For the sticky round robin feature to work, in the httpd.conf file,under the section prefork MPM, ensure that the values ofthe parameters StartServers and maxclients areset to 1. Otherwise, every new session request will spawn a new Apache processand the load balancer plug-in will be initialized resulting in requests landingin the same instance.

Starting Apache on Solaris and Linux

Apache Web Server

In general, you should start Apache with the same user that installedthe Application Server. You must start Apache as root under the following circumstances:

  • If you are a Java Enterprise System user.

  • If you've used port numbers which are less than 1024.

  • If Apache runs as a different user from the user that startsit.

To start Apache in SSL mode, use one of the following commands:

Apache Web Server Download

apachetl startssl or apachetl -k start-DSSL

Apache Web Server Java Code

If needed, check the Apache web site for the latest information on startingthe Apache server.

Verifying the Setup

  1. Install the load balancer plug-in. For detailed steps to installthe plug-in, see Sun Java System Application Server 9.1 Installation Guide.During the installation, provide the path to the DAS certificate.

  2. Log in to the Application Server Admin Console and createa new cluster. For steps to create a new cluster, refer to the Admin ConsoleOnline Help.

  3. Create a new HTTP Load Balancer. While creating the load balancer,specify the FQDN of the web server host as the device host name, web serverSSL Port as the device port and select the cluster you created in the previousstep as the target. For detailed steps to create a new HTTP Load Balancer,refer to the Admin Console Online Help.

  4. To verify that the communication between the DAS and the webserver is working properly, in the Admin Console, navigate to the HTTP LoadBalancers node and click the HTTP Load Balancer. In the Load Balancer DeviceSettings page that appears, press the Test Connection button.

    Ifyou have not enabled the Automatically Apply Changes option while creatinga load balancer, then you must manually export the load balancer configurationby going to the Export tab and clicking Apply Changes now.

  5. If the test connection fails, be sure to check the ApplicationServer domain logs and the web server logs to troubleshoot the problem. Alsocheck if all the configuration steps have been performed correctly.