8.3 J2EEC ” Utility for Creating Stubs and Ties for a JAX-RPC Web Service
J2EE 1.4 reference implementation.
j2eec [-keep -keepgenerated ] [-o output] module
j2eec is a command-line utility that is part of the J2EE reference implementation. It accepts a deployable J2EE module and creates a JAR file containing some or all of the following:
Client-side stubs for EJBs that have a remote interface
Client-side stubs for web services
Server-side ties for web services
A sun-j2ee-ri.xml file containing information that can be used by containers into which the original module is deployed
The newly created JAR file can be used as follows :
To deploy the original module to a J2EE RI application server using the -deployGeneratedModule option of the deploytool command (discussed later), without incurring the overhead of stub and tie generation. This technique may be useful if you need to deploy the same module to more than one server.
As the stubs file when running a J2EE application client using the runclient utility, as described in Section 6.4. If the client JAR file contains service-ref elements referring to web services deployed in the server, the sun-j2ee-ri.xml file contains the information that the client container needs to bind a generated Service object that can be used to access the service in the application's JNDI environment at runtime.
The behavior of the j2eec command is determined primarily by the deployment descriptors provided in the J2EE module supplied on its command line, which may be an EJB JAR file, a web archive, a J2EE client application archive, or an EAR file containing any combination of the other module types. In the latter case, the generated file includes all of the stubs, ties, and other information required for each of the modules that it contains. The following command-line options are also available:
Synonymous options that cause the Java source files for the stubs and ties and other files generated by j2eec to be retained. By default, these files are deleted. Temporary files are placed in a system-dependent location. For Windows 2000 and Windows XP, for example, you'll find these files in a directory beneath %HOME%\Local Settings\Temp , where %HOME% represents your home directory. The actual location is displayed on standard output when the command is executed.
- -o filename
Specifies the name of the JAR file to which j2eec should write its output. If this argument is not supplied, output is written to a file called generated.jar in the caller's working directory.
8.4 J2EE Deploytool ” Utility for Deploying Modules and Enterprise Applications
J2EE 1.4 reference implementation.
deploytool [-server name[:port]] -deployModule [-id moduleID] module [client_JAR] deploytool [-server name[:port]] -deployGeneratedModule [-id moduleID] module generated_JAR deploytool [-server name[:port]] -listModules type deploytool [-server name[:port]] -undeploy moduleID
The deploytool utility provided with the J2EE 1.4 reference implementation provides both a command-line and a graphical user interface that allow you to create and deploy J2EE modules to the J2EE RI application server. You can also use the same utility to deploy an existing module. The GUI interface is used when no command-line arguments are supplied. This section covers only those command-line features of the deploytool utility that are relevant to web services.
Most forms of the deploytool command include an optional module ID, which is used to uniquely identify a deployed module within the application server. If an explicit module ID is not supplied, then one is created by taking the display name of the module and replacing all spaces by underscore characters . The display name is obtained from the display-name element of the module's deployment descriptor (i.e., META-INF/ejb-jar.xml for an EJB JAR file, WEB-INF/web.xml for a web archive, META_INF/ application-client .xml for a client archive, META-INF/ra.xml for a Connector resource archive, or META-INF/application.xml for an Enterprise Archive).
- -server name[ : port ]
Specifies that hostname, and optionally , the port number, for the target application server. If this option is not used, the server is assumed to be accessible at port 8000 on localhost .
- -deployModule [-id moduleID ] module [ client_JAR ]
Deploys a J2EE module to the application server. If a module with the same name is already deployed, it is removed and the new version is deployed in its place. The module argument must be the path name of an EJB JAR, a web archive, a client application archive, a resource archive, or an Enterprise Archive. The deployment process may include the generation of stub and tie classes and other information of use to client programs or to a J2EE client application container. This information, which is the same as that created by the j2eec utility described earlier in this chapter, may optionally be returned by the server and stored in the file given by the client_JAR argument. It may be used in conjunction with the -deployGeneratedModule option or when running a J2EE application client, as described in Section 6.4.
- -deployGeneratedModule [-id moduleID ] module generated_JAR
This option is the same as -deployModule , except that the stub generation step is omitted. The stubs are assumed to have already been created by an earlier invocation of this command using the -deployModule option or by the j2eec utility, and must be supplied using the generated_JAR argument.
- -listModules type
Lists all deployed modules of the specified type, which must be one of car (client archive), ear (Enterprise Archive), ejb (EJB JAR), rar (Connector resource archive), or war (web archive).
- -undeployModule moduleId
Undeploys the module identified by the given module ID.