This subsection describes how to replace J2EE applications by redeploying.
Redeploy is a deployment method of replacing the archive-format J2EE applications with fewer steps and a higher speed. You can use this functionality to replace J2EE applications where only the logic is changed. You can redeploy with the server management commands.
The following points describe the conditions in which redeploy can be executed:
- Conditions in which redeploy can be executed
- Only a J2EE application that does not contain runtime information is replaced. A J2EE application containing runtime information (ZIP file) cannot be redeployed.
- The configuration of the J2EE application before and after replacement must be the same. Redeployment cannot be executed if the number of EJB-JARs, resource adapters, and WARs contained in the J2EE application are different and the file names are different. Furthermore, the name of the J2EE application must also be the same.
- The method definitions and annotation values of the home interfaces (local and remote), component interfaces (local and remote), and business interfaces (local and remote) in the EJB-JAR included in the J2EE application before and after replacement must be the same.
- When the settings for inheriting only the runtime attributes are specified, the contents defined in the DD file (application.xml, ejb-jar.xml, ra.xml, and web.xml) already set up in the application development environment, must be the same.
Furthermore, 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 based on the names. This subsection also describes how to rename a J2EE application.
With redeploying, the information of a J2EE application before replacement is inherited by the replaced J2EE application. The following information is inherited:
- For Application Server version 06-70 or later
- By default, all the attributes of a J2EE application before replacement are inherited by the replaced J2EE application. If you want only the runtime attributes to be inherited as in the versions earlier than 06-70, you must specify an option and execute the cjreplaceapp command. For details on the command, see cjreplaceapp (Replacing applications) in the uCosminexus Application Server Command Reference Guide.
- For Application Server version 06-70 or earlier
- The runtime attributes# set in the property file of the J2EE application before replacement, are inherited.
- #: You can specify the DD definitions (application.xml, ejb-jar.xml, ra.xml, and web.xml) and the property file-specific definitions in the property file. The property file-specific definitions are called runtime attributes.
- Note
- If the J2EE application to be replaced contains cosminexus.xml, the Application Server-specific definition information before replacement is returned to the default value once and then the definition information of cosminexus.xml is read. If the application to be replaced does not contain cosminexus.xml, the definition information before cosminexus.xml is replaced is inherited.
When you execute redeploy, the J2EE application might be either running or stopped. When a running J2EE application is replaced, the J2EE application starts automatically after being replaced. However, the J2EE application-related objects stored in the pool and cache are destroyed. When a stopped J2EE application is replaced, the replaced J2EE application is also in the stopped state. For details on the relationship between the statuses and the redeployment of J2EE applications, see 13.7.2 Statuses and replacement of J2EE applications.
- Hint
- If a J2EE application is redeployed when the application is running, the application is stopped during the redeploy processing and is restarted after being replaced. At this time, if the execution time of the stop processing exceeds the timeout value set with the server management commands (cjreplaceapp), the J2EE application is stopped forcefully. If no timeout value is specified and if the processing exceeds the default timeout value of 60 seconds, the J2EE application is stopped forcefully. If the timeout period is further exceeded after the forced termination, the command terminates abnormally.
- Note that when a replaced J2EE application is restarted, if the execution time for the start processing exceeds the timeout value specified in the ejbserver.rmi.request.timeout key of usrconf.properties for the server management commands, the command terminates abnormally.
The format and example of execution of the replacement operation is as follows.
- Format of execution
cjreplaceapp J2EE-server-name -name J2EE-application-name -f Path-of-EAR-file-to-be-replaced |
- Example of execution
cjreplaceapp MyServer -name App1 -f App1.ear