BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
| WebLogic Server Doc Home | Programming WebLogic EJB | Previous Topic | Next Topic | Contents | View as PDF

WebLogic Server EJB Utilities

The following sections provide a complete reference to the utilities and support files supplied with WebLogic Server EJBs:

- ejbc (weblogic.ejbc

- DDConverter (weblogic.ejb.utils.DDConverter

- deploy (weblogic.deploy)

ejbc

Use the weblogic.ejbc command-line utility for generate and compiling EJB 2.0 and 1.1 container classes. If you compile JAR files for deployment into the EJB container, you must use weblogic.ejbc to generate the container classes.

The WebLogic Server command line utility, weblogic.ejbc does the following:

- Places the EJB classes, interfaces, and XML deployment descriptor files in a specified JAR file.

- Checks all EJB classes and interfaces for compliance with the EJB specification.

- Generates WebLogic Server container classes for the EJBs.

- Runs each EJB container class through the RMI compiler to create client-side dynamic proxies and server-side byte code.

If you specify an output JAR file, ejbc places all generated files into the JAR file.

By default, ejbc uses javac as a compiler. For faster performance, specify a different compiler (such as Symantec's sj) using the -compiler flag.

Note: You may encounter problems deploying EJBs if there is a mismatched version problem with weblogic.ejbc. When you start WebLogic Server it checks which version of weblogic.ejbc was used to compile the container classes. If the version of weblogic.ejbc used to compile the classes is different from the version you are currently running the EJB will not deploy. To avoid this problem, make sure that you do not put unnecessary classes in your class path.

ejbc Syntax

>      $ java weblogic.ejbc [options] <source jar file>

>     	<target directory or jar file>

Note: If you output to a JAR file, the output JAR name must be different from the input JAR name.

ejbc Arguments

The following table lists the weblogic.ejbc arguments:

Argument | Description
<source jar file> | Specifies the JAR file containing the compiled EJB classes, interfaces, and XML deployment files.
<target directory or jar file> | Specifies the destination JAR file or deployment directory in which ejbc places the output JAR. If you specify an output JAR file, ejbc places the original EJB classes, interfaces, and XML deployment files in the JAR, as well as the new container classes that ejbc generates.

ejbc Options

The following table lists the weblogic.ejbc command-line options:

Option | Description
-help | Prints a list of all options available for the compiler.
-version | Prints ejbc version information.
-dispatchPolicy <queueName> | Specifies a configured execute queue that the EJB should use for obtaining execute threads in WebLogic Server. See Using Execute Queues to Control Thread Usage for more information.
-idl | Generates CORBA Interface Definition Language for remote interfaces.
-J | Specifies the heap size for weblogic.ejbc. Use as follows: java weblogic.ejbc -J-mx256m input.jar output.jar
-idlOverwrite | Overwrites existing IDL files.
-idlVerbose | Displays verbose information while generating IDL.
-idlDirectory <dir> | Specifies the directory where ejbc creates IDL files. By default, ejbc uses the current directory.
-keepgenerated | Saves the intermediate Java files generated during compilation.
-compiler <compiler name> | Sets the compiler for ejbc to use.
-normi | Passed through to Symantec's java compiler, sj, to stop generation of RMI stubs. Otherwise sj creates its own RMI stubs, which are unnecessary for the EJB.
-classpath <path> | Sets a CLASSPATH used during compilation. This overrides the system or shell CLASSPATH.

ejbc Examples

The following example uses the javac compiler against an input JAR file in c:\wlserver\samples\examples\ejb\basic\containerManaged\build. The output JAR file is placed in c:\wlserver\config\examples\applications.

>     $ java weblogic.ejbc -compiler javac
>     c:\wlserver\samples\examples\ejb\basic\containerManaged\build\std
>     _ejb_basic_containerManaged.jar
>     c:\wlserver\config\examples\ejb_basic_containerManaged.jar

The following example checks a JAR file for compliance with the EJB 1.1 specification and generates WebLogic Server container classes, but does not generate RMI stubs:

>     $ java weblogic.ejbc -normi
>     c:\wlserver\samples\examples\ejb\basic\containerManaged\build\std
>     _ejb_basic_containerManaged.jar

DDConverter

The DDConverter is a command line utility that converts earlier versions EJB deployment descriptors into EJB deployment descriptors that conform to the WebLogic Server 6.x version. The WebLogic Server EJB container supports both the EJB 1.1 and EJB 2.0 specifications including the EJB 1.1 and EJB 2.0 document type definitions (DTD). Each WebLogic Server EJB deployment includes standard deployment descriptors in the following files:

- ejb-jar.xml

  This XML file contains the Sun Microsoft-specific EJB deployment descriptors.

- weblogic-ejb-jar-.xml

  This XML file contains the WebLogic-specific EJB deployment descriptors.

- weblogic-cmp-rdbms-jar.xml

  This XML file contains the WebLogic-specific container-managed persistence (CMP) deployment descriptors.

Conversion Options Available with DDConverter

The DDConverter command line utility includes the following conversion options:

- Converting beans from earlier versions of WebLogic Server (WLS).

- Converting CMP and non-CMP beans from earlier version of the EJB specification.

The following table lists the various conversion options for the DDconverter:

Conversion Options for the DDConverter Utility
WLS | EJB non-CMP | EJB CMP
--- | --- | ---
From To | From To | From To
WLS 4.5 - WLS 6.x | See Note 1 | EJB CMP 1.0 - EJB CMP 1.1 See Note 2
WLS 4.5 - WLS 6.x | EJB 1.1 - EJB 2.0 | EJB CMP 1.0 - EJB CMP 2.0
WLS 5.x - WLS 6.x | EJB 1.1 - EJB 2.0 | See Note 3

Note 1: Converting non-CMP EJB 1.0 beans to non-CMP EJB 1.1 beans is not necessary because the EJB 1.1 non-CMP deployment descriptors are the same as the EJB 2.0 non-CMP deployment descriptors.

Note 2: Use the DDConverter command line option -EJBVer for converting EJB CMP 1.0 to EJB CMP 1.1. See DDConverter Options for a description of this option.

Note 3: Even thought WLS 5.x CMP 1.1 beans and WLS 6.x CMP 1.1 beans are different, WLS 5.1 CMP 1.1 beans can run in WebLogic Server 6.x without any changes to the source code.

You should always recompile the beans after you use the DDConverter. We recommend that you use weblogic.ejbc and then deploy the new generated JAR file. Recompiling the bean makes sure that the code is compliant with the EJB Specifications and saves you time because you can skip the recompile process during server startup.

- When converting WLS 4.5 EJB 1.0 beans to WLS 6.x EJB 1.1 beans, the input to DDConverter is the WebLogic 4.5 deployment descriptor text. The output is a JAR file that only includes the WebLogic 6.x deployment descriptors. Run weblogic-ejbc to see if you need to make any additional changes to the source code following the steps in Using DDConverter to Convert EJBs. See the first row in the Conversion Options for the DDConverter Utility table.

- When converting WLS 4.5 EJB 1.1 beans to WLS 6.x EJB 2.0 beans, the input to DDConverter is the WebLogic Server 4.5 deployment descriptor text. The output is a JAR file that only includes the WebLogic 6.x deployment descriptors. Run weblogic-ejbc to see if you need to make any additional changes to the source code, follow the steps in Using DDConverter to Convert EJBs. See the second row in the Conversion Options for the DDConverter Utility table.

- You can deploy WLS 5.x EJB 1.1 beans to WLS 6.x without any making changes to the source code because WLS 6.x is backward compatible. WLS 6.x detects, recompiles, and then deploys beans from previous versions of WLS. However, we recommend that you use the DDConverter to upgrade the WLS 5.x EJB 1.1 beans to WLS 6.x EJB 2.0 beans.

  When converting WLS 5.x EJB 1.1 beans to WLS 6.x EJB 2.0 beans, the input to DDConverter is the WebLogic 5.1 JAR file. This file contains the deployment descriptor files and class files. The output goes to a JAR file that includes the WebLogic 6.0 deployment descriptor files and all necessary class files. See the third row in the Conversion Options for the DDConverter Utility table.

  You can convert non-CMP beans to EJB 2.0 beans with little or no changes to the source code. To do this, run weblogic.ejbc on the output.jar file and then deploy the generated JAR file. With CMP beans, you must make changes to the source code using the steps in Using DDConverter to Convert EJBs.

Using DDConverter to Convert EJBs

To convert earlier versions of EJBs for use in WebLogic Server:

1. Input the EJB's deployment descriptor file into the DDConverter using the command line format shown in DDConverter Syntax.

   The output is a JAR file.

2. Extract the XML deployment descriptors from the JAR file.

3. Modify the source code according to the JavaSoft EJB Specification.

4. Compile the modified java file with the extracted XML deployment descriptors, using weblogic.ejbc to create a JAR file.

5. Deploy the JAR file.

DDConverter Syntax

>     $ java weblogic.ejb20.utils.DDConverter [options] file1 [file2...]

DDConverter Arguments

DDConverter takes the argument file1 [file2...], where file is one of the following:

- A text file containing EJB 1.0-compliant deployment descriptors.

- A JAR file containing EJB 1.1 compliant deployment descriptors.

DDConverter uses the beanHomeName property of EJBs in the text deployment descriptor to define new ejb-name elements in the resultant ejb-jar.xml file.

DDConverter Options

The following table lists the DDConverter command-line options:

Option | Description
-d destDir | Specifies the destination directory for the output of the JAR files. This is a required option.
-c jar name | Specifies a JAR file in which you combine all beans in the source files.
-EJBVer output EJB version | Specifies the output EJB version number, such as 2.0 or 1.1. The default is 2.0.
-log log file | Specifies a file into which the log information can be placed instead of the ddconverter.log.
-verboseLog | Specifies that extra information on the conversion be placed in the ddconverter.log.
-help | Prints a list of all options available for the DDConverter utility.

DDConverter Examples

The following example converts a WLS 5.x EJB 1.1 bean into a WLS 6.x EJB 2.0 bean.

The JAR file is created in the destDir subdirectory:

>     $ java weblogic.ejb20.utils.DDConverter -d destDir Employee.jar

Where the Employee bean is a WLS 5.x EJB 1.1 JAR file.

deploy

The weblogic.deploy command-line utility is used to deploy an EJB-compliant JAR file, the JAR's EJBs to a running instance of WebLogic Server.

deploy Syntax

>     $ java weblogic.deploy [options] [list|deploy|undeploy|update]
>     password {name} {source}

deploy Arguments

Argument | Description
list | Lists all EJB deployment units in the specified WebLogic Server.
deploy | Deploys an EJB JAR to the specified server.
delete | Deletes an EJB deployment unit.
undeploy | Removes an existing EJB deployment unit from the specified server.
update | Redeploys an EJB deployment unit. Note: Updating an application or component on any single server instance to which it is targeted causes it to be updated on all servers to which is targeted. For instance, if an application is targeted to a cluster, and you update it on one of the clustered servers instances, the application will be updated on all members of cluster. Similarly, if the application is targeted to a cluster and to a standalone server instance, updating it on the standalone server instance will result in its update on the cluster, and vice versa.
password | Specifies the system password for the WebLogic Server.
{name} | Identifies the name of the EJB deployment unit. This name can be specified at deployment time, either with the deploy or console utilities.
{source} | Specifies the exact location of the EJB JAR file, or the path to the top level of an EJB deployment directory.

The following table lists the weblogic.deploy command line arguments:

deploy Options

Option | Description
-help | Prints a list of all options available for the deploy utility.
-version | Prints the version of the utility.
-port <port> | Specifies the port number of the WebLogic Server to use for deploying the JAR file. If you do not specify this option, the deploy utility attempts to connect using port number 7001.
-host <host> | Specifies the host name of the WebLogic Server to use for deploying the JAR file. If you do not specify this option, the deploy utility attempts to connect using host name localhost.
-user | Specifies the system username of the WebLogic Server to be used to deploy the JAR file. If you do not specify this option, deploy attempts to make a connection using the system username system. You use the weblogic.system.user property to define the system username.
-debug | Prints detailed debugging information during the deployment process.

The following table lists the weblogic.deploy command line options:

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.