All Examples All EJB Examples
WebLogic provides shell scripts and makefiles to build the example EJB classes, interfaces, and clients. This document describes how to build examples using both methods.
Each EJB example includes a client application ("Client") and sometimes a servlet ("Servlet"). All EJB client examples are included in the same Java package as the EJB classes. Classes that are intended only for the client are identified by the word "Client" in the classname. Servlets are identified by "Servlet" in the classname. Classes that are intended only for the server have the word "Bean" in the classname.
To build the EJB examples:
$ cd c:\weblogic\examples\ejb\basic\containerManaged
$ build.cmd
Each script generates the final EJB .jar file in /config/examples/applications directory of the WebLogic Server distribution. The server will automatically deploy any applications contained in this directory. The EJB .jar file is named according to the example's directory location. For example:
The scripts also build the clients required for the example, placing the classes in the correct locations:
mkdir build build\META-INF copy *.xml build\META-INF
In the next step, compiled EJB classes are also placed in the build directory, in subdirectories that match the classes' Java package structure.
build.cmd compiles the EJB classes and interfaces into
the build directory:
javac -d build Account.java AccountHome.java AccountPK.java ProcessingErrorException.java AccountBean.java
Next, the build script uses the jar utility to create a .jar file of the subdirectories
staged in build:
cd build jar cv0f std_ejb_basic_beanManaged.jar META-INF examples cd ..
Once the .jar file has
been created, the build script uses ejbc to generate EJB container classes. ejbc inserts the container classes
into a new .jar file, which is created in the /config/examples/applications directory:
java weblogic.ejbc -compiler javac build\std_ejb_basic_beanManaged.jar %APPLICATIONS%\ejb_basic_beanManaged.jar
The script uses javac to compile the EJB example's client classes into
the appropriate directories. In the beanManaged example, compiled clients are placed in the
/myserver/clientclasses and
/myserver/servletclasses
directories:
javac -d %CLIENT_CLASSES% Account.java AccountHome.java AccountPK.java ProcessingErrorException.java Client.java javac -d %MYSERVER%\servletclasses -classpath %MYCLASSPATH% Servlet.java
javac -d %EX_WEBAPP_CLASSES% Servlet.java Account.java AccountHome.java AccountPK.java ProcessingErrorException.java
Copyright © 1997-2000 BEA Systems, Inc. All rights reserved.
Last updated 02/7/2000