BEA Logo BEA WebLogic Server Release 6.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

   Programming WebLogic Enterprise JavaBeans:   Previous topic   |   Next topic   |   Contents   

 

WebLogic Server EJB Utilities

 

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

ejbc

WebLogic Server includes the weblogic.ejbc utility for 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.

weblogic.ejbc does the following:

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

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

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.

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.

 

Options

Option

 

Description

 

-help

 

Prints a list of all options available for the compiler.

 

-version

 

Prints ejbc version information.

 

-idl

 

Generates CORBA Interface Definition Language for remote interfaces.

 

-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.

 

Examples

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

$ java weblogic.ejbc -compiler javac c:\weblogic\samples\examples\ejb\basic\containerManaged\build\std_ejb_basic_containerManaged.jar c:\weblogic\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:\weblogic\samples\examples\ejb\basic\containerManaged\build\std_ejb_basic_containerManaged.jar

DDConverter

The DDConverter is a command line utility that converts WebLogic Server EJB deployment descriptors to WebLogic Server 6.0. Also, it allows you to convert deployment descriptors for WebLogic Server 4.5 container-managed persistence (CMP) 1.0 beans to CMP 1.1 beans, which run under WebLogic Server 6.0. With the DDConverter, the output of Weblogic Server 4.5 (EJB 1.0) is a .txt file; the output of WebLogic Server 5.1 (EJB 1.1) is a .jar file.

Converting EJBs for Use in WebLogic Server 6.0

The conversion options are:

Converting EJB CMP 1.1 Beans to EJB CMP 2.0 Beans

To convert EJB CMP 1.1 beans to 2.0 beans:

  1. Input the deployment descriptors into the DDConverter.

    The output goes to the .jar file.

  2. Extract the XML deployment descriptors.

  3. Modify the source code.

  4. Compile the modified java file with the extracted XML deployment descriptors, which creates the .jar file.

  5. Deploy the bean.

    Except for CMP beans, all other beans are converted to EJB 2.0 beans as needed, with little or no source code changes. You can input the deployment descriptors, output to a .jar file, and then deploy the bean.

Converting CMP Beans between WebLogic Server Versions

The DDConverter tool supports the following conversions:

To make these conversions:

  1. Input the WebLogic Server 4.5 or 5.1 deployment descriptor text into the DDConverter.

    The output goes to a .jar file that only includes CMP 1.1 or 2.0 WebLogic Server 6.0 deployment descriptors.

  2. Manually add the class files to the .jar file.

Syntax

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

Arguments

DDConverter takes one argument of file1 [file2...], which specifies a text file containing an EJB 1.0 or 1.5 compliant deployment descriptor.

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.

Options

Option

 

Description

 

-d destDir

 

Specifies the destination directory for the output of the .jar files.

This is a required option.

 

-combine 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.

 

-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.

 

Examples

The following example converts an EJB 1.0-compliant WebLogic Server DeploymentDescriptor.txt file into a collection of EJB 1.1-compliant XML files. The XML files are created in the destDir subdirectory:

$ java weblogic.ejb20.utils.DDConverter -d destDir DeploymentDescriptor.txt

deploy

Given an EJB compliant .jar file, the .jar's EJBs are deployed into a running WebLogic Server.

Syntax

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

Arguments

Argument

 

Description

 

list

 

Lists all EJB deployment units in the specified WebLogic Server.

 

deploy

 

Deploys an EJB .jar to the specified server.

 

undeploy

 

Removes an existing EJB deployment unit from the specified server.

 

update

 

Redeploys an EJB deployment unit in the specified server.

 

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.

 

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. 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. 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.