[Enterprise Extensions only]
  Previous topic

Writing a WebSphere Enterprise JavaBean as a CORBA client, building the Enterprise JavaBean

After the client is coded, it must be compiled. For a basic enterprise bean, this work is done as part of the deployment, in which the code needed by the container for managing the bean is generated. For a bean that also acts as a CORBA client, the CORBA-related code must be separately compiled. This code is outside the domain of the deployment process. The usual approach is as follows:

The packaging, deployment, and starting of the bean are done in the usual manner for enterprise beans running in the WebSphere environment. They are not discussed here.

The enterprise bean described in this example makes use of two CORBA IDL interfaces, Primitive and Complex. These are compiled for Java with IDL compiler provided by WebSphere Application Server. The source code for the client consists of the IDL-generated files, the code called by the bean's business methods to invoke the CORBA server, and the actual enterprise-bean code, consisting of the home and remote interfaces and the bean class. These are compiled with Java's javac compiler. The example application is built as follows:

  1. Set the environment variables for the build.
    set PATH=%JDKROOT%\bin;%JDKROOT%\jre\bin;%JDKROOT%\jre\bin\classic;%PATH%
    set WAS_CP=.
    set WAS_CP=%WAS_CP%;%WAS_HOME%\lib\j2ee.jar
    set WAS_CP=%WAS_CP%;%WAS_HOME%\lib\ejbcontainer.jar
    set CLASSPATH=%WAS_CP%
    
  2. Compile the IDL files for the client. To generate Java code from the IDL files, use the idlj compiler provided with WebSphere Application Server. The -v option requests verbose output; the -fall option directs the compiler to generate all bindings.
    % idlj -v -fall Primitive.idl
    % idlj -v -fall Complex.idl
    
  3. Compile the CORBA-related source code and the IDL-generated interface code into class files.
    % javac com\ibm\orb\interop\samples\idl\*.java
    % javac com\ibm\orb\interop\samples\util\*.java
    % javac com\ibm\orb\interop\samples\Defs.java
    % javac com\ibm\orb\interop\samples\ClientOrb.java
    % javac com\ibm\orb\interop\samples\PrimitiveOps.java
    % javac com\ibm\orb\interop\samples\ComplexOps.java
    % javac com\ibm\orb\interop\samples\TestNameService.java
    % javac com\ibm\orb\interop\samples\TestPrimitive.java
    % javac com\ibm\orb\interop\samples\TestComplex.java
    
  4. Compile the enterprise-bean source code into class files.
    % javac com\ibm\orb\interop\samples\ejb\Client.java
    % javac com\ibm\orb\interop\samples\ejb\ClientHome.java
    % javac com\ibm\orb\interop\samples\ejb\ClientBean.java
    
  5. Package the bean for deployment by using the WebSphere application assembly tool (AAT) to create an enterprise application (EAR) file.
  6. Deploy the bean into the container by using the WebSphere administrative console.
  7. Start the bean by using the WebSphere administrative console.
  Previous topic