WAS v8.5 > Reference > Developer detailed usage information

Create stubs command

The createEJBStubs command creates stub classes for remote interfaces of EJB v3.x beans packaged in JAR, web application archive (WAR), or EAR files. It also provides an option to create a single stub class from an interface class located in a directory or a JAR file. Several command options are provided to package the generated stub classes in different ways. See the following syntax and example sections for more details.

This command is found in the <WAS_HOME>/bin directory as:

The command searches the input JAR, WAR, or EAR file, looking for EJB version 3.x modules containing beans with remote interfaces. When remote interfaces are found, the corresponding stub classes are generated and packaged according to the command options specified. In the case where the input specified is a single interface class, the tool assumes that this class is an EJB version 3.x remote interface class and generates a remote stub class.

For many client-side scenarios, the WebSphere Application Server Just-In-Time (JIT) deployment feature dynamically generates the RMI-IIOP stub classes required for invocation of remote EJB 3.x business interfaces. However, there are some scenarios where the JIT deploy environment is not available to dynamically generate these classes. In these scenarios, the createEJBStubs command must be used instead to generate and embed the client-side stub class files in your client application. If your client environment is one of the following, use the createEJBStubs command:

The JVM running the createEJBStubs command must have the java.io.tmpdir system property defined. The property must point to a readable and writable directory that exists.

In addition to creating stubs for bean content packaged in EAR and JAR files, the command also creates stubs for bean content that is packaged in a WAR file. If an EAR file is specified as the input file, and that EAR file contains a WAR file with remote interfaces, then stubs are generated for those interfaces.

Stubs are placed into the WAR file in the same location as the remote interface or bean class they correspond to. If the remote interface or bean class they correspond to is placed loosely in the WEB-INF/classes directory structure, then the stub is placed there as well. If the remote interface or bean class is packaged inside of a JAR file in the WEB-INF/lib directory, then the stub is inserted into that same JAR file. If a stub is generated for a remote interface not packaged inside the WAR file, then it is placed loosely in the WEB-INF/classes directory structure.

The createEJBStubs command is not supported for use with a 2.x or 1.x EJB module packaged inside a stand-alone JAR file. The stubs for a 2.x or 1.x EJB module packaged inside a stand-alone JAR file must be generated using the EJBDeploy tool instead. If the createEJBStubs command is run against a 2.x or 1.x EJB module packaged inside a stand-alone JAR file, then the command issues a CNTR9241I message, and does not generate any stubs.

However, the createEJBStubs command is supported for use with 2.x or 1.x EJB modules packaged inside a WAR file. In this case, the createEJBStubs command must be used instead of the EJBDeploy tool.

A client component uses these stubs to communicate with the EJB components running inside the server. The client component must use stub instances that were created by the correct tool. If the client component is communicating with a 2.x or 1.x EJB module packaged inside a stand-alone JAR, then the stubs must come from the EJBDeploy tool. However, if the client component is communicating with a 2.x or 1.x EJB module packaged inside a WAR, then the stubs must come from the createEJBStubs command. A single stub instance cannot be used to communicate with both a 2.x/1.x EJB module packaged inside a stand-alone JAR, and that same 2.x/1.x EJB module packaged inside a WAR.


Syntax

createEJBStubsinput_ class_ name | input_JAR_name | input_WAR_name | input_EAR_name [-help] [-newfile[new_file]] [-updatefile[update_file]] [-quiet] [-verbose] [-logfile log_file] [-appendlog] [-cp class_path] [-trace]

createEJBStubs

This is the command to create EJB stub classes for a single interface class file, a JAR file, a WAR file, or an EAR file. When invoked without any arguments, or only –help, the createEJBStubs command displays a list of options that can be specified, and a list of example invocations with detailed explanations.

input_class_name or input_EAR_name or input_JAR_name or input_WAR_name

The first parameter is a required element for the command. It must contain the source class, JAR, WAR, or EAR file to process.

This parameter may be the fully qualified name of a single interface class (e.g. com.ibm.myRemoteInterface). Note the package name segments are separated by “.” characters, no path name proceeds the class name, and the “.class” extension is not included. For this interface class input, use the class path option (e.g. –cp my_path, or –cp my_path/my_interfaces.jar) to specify where the interface class is found. The generated stub class is placed in the package-defined directory structure, starting with the current directory where the command is invoked.

This parameter may also be a JAR, WAR, or EAR file. In this case the path must be specified (e.g. my_path/my_Server_App.ear). The generated stub classes are placed in the same module or modules with the beans, or in the same module or modules with the remote interface classes, depending on whether the –updatefile option is specified. See the following sections for more details.

-help

Provides the command syntax, including a list of options that can be specified, and example invocations with detailed explanations.

-newfile [new_file]

Requests that a new file is generated containing the original files in the input JAR, WAR, or EAR plus the stub classes. When this option is not specified, the stubs are written back into the original JAR, WAR, or EAR file. If this option is specified, but the new_file name is not provided, a new file name is constructed by appending the input JAR, WAR, or EAR file name with "_withStubs". This option is not allowed when the first input parameter is an interface class.

-updatefile [update_file]

Requests that a second file (e.g. in addition to the input file) is updated with stub classes. This option also provides a different packaging behavior. The stub classes are packaged in the same module or modules as the remote interface classes. By contrast, when this option is not specified, the stub classes are packaged in the same module or modules with the bean classes. If this option is specified, but the update_file name is not provided only the original JAR, WAR, or EAR file is updated with stub classes. This option is not allowed when the first input parameter is an interface class.

-quiet

Requests the suppression of messages. The -quiet option cannot be specified with either the –verbose or the –trace options. Error messages are still displayed.

-verbose

Requests that additional informational messages be output. The -verbose option cannot be specified with either the -quiet or the –trace options.

-logfile log_file

Requests that messages be printed to a log file in addition to the console. If this option is specified, the log_file name must also be provided.

-appendlog

Requests that messages be appended to an existing log file. If this option is specified, the -logfile option must also be specified.

-cp class_path

Requests the class loader includes the specified the class path where additional class or jar files are located, which are necessary for the remote interface classes to be loaded. The class path might include multiple segments where each path is separated from a previous path by the default path separator character of the operating system. Each path can specify either a JAR file, or a directory. If this option is specified, the class_path name must also be provided.

-trace

Request that detailed trace output be generated. This is intended to collect information for use by IBM service to resolve problems. The trace output is English-only. This option cannot be specified with either the –quiet or the –verbose options.


Examples

createEJBStubs com.ibm.myRemoteInterface -cp my_path Generate the stub class for one remote interface class and place it in the package-defined directory structure, starting at the current directory. The my_path directory is used as the class path. If the remote interface class to process is in a JAR file, the –cp my_path/my_interfaces.jar syntax must be used for the class path specification.

createEJBStubs my_path/my_beans.jar -newfile –quiet Generate the stub classes for all level 3.0 enterprise beans in the my_beans.jar file that have remote interfaces. Both the generated stub classes and the original JAR file contents are packaged into a new JAR file named “my_beans_withStubs.jar” because the optional new_file name parameter is not specified along with the –newfile option. Output messages are suppressed except for error notifications.

createEJBStubs my_path/my_Server_App.ear -logfile myLog.out Generate the stub classes for all level 3.0 enterprise beans in the my_Server_App.ear file that have remote interfaces. The generated stub classes are placed into the original EAR file because the –newfile option is not specified. The stub classes are packaged into the same module or modules as the bean classes because the –updatefile option is not specified. Messages are written to both the myLog.out log file and the command window.

createEJBStubs my_path/my_Server_App.ear -updatefile my_path/my_Client_interfaces.jar Generate the stub classes for all level 3.0 enterprise beans in the my_Server_App.ear file that have remote interfaces. The generated stub classes are placed into both the original EAR file and the my_Client_interfaces.jar file. The stub classes are packaged into the same module or modules as the remote interface classes because the –updatefile option is specified.

createEJBStubs my_path/my_Server_App.ear –updatefile Generate the stub classes for all level 3.0 enterprise beans in the my_Server_App.ear file that have remote interfaces. The generated stub classes are only placed into the original EAR file because the optional update_file name parameter is not provided with the –updatefile option. The stub classes are packaged into the same module or modules as the remote interface classes because the -updatefile option is specified.

createEJBStubs my_path/my_beans.war Generate the stub classes for all 3.x beans that are packaged in the WAR file and have remote interfaces. The Bean1 class is packaged loosely inside the WEB-INF/classes directory structure, and therefore, the corresponding stub is placed there as well. Likewise, the Bean2 class is packaged inside of the myEJB.jar file in the WEB-INF/lib directory, and therefore, the corresponding stub is inserted into that JAR file.


Related concepts:

Enterprise beans


Related


Develop enterprise beans


+

Search Tips   |   Advanced Search