Редактирование: Java EE Java application servers

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

Перейти к: навигация, поиск
Внимание: Вы не представились системе. Ваш IP-адрес будет записан в историю изменений этой страницы.
Правка может быть отменена. Пожалуйста, просмотрите сравнение версий, чтобы убедиться, что это именно те изменения, которые вас интересуют, и нажмите «Записать страницу», чтобы изменения вступили в силу.
Текущая версия Ваш текст
Строка 1: Строка 1:
 +
In this part of the Java EE 5 tutorials, we will mention Java Application Servers (AS).
 +
An <b>aplication server</b> 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 ===
 +
<source lang="java">
 +
$ 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/
 +
</source>
 +
 +
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.
 +
 +
[[image: java_ee_faq_tomcat.png| center]]
 +
 +
Tomcat listens on the 8080 port by default.
 +
 +
<source lang="java">
 +
$ ./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/
 +
</source>
 +
 +
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 <b>webapps</b> 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 ===
 +
<source lang="java">
 +
./asadmin start-domain domain1
 +
</source>
 +
 +
We start the Glassfish server with the <b>asadmin</b> tool. It is located in the bin subdirectory of the Glassfish installation directory.
 +
 +
[[image: java_ee_faq_sunserver.png| center]]
 +
 +
Glassfish listens on the 8080 port by default.
 +
 +
<source lang="java">
 +
./asadmin stop-domain domain1
 +
</source>
 +
 +
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.
 +
<source lang="java">
 +
$ asadmin deploy --user=admin ~/programming/jee/form/form.war
 +
</source>
 +
 +
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 [http://www.caucho.com/download www.caucho.com/download].
 +
Unpack it to the install dir.
 +
 +
=== Starting and stopping Resin ===
 +
<source lang="java">
 +
$ ./httpd.sh start
 +
Resin/3.1.3 started -server ''.
 +
</source>
 +
 +
We go the the bin subdirectory of the Resin installation directory and launch the <b>httpd.sh</b> script with the start parameter.
 +
 +
[[image: java_ee_faq_resin.png| center]]
 +
 +
The Resin Application Server listens on the 8080 port as well. 
 +
 +
<source lang="java">
 +
$ ./httpd.sh stop
 +
Resin/3.1.3 stopped -server ''.
 +
</source>
 +
 +
This is how we stop the Resin.
 +
 +
=== Application deployment ===
 +
The deployment is very easy. We just copy the web archive to the <b>webapps</b> subdirectory.
 +
 +
[[Категория:Java]]

Пожалуйста, обратите внимание, что все ваши добавления могут быть отредактированы или удалены другими участниками. Если вы не хотите, чтобы кто-либо изменял ваши тексты, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений, или скопировали их из источника, допускающего свободное распространение и изменение своего содержимого (см. Wiki.crossplatform.ru:Авторское право). НЕ РАЗМЕЩАЙТЕ БЕЗ РАЗРЕШЕНИЯ ОХРАНЯЕМЫЕ АВТОРСКИМ ПРАВОМ МАТЕРИАЛЫ!