1. appcompiler
This section describes the application compiler that compiles EJB interface impl, skeleton, stub classes, and the servlet classes and web service endpoint classes created by compiling JSP.
This tool may be selectively used to compile EJB 2.1 interface impl, RMI stub, skeleton classes, and the JSP of a web module to create servlet classes in advance. EJB that only consists of EJB 3 interfaces, JAX-WS clients, and server applications do not need to use this tool.
This tool is useful in the following cases:
-
When there are many beans that conform to EJB 2.x standards, and the initial deployment period is long.
-
When JSP must be precompiled because JSP compilation time is a large portion of the service time.
For EJB 2.x modules, the fast-deploy configuration must be set or the [-fast] option must be added to the deploy command of the jeusadmin console tool when deploying applications. If the fast-deploy option is set to true, the appcompiler can be prevented from automatically executing when deploying modules at runtime. If the fast-deploy option is set, impl, skeleton, and stub classes are not compiled and pre-created classes are used to decrease the deployment time. In EJB 3.x modules, appcompiler is not executed. Therefore, it is not executed even when both EJB 2.x and EJB 3.x exist in a module.
The appcompiler tool consists of the 'Each' mode and the 'Batch' mode. The 'Each' mode creates a file and then compiles it separately, while the 'Batch' mode creates all files first and then compiles them all at once. In the 'Batch' mode, the processing speed is faster than in the 'Each' mode; however, in 'Batch' mode, if an error occurs during compilation, the debugging is much more difficult.
'Each' is the default mode. To use the 'Batch' mode, use the [-batch] option or set jeus.app.compiler.mode=batch. However, the 'Batch' mode only applies to EJB 2.x modules.
When executing appcompiler for WAR files on Windows, the temporary directory may not be deleted because java.net.URLClassLoader cannot explicitly close the WEB-INF/lib/*.jar files included in a WAR file. Starting from Java 7, a close method for java.net.URLClassLoader is provided, so later versions do not generate this error. Currently, the temporary directories must be deleted manually. |
The following describes how to use the tool and parameters.
-
Usage
appcompiler [-h] [-verbose] [-clp <class-path>] [-keep] [-jspmap] [-batch] [-q] [-client <clientview_filename>] [-noaddfile] [-deloldgen] [-ejbjar <ejb-jar.xml_path>] [-jeusejbdd <jeus-ejb-dd.xml_path>] [-D <property=value>] [-property <file-name>] [-target <application-path>] [-j concurrency-level] [-ejbonly] [-genjavaonly] [-webonly]
-
Parameters
Parameter Description [-h]
Displays appcompiler help information.
[-verbose]
Sets the verbose mode, which displays detailed process information (Sets the log level to FINEST).
[-clp]
Registers libraries required for compilation as class paths. A file or directory can be specified. To specify multiple items, separate each item with a semicolon (;) in Windows or a colon (:) in UNIX.
[-keep]
Option to keep the source code created during compilation.
[-jspmap]
Option to create a servlet-mapping table (jeus_jspmap.xml). If this option is used, the name of the directory that contains JSP files cannot include Java reserved words. E.g., enum, class, etc.
[-batch]
Sets the batch mode, which creates all files and then compiles them all at once. If this option is not set, the 'each' mode is used, which creates a file and then compiles it. This option only applies to EJB 2.x modules.
[-q]
When compiling an EAR application that contains multiple modules, if a web module fails to compile, the compilation process stops immediately and error messages are displayed.
If this option is not set and a web module fails to compile, error messages are displayed but the compilation process proceeds with the remaining modules.
[-client <clientview_filename>]
Name of the clientview file that contains new stub and interface classes.
-
<clientview_filename> supports only JAR files, an EJB archived file type. The clientview file is created in the same directory as the archived or exploded applications, which are to be compiled. This option applies to standalone EJB modules and EAR applications that contain EJB modules.
-
If <clientview_filename> is the same as <application_file_or_directory_name>, it is not supported.
-
If a file with the same name as <clientview_filename> exists, include the clientview interface classes and stub classes in the file. The clientview file is provided to the client to develop applications that use EJB installed on the server.
[-noaddfile]
This option is only valid when used with the [-client] option. -noaddfile creates a clientview file, however, the target files are not compiled and the original files are maintained.
For example, when appcompiler is used for calc.jar, the -client option is used to create the clientview file. The clientview file contains stubs and remote and home interface classes. Before creating the clientview file, compile the calc.jar file. The compiled file includes class files, such as impl, skeleton, and stub files created during the compilation. To create a clientview file without compiling calc.jar, the [-noaddfile] option can be used.
[-deloldgen]
When compiling an EJB module, the compilation is executed after the impl, skel, and stub files created by the previous version of JEUS are deleted.
[Note]
Setting the name of impl, skel, and stub classes in JEUS 4 and JEUS 5 is different from that in JEUS 8. If an EJB module, created in JEUS 4 or JEUS 5, is compiled using the JEUS 8 appcompiler, the impl, skel, and stub files created in JEUS 4 or JEUS 5 can cause EJB to run abnormally. This problem is prevented by using this parameter.
[-ejbjar <ejb-jar.xml_path>]
ejb-jar.xml file to be used for compilation.
[-jeusejbdd <jeus-ejb-dd.xml_path> ]
jeus-ejb-dd.xml file to be used for compilation.
[-D <property=value>]
Specifies a system property. This option can be used more than once.
[-property <file-name>]
File name that contains system properties to be set.
[-target <application-path>]
File (archived ear, jar, war) or directory (exploded EAR, JAR, WAR) of the target application to be compiled.
EAR, standalone JAR, and WAR are regarded as applications. impl, skel, and stub class files created during compilation are added to the target application files.
[-j concurrency-level]
This option is used when compiling JSP files. If there is a large number of JSP files, set this option to perform compilation using multiple threads concurrently. (Default value: 1)
[-ejbonly]
Compile only EJB modules in EAR.
[-genjavaonly]
Used to create only Java files.
[-webonly]
Compile only Web modules in EAR.
-
-
Example
appcompiler is a regular script file located in the JEUS_HOME/bin/ directory.
-
The following command creates a home and remote interface, impl, skel, and stub classes of the "ejb.jar" module. The command also includes the files in the ejb.jar file.
JEUS_HOME/bin$ appcompiler ejb.jar
-
The following command creates servlet classes from all JSP files of the web.war module and includes them in the war file.
JEUS_HOME/bin$ appcompiler web.war
-
The following command compiles modules in batch mode.
JEUS_HOME/bin$ appcompiler -batch app.jar
-
The following command creates a home and remote interface, impl, skel, and stub classes of the "ejb.jar" module. The command also includes the files in the ejb.jar file, and creates the clientview.jar file, which contains the home and remote interfaces and the created stub classes.
JEUS_HOME/bin$ appcompiler -client clientview.jar ejb.jar
-