返回介绍

Java Application Servers

发布于 2025-02-22 22:20:10 字数 5905 浏览 0 评论 0 收藏 0

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 directory of the Apache Tomcat AS. To start the server, we launch the startup.sh script.

Apache Tomcat AS
Figure: Apache Tomcat AS

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, we 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 its 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.

Glassfish
Figure: Glassfish AS

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.

Resin
Figure: Resin AS

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.

In this part of the JEE tutorial, we have briefly mentioned Java application servers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文