uCosminexus Application Server, Operation, Monitoring, and Linkage Guide

[Contents][Glossary][Index][Back][Next]

5.6.3 Replacing and Maintaining a J2EE Application

This subsection describes the replacing and maintaining of a J2EE application.

A J2EE application may be replaced for version upgrade and maintenance.

When replacing J2EE applications that require 24-hour service, if you use the method of replacing the J2EE applications in an online status using CTM, the J2EE application is replaced without stopping the service.

Organization of this subsection
(1) Replacing a J2EE application
(2) Replacing a J2EE application by redeploying
(3) Replacing a J2EE application by reloading
(4) J Replacing a J2EE application to be executed after pre-compiling JSPs
(5) Renaming a J2EE application

(1) Replacing a J2EE application

This subsection describes how to replace a J2EE application using server management commands. After terminating the J2EE application, replace with a new application. After replacing, restarts the J2EE application.

This subsection describes the procedure of replacing an application containing cosminexus.xml. All the information required for a J2EE application is defined in cosminexus.xml.

To replace the J2EE application:

  1. Terminate the J2EE application to be replaced.
    Execute the cjstopapp command. The execution format and example are described below.
    Execution format
     
    cjstopapp J2EE-server-name -name J2EE-application-name
     
    Execution example
    cjstopapp MyServer -name App1
  2. Delete the J2EE application.
    Execute the cjdeleteapp command. The execution format and example are described below.
    Execution format
     
    cjdeleteapp J2EE-server-name -name J2EE-application-name 
     
    Execution example
    cjdeleteapp MyServer -name App1
  3. Import the J2EE application after replacing.
    When you use server management commands, execute the cjimportapp command. The execution format and example are described below.
    Execution format
     
    cjimportapp J2EE-server-name -f EAR-file-path
     
    Execution example
    cjimportapp MyServer -f App1.ear
    Note that in the case of a WAR application, the cjimportwar command is executed.
  4. Start the J2EE application.
    When you use server management commands, execute the cjstartapp command. The execution format and example are described below.
    Execution format
     
    cjstartapp J2EE-server-name -name J2EE-application-name-
     
    Execution example
    cjstartapp MyServer -name App1
    Reference note
    For an application that contains cosminexus.xml that defines the required information, you need not to acquire and change the property file that is used after the application is imported. For the procedure of acquiring and changing the property file by using the server management commands, see 3.5 Property settings using the property files in the uCosminexus Application Server Application Setup Guide.

(2) Replacing a J2EE application by redeploying

This subsection describes how to replace J2EE applications by redeploying.

Redeploy involves minimal changes, and you can redeploy an archive-type J2EE application with fewer procedures and a high speed. You can use this functionality when switching J2EE applications where only the logic is changed. You can redeploy with server management commands.

Redeploying is possible in following conditions:

Conditions where redeploying is possible
  • Only a J2EE application that does not contain runtime information can be replaced. A J2EE application (ZIP file) containing runtime information cannot be redeployed.
  • Configuration of the J2EE application before and after replacing must be same. Redeploying is not possible if the number of EJB-JARs, resource adapters, and WARs contained in the J2EE application are different and the file names are different. The names of the J2EE applications must also be the same.
  • The method definition and annotation value of the home interface (local and remote) in an EJB-JAR, component interface (local and remote), and business interface (local and remote) contained in the J2EE application must be same before and after redeploying.
  • When a J2EE application is set by inheriting only runtime attributes, the definition contents of a DD file (application.xml, ejb-jar.xml, ra.xml, and web.xml) that are set in the application development environment needs to be same.

Moreover, when you replace a J2EE application, if you rename and save the J2EE application before replacing, you can manage the generation of the J2EE application using names. This subsection also describes how to rename a J2EE application.

In redeploying, information of a J2EE application before replacing is inherited to the J2EE application after replacing. The following information is inherited:

In the case of an Application Server of version 06-70 or later
In default settings, all the attributes of a J2EE application before replacing are inherited by the J2EE application after replacement. If you want to inherit only runtime attributes similar to version 06-70 or prior, you need to specify the option and execute the cjreplaceapp command. For details on the commands, see cjreplaceapp (Replacing applications) in the uCosminexus Application Server Command Reference Guide.

In the case of an Application Server earlier than version 06-70
The runtime attributes# set in the attribute file of a J2EE application before replacing are inherited.

#
You can set the definition of DD (application.xml, ejb-jar.xml, ra.xml, and web.xml) and independent attribute files, in the attribute file. The defining of independent property files is called runtime attributes.

When executing redeploy, the J2EE application can be either running or terminated. When a running J2EE application is replaced, the J2EE application starts automatically after replacing. However, J2EE application objects stored in the pool and cache are destroyed. When a terminated J2EE application is replaced, the J2EE application after replacing will also be terminated.

Hint
If a J2EE application is redeployed during initialization, it is terminated while redeploying and restarted after replacing. At this time, when the termination process exceeds the timeout set by server management commands (cjreplaceapp), forcefully terminate the J2EE application. If a timeout is not specified and terminating of the J2EE application exceeds 60 seconds that is the default timeout, the J2EE application is forcefully terminated. After the forced termination, if the terminating process further exceeds the timeout period, the command is ended abnormally.
Note that when a J2EE application restarts after replacing, if initialization takes more time than the timeout period specified in the ejbserver.rmi.request.timeout key of usrconf.properties for server management commands, the command is ended abnormally.

The execution format and example of replacing are described below:

Execution format
 
cjreplaceapp J2EE-server-name -name J2EE-application-name -f Path-of-application-file-to-be-exchanged
 

Execution example
cjreplaceapp MyServer -name App1 -f App1.ear
Note
When redeploying an application containing cosminexus.xml, the Application Server-specific information defined in cosminexus.xml is overwritten by the information defined in cosminexus.xml, after the application is replaced. The other information defined for the elements (such as EJB-JAR file and resource adapter) and DD configuring the J2EE application inherits the information that exists before the application is replaced.
When redeploying and replacing a WAR application, the cosminexus.xml file cannot be re-read. When changing the application properties of a WAR application, use server management commands (cjgetappprop and cjsetappprop commands).

(3) Replacing a J2EE application by reloading

This subsection describes how to replace a J2EE application by reloading.

When an application containing cosminexus.xml is reloaded, the Application Server-specific information defined in cosminexus.xml is not reloaded. For details on replacing J2EE applications containing cosminexus.xml in exploded archive format, see the procedures in 5.6.3(1) Replacing a J2EE application.

Reload is a function with which you can replace a J2EE application in exploded archive format with fewer procedures. For replacing a J2EE application using the reload function, operations like terminating and deleting an existing J2EE application, and archiving, importing, and restarting the J2EE application after replacing are not required. This function is especially effective in operations of a system where maintenance occurs frequently since you can update the J2EE application only by updating a class file and reloading the J2EE application.

Note that settings are required in advance for replacing the J2EE application by reloading. For details on the settings, see 13.8.12 Settings for detecting updates and reloading J2EE applications in the uCosminexus Application Server Common Container Functionality Guide.

You can use the server management commands (cjreloadapp command) to replace a J2EE application by reloading. For details on the cjreloadapp command, see cjreloadapp (Reloading applications) in the uCosminexus Application Server Command Reference Guide.

To reload:

  1. Edit or create a Java source file as per the contents of maintenance, and compile in a class file.
  2. Reload the J2EE application.
    Execute the cjreloadapp command. The execution format and example are described below.
    Execution format
     
    cjreloadapp J2EE-server-name -name J2EE-application-name
     
    Execution example
    cjreloadapp MyServer -name App1
    Note
    To delete an application for which an attempt to reload has failed, terminate the application and delete it after it is successfully reloaded or delete the application after restarting the J2EE server.

(4) J Replacing a J2EE application to be executed after pre-compiling JSPs

When JSPs are edited during the maintenance of a J2EE application, normally, the JSPs are compiled when the first request is received after a J2EE application is replaced. If you use the JSP pre-compile function, you can compile JSPs for the J2EE application before deployment, and can reduce the response time for the first request.

To execute the JSP pre-compile function, use server management commands or cjjspc command. This subsection describes the execution timings and methods of the JSP pre-compile function.

When a system is running, you can execute the JSP pre-compile function at the following timings:

The following section describes how to execute the JSP pre-compile function for each timing:

(a) JSP pre-compile when starting a J2EE application

Execute the JSP pre-compile function when starting a J2EE application. In this case, specify the -jspc option and execute the cjstartapp command.

The execution format and example are described below.

Execution format
 
cjstartapp server-name -name J2EE-application-name -jspc
 

Execution example
cjstartapp MyServer -name account -jspc

For details on the cjstartapp command, see cjstartapp (Starting J2EE applications) in the uCosminexus Application Server Command Reference Guide.

(b) JSP pre-compile when replacing a J2EE application by reloading

When you replace a J2EE application by reloading, execute the JSP pre-compile function before executing the cjreloadapp command. In this case, execute the cjjspc command.

The execution format and example are described below.

Execution format
 
cjjspc -root root-directory-of-Web-application
 

Execution example (In Windows)
cjjspc -root d:\app\webapp1

Execution example (In UNIX)
cjjspc -root /tmp/app/webapp1

For details on the cjjspc command, see cjjspc (JSP pre-compile) in the uCosminexus Application Server Command Reference Guide.

(c) JSP pre-compile when replacing a J2EE application by redeploying

When replacing a J2EE application by redeploying, execute the JSP pre-compile function before executing the cjreplaceapp command. In this case, execute the cjjspc command.

The execution format and example are described below.

Execution format
 
cjjspc -root root-directory-of-Web-application
 

Execution example (In Windows)
cjjspc -root d:\app\webapp1

Execution example (In UNIX)
cjjspc -root /tmp/app/webapp1

For details on the cjjspc command, see cjjspc (JSP pre-compile) in the uCosminexus Application Server Command Reference Guide.

Note
  • When you use the pre-compile function for a J2EE application to be replaced by redeploying, the JSP pre-compile function cannot be executed unless the JSP compiled results are included in the J2EE application to be replaced. When using the JSP pre-compile function even after replacing the J2EE application, execute JSP pre-compile of each Web application and set such that the JSP compiled results are included in the J2EE application to be replaced.
  • When a tag file, static included file, or TLD file is updated, compile all JSP files that reference the updated files.
  • When a JSP file or tag file is added to the application in exploded archive format that uses the JSP pre-compile function, re-execute JSP pre-compile and compile the JSP file or all JSP files that reference the tag file.
  • When a class file included in the JSP working directory of an application in exploded archive format is to be copied from the development environment and updated, copy all the class files executing JSP pre-compile from the development environment.
  • When JSP pre-compile is executed using the cjjspc command and an error occurs during the translation of JSP file or tag file, an error message is output to the console. Note that when JSP pre-compile is executed using the cjstartapp command and an error occurs during translation of JSP file or tag file, an error message is output to the servlet log.

(5) Renaming a J2EE application

When you replace a J2EE application, you can manage the J2EE application generations, if you rename and store the existing J2EE application in advance. Note that if required, you can easily return to the J2EE application before replacement.

Rename the J2EE applications using the server management commands. When a J2EE application with the same name as the name you want to rename to already exists, you cannot rename the application with that name. Names are not case-sensitive.

Note that when renaming a J2EE application, lookup name also needs to be changed. When the Enterprise Bean that uses home interface or component interface performing remote call is included in the configuration element of the J2EE application, reacquire RMI-IIOP stubs and interfaces.

Acquire RMI-IIOP stubs and interfaces using server management commands (cjgetstubsjar). You cannot acquire the same when the J2EE application has not been executed even once. Further, an error occurs while acquiring RMI-IIOP stubs and interfaces in the following cases:

To rename a J2EE application:

  1. Terminate the J2EE application to be renamed.
    Execute the server management command (cjstopapp).
  2. Rename the J2EE application.
    Execute the server management command (cjrenameapp).
    The execution format and example are described below.
    Execution format
     
    cjrenameapp J2EE-server-name -name Old-J2EE-application-name -newname New-J2EE-application-name
    Execution example
    cjrenameapp MyServer -name App1 -newname App1bak
  3. Start the J2EE application.
    Execute the server management command (cjstartapp).
  4. Acquire RMI-IIOP stubs and interfaces when home interface or component interface in Enterprise Beans contained in the J2EE application is defined such that remote invocation is executed.
    Execute the server management command (cjgetstubsjar).
    The execution format and example are described below.
    Execution format
     
    cjgetstubsjar J2EE-server-name -name New-J2EE-application-name -d Path-of-the-directory-that-stores-RMI-IIOP-stub-and-interface
     
    Execution example
    cjgetstubsjar MyServer -name App1bak -d temp
    Note
    When the Application Server is version 06-50 or prior, index.html is displayed in the Web browser, and RMI-IIOP stubs and interfaces are acquired. When the Application Server is version 06-50 or later, you can use this function only when the following conditions are fulfilled:
    • When there is a J2EE application created by an older version in the J2EE server, and Application Server of version 06-05 or later is installed
    • When rename is not executed with the cjrenameapp command
    Note that you cannot acquire RMI-IIOP stubs and interfaces with index.html in the following cases:
    • This function cannot be executed when a new J2EE application is imported in the environment of version 06-50 or later,
      and also when either the J2EE application with or without runtime information is imported.
    • When a new J2EE application is created in an environment of version 06-50 or later
    • When rename is executed using the cjrenameapp command