13.4.2 Configuration of the application directory

The application directory is the root directory of an exploded archive-format J2EE application. When you create an exploded archive-format J2EE application, you create the application directory and store the components, such as the EJB-JAR or Web applications, in the application directory. The following table describes the configuration of the application directory.

Table 13-3 Configuration of the application directory

DirectoryExplanation of the directory
Application-directoryThis is the root directory of the exploded archive-format J2EE applications. You can enter a name of your choice for the application directory.

META-INFThis directory stores the DD and cosminexus.xml of J2EE applications. The files application.xml and cosminexus.xml are stored directly beneath this directory.

EJB-JAR-directoryThis is the root directory for EJB applications.

META-INFThis directory stores the DD of the EJB-JARs. The file ejb-jar.xml is stored directly beneath this directory.

Package-nameThis directory stores the class files and property files of the EJB-JARs.
Example:
MyEJB.class
MyEJBHome.class
MyEJBRemote.class
MyResource.properties

WAR-directoryThis is the root directory for Web applications.
Note that the JSP files are stored directly beneath this directory.
Example:
index.jsp

WEB-INFThis directory stores the DD for Web applications. The file web.xml is stored directly beneath this directory.

classesThis directory stores the servlet class files and property files.
Example:
MyServlet.class

libThis directory stores the JAR files, such as the tag library.
Example:
MyTagLibrary.jar

RAR file #This is the resource adapter used in a J2EE application.

Library-directoryThis directory stores the library JAR. If the application version is Java EE 5 or later, the library JAR is stored directly beneath this directory.

#: Allocated when the resource adapter (RAR file) is included and used in a J2EE application. The RAR file is stored as an archive file. When the resource adapter is deployed as a J2EE resource adapter, the resource adapter need not be stored in the application directory.


Note the following points about the application directory:

Organization of this subsection
(1) Example of creating an application directory
(2) Changing the application directory

(1) Example of creating an application directory

The following is an example of creating an application directory.

This point describes an example configuration of an application directory when the EJB-JAR directory is subdir/converter, WAR directory is MyWebApp, and RAR file is rardir/DBConnector_DABJ_CP.rar, and an example of coding application.xml.

(2) Changing the application directory

When you change the application directory, sometimes the application directory cannot be changed or you must re-import the application after the application directory is changed, depending on the type of the target directory or file, or the operations performed. The operations required for changing the application directory are as follows.

Example:
  • Deleting or renaming the directory
    You cannot delete the application directory, EJB-JAR directory, and WAR directory. Also, you cannot change the directory name. If you delete or rename the directory, you must re-import the application.
  • Adding, changing, or deleting JAR files
    You cannot add, delete, or rename the library JAR. Even if you add a library JAR (JAR file that is not declared in application.xml), that JAR file is not read. If you rename the library JAR existing when you imported the application or if you delete the library JAR, you must re-import the application.
    You can add, change, or delete a JAR file with the WAR directory/ WEB-INF/lib directory.
  • Changing the DD
    Even if the user changes the DD existing in the application directory, the J2EE server does not detect the change. To change the DD definition, change the definition in the development environment and then re-import the application or use the server management commands. You can, however, apply the updates for annotations or cosminexus.xml coded in the class file when the class file is re-read when you start the J2EE application the next time.
    Note that the configuration of the application directory is checked when the server management commands are executed.

The following table describes whether the application directory can be changed.

Table 13-4 Changing the application directory

TargetDirectory and fileOperations for the directory and fileApplication statusExplanation
StopStart
J2EE applicationApplication directoryAdd------
Change contents------
RenameRNYou cannot change the configuration of the application.
DeleteRNYou cannot change the configuration of the application.
application.xmlAdd------
Change contentsYNYou cannot compile the DD directly. Use the server management commands to update the DD definition.#1
Rename------
DeleteRN--
cosminexus.xmlAddNRY--
Change contentsNRY--
Rename------
DeleteNRY--
EJB applicationEJB-JAR directoryAddR----
Change contents------
RenameRNYou cannot change the configuration of the application.
DeleteRNYou cannot change the configuration of the application.
EJB applicationClass files configuring EJBAddNRNAfter adding a class, you must edit the attributes with the server management commands.
Change contentsNRNWhen the method information is coded in the DD (container-transaction and method-permission), you must perform the modifications in sync with the DD information.
RenameRNIf you try to change the class file name without changing the class file contents, an error occurs during the next class loader.
DeleteNRNAfter deleting a class, you must edit the attributes with the server management commands.
Other class filesAddNRN--
Change contentsNRN--
RenameRNIf you try to change the class file name without changing the class file contents, an error occurs during the next class loader.
DeleteNRN--
EJB applicationejb-jar.xmlAdd------
Change contentsYNYou cannot compile the DD directly. Use the server management commands to update the DD definition.#1
Rename------
DeleteRN--
Web applicationWAR directoryAddR----
Change contents------
RenameRNYou cannot change the configuration of the application.
DeleteRNYou cannot change the configuration of the application.
Class files and property files under WEB-INF/classesAddNRN--
Change contentsNRN--
Rename----If you try to change the class file name without changing the class file contents, an error occurs during the next class loader.
DeleteNRN--
JAR files under WEB-INF/libAddNRN--
Change contentsNRN--
RenameNRN--
DeleteNRN--
web.xmlAdd------
Change contentsYNYou cannot compile the DD directly. Use the server management commands to update the DD definition.#1
Rename------
DeleteRN--
Web applicationJSP files,
Tag files,
Static content (such as HTML and JavaScript),
files on which the JSP files or tag files depend #2,
JSP compilation results
AddNRN--
Change contentsNRN--
Rename------
DeleteNRN--
LibraryLibrary JARAddRNYou cannot change the configuration of the application. The library JAR is ignored even if added.
Change contentsNRN--
RenameRNYou cannot change the configuration of the application.
DeleteRNYou cannot change the configuration of the application.
Reference libraryAddNRNChange the definition using the server management command (cjsetappprop).
Change contentsNRN--
Rename----Change the definition using the server management command (cjsetappprop). You cannot rename while the reference library is open.
DeleteYNChange the definition using the server management command (cjsetappprop). You cannot delete the definition while the reference library is open.
LibraryDirectory of reference librariesAddNRN--
Change contentsNRN--
RenameNRN--
DeleteNRN--
Resource adapterRAR fileAddRN--
Change contentsYNYou cannot change the RAR file directly. Use the server management commands to change the properties.
RenameRN--
DeleteRN--

Legend:

When the 'Application status' is 'Stop'
If the application is not running, the need for re-importing the application differs according to the types of the directories and files and the operation contents.
NR: Application need not be re-imported (the operation will be applied when the application is started the next time).
Y: If the conditions are satisfied, the application need not be re-imported. For conditions, see the Explanation column.
R: Application must be re-imported.
--: Not applicable.
When the 'Application status' is 'Start'
If the application is running and the reload functionality is disabled, the operating permissions differ according to the types of the directories and files and the operation contents.
Y: Operations can be performed.
N: Operations cannot be performed.
--: Not applicable.
#1
Even if you change the DD, the J2EE server does not detect the update and the operation is ignored.
The file is overwritten when the following commands are executed next time:
cjsetappprop
cjaddapp (when the -type filter option is specified)
cjdeleteapp (when the -type filter option is specified)
cjrenameapp
cjstartapp
#2
The dependent files are the files that are included in the include directive of the JSP files or tag files, and the files that are included in <include-prelude> or <include-coda> of web.xml.