Java EE Java application servers

Материал из Wiki.crossplatform.ru

Версия от 09:33, 25 февраля 2009; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

In this part of the Java EE 5 tutorials, we will mention Java Application Servers (AS).

An aplication server is a server side software, that provides the business logic for the application. A Java EE AS is a server application that implements the Java EE platform APIs and provides the standard Java EE services. Java EE AS differs from traditional web server by providing components that handle JSP pages and servlets and by working with databases. The main benefit of an application server is the ease of application development.

A three tier application consists of these parts:

  • Front end
  • Business logic
  • Back end

The front end is usually a web based GUI. It displays data and provides the look and feel for the application. The business logic is the logic of the application. In the three tier layered application, the Java EE AS provides most of the business logic. The back end is a database and transaction server. (wikipedia.com, firstcup, techtarget.com)

There are several well known Java EE application servers.

  • Tomcat
  • Glassfish
  • JBoss
  • Resin
  • OC4J
  • WebLogic
  • WebSphere

When we installed the Java EE Netbeans pack, we also installed two application servers. Tomcat and Glassfish. After trying several AS, I chose Resin AS for this tutorial. This application server is very fast and easy to use.


Содержание

Tomcat

Apache Tomcat is an application server that is used in the official Reference Implementation for the Java Servlet and JavaServer Pages technologies. Tomcat is developed by the Apache Software Foundation (ASF). During the installation of the Netbeans IDE, we can choose to install Apache Tomcat AS as well. It is then integrated in the IDE.

Starting and stopping Tomcat

$ cd apache-tomcat-6.0.14/bin/
$ ./startup.sh
Using CATALINA_BASE:   /home/vronskij/bin/apache-tomcat-6.0.14
Using CATALINA_HOME:   /home/vronskij/bin/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /home/vronskij/bin/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /home/vronskij/bin/jdk1.6.0_03/

We go to the bin direcory located in the installation direcory of the Apache Tomcat AS. To start the server, we launch the startup.sh script.

center

Tomcat listens on the 8080 port by default.

$ ./shutdown.sh
Using CATALINA_BASE:   /home/vronskij/bin/apache-tomcat-6.0.14
Using CATALINA_HOME:   /home/vronskij/bin/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /home/vronskij/bin/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /home/vronskij/bin/jdk1.6.0_03/

To stop the Apache Tomcat AS, we execute the shutdown.sh script.

Application deployment

To deploy a web application, copy the web archive to the webapps subdirectory of the apache tomcat installation directory.

Glassfish

Glassfish is a free and open sourced Java Application server for the Java EE 5. The source code has been donated by Sun Microsystems from it's commercial Java System Application Server. It is now endorsed by the Sun Corporation and the Netbeans project. Glassfish can be controlled from the Netbeans IDE.

We can install Glassfish, when we install Netbeans Java EE pack.

Starting and stopping Glassfish

 ./asadmin start-domain domain1

We start the Glassfish server with the asadmin tool. It is located in the bin subdirectory of the Glassfish installation directory.

center

Glassfish listens on the 8080 port by default.

 ./asadmin stop-domain domain1

Here we show, how we stop the Glassfish server.

Web application deployment

We can deploy the web application by copying the web archive to the autodeploy subdirectory.

$ asadmin deploy --user=admin ~/programming/jee/form/form.war

This is an alternative method of deployment. Here we must also provide a password for user admin. The default password is adminadmin.

Resin

Resin is high-performance, open source Java EE Applicaiton Server. Resin is created by the Caucho Technology Corporation. The Resin is the AS used in this tutorial. I found Resin to be the fastest AS.

Installation

Installation of Resin AS might be complicated. But for educational purposes, we do not need any compilation or advanced configuring. If we want to use Resin as a standalone server, the installation process is pretty easy. We download Resin from www.caucho.com/download. Unpack it to the install dir.

Starting and stopping Resin

$ ./httpd.sh start
Resin/3.1.3 started -server ''.

We go the the bin subdirectory of the Resin installation directory and launch the httpd.sh script with the start parameter.

center

The Resin Application Server listens on the 8080 port as well.

$ ./httpd.sh stop
Resin/3.1.3 stopped -server ''.

This is how we stop the Resin.

Application deployment

The deployment is very easy. We just copy the web archive to the webapps subdirectory.