bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > WebLogic Java Adapter for Mainframe > Programming Guide > Deploying Applications |
Programming Guide
|
Deploying Applications
Deployment is the process of installing servlets and/or EJBs on WebLogic Server. Application deployment in WebLogic Server has evolved to the J2EE standard for web application deployment.
The following information is not intended to specifically describe how applications are deployed in WebLogic Server. For specific information, refer to Quick Start information and detailed documentation for deploying applications in the WebLogic Server online documentation at:
http://download.oracle.com/docs/cd/E13222_01/wls/docs70/quickstart/quick_start.html
http://download.oracle.com/docs/cd/E13222_01/wls/docs70/servlet/admin.html
http://download.oracle.com/docs/cd/E13222_01/wls/docs70/deployment.html
This section discusses the following topics:
Deploying a WebLogic JAM eGen EJB
A WebLogic JAM eGen EJB (client or server) is deployed like any other WebLogic EJB. Considerations that are specific to WebLogic JAM are:
Renaming Deployment Descriptors
The EJB deployment descriptors generated by the eGen utility are named based on the generated EJB, rather than the using the standard J2EE and WebLogic file names. This is to avoid file naming conflicts if multiple beans are generated in the same directory. As a result, these descriptors must be renamed before the EJB is packaged and deployed. Following are the naming conventions used, where BeanName is the name of the generated EJB:
For example, consider the following portion of an eGen script: In this script, the descriptions generated would be named TestClient-jar.xml and wl-TestClient.xml respectively. Adding Business Logic to a Generated EJB The EJBs generated by the eGen utility contain the infrastructure for calling mainframe services and returning the results of those services. If you want to present a different API that performs some business logic before deferring to the generated service methods, you will need to create a new bean class that sub-classes the generated code. If you want to maintain the same remote interface generated by the eGen utility but add business logic before/after the mainframe call, simply derive a new class from the generated bean class while retaining the generated home and remote interfaces. For example, if our generated TestClientBean.java contains a method named newEmployee(), you could insert business logic as follows: However, if you want to present a different remote interface in addition to adding business logic, you also need to create new remote and home interfaces to support your new bean. In either case, be sure to update the generated deployment descriptors to reflect your new bean classes. For example, suppose you used the eGen utility to generate an EJB named TestClientBean, and that bean had been extended as in the above example by a bean class named MyLogicBean. The eGen utility would have generated a deployment descriptor with the name TestClient-jar.xml. The generated deployment descriptor would need to be renamed ejb-jar.xml before deployment. The ejb-class element's value should also be changed from TestClientBean to MyLogicBean to reflect the new bean class name as in the example below. Merging Multiple Deployment Descriptors Multiple WebLogic JAM EJB's can be generated as part of a single application. This can be done in a single eGen script, or by running the eGen utility multiple times with different scripts. If these beans are to be deployed in a single .jar file, the generated deployment descriptors for each must be merged into a single ejb-jar.xml and weblogic-jar.xml. Sample EJB Deployment Following are instructions for the deployment of a sample eGen-created EJB.
client ejb TestClient TestClientHome
{
method newEmployee
is service emplCreate
}public class MyLogicBean extends TestClientBean
{
public dataView newEmployee(dataView in)
{
// perform before business logic here
dataView out = super.newEmployee(in);
// perform after business logic here
return(out);
}
}<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>TestClient</ejb-name>
<home>TestClientHome</home>
<remote>TestClient</remote>
<ejb-class>MyLogicBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
...
</ejb-jar>
Listing 4-1 Script for Building JAM_TradeServer.jar
@rem --- Adjust these variables to match your environment -----------------
set TARGETJAR=JAM_TradeServer.jar
set JAVA_HOME=c:\bea\jdk131_02
set WL_HOME=c:\bea\wlserver700
set JAM_HOME=c:\bea\wljam5.1
@rem ------ end of Adjustable variables ------------------------------------
set JAMJARS=%JAM_HOME%\lib\jam.jar
set CLASSPATH=%JAM_HOME%\lib\jam.jar;%JAM_HOME%\lib\tools.jar;
%WL_HOME%\lib\weblogic.jar
set PATH=%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH%
@rem Create the build directory, and copy the deployment
@rem descriptors into it.
@rem You should have already run your egen script so your xml files
@rem are already built.
md build build\META-INF
copy TradeServer-jar.xml ejb-jar.xml
copy wl-TradeServer-jar.xml weblogic-ejb-jar.xml
copy *.xml build\META-INF
@rem Compile ejb classes into the build directory (jar preparation)
javac -d build -classpath %CLASSPATH% *.java
@rem Make a standard ejb jar file, including XML deployment
@rem descriptors
cd build
jar cvf std_%TARGETJAR% META-INF sample
cd ..
@rem Run ejbc to create the deployable jar file
java -classpath %CLASSPATH% -Dweblogic.home=%WL_HOME% weblogic.ejbc -compiler javac build\std_%TARGETJAR% %TARGETJAR%
Deploying a WebLogic JAM eGen Servlet (Quick-Start Deployment)
The basic JAM eGen servlet is deployed like any other WebLogic servlet. The configuration for the eGen servlet is stored in the web.xml file in an applications directory associated with a domain. The basic default configuration can be found in the following directory:
<BEA_HOME>/<JAM_INSTALL_DIR>/config/verify/applications/
DefaultWebApp/WEB-INF/web.xml
For example, suppose a servlet is generated by executing the eGen utility on a script containing the following servlet definition:
servlet sample.SampleServlet shows initial
This produces a servlet class file named SampleServlet in a package called sample.
For the SampleServlet, add the classes and sample directories, so the directory structure looks like the following:
<BEA_HOME>/<JAM_HOME>/config/verify/applications/
DefaultWebApp/WEB-INF/classes/sample
The SampleServlet and the associated DataView class, which are the result of compiling the *.java files generated by the eGen utility, should be placed in the sample directory.
SampleServlet can be configured with an XML entry (added to web.xml) similar to the one shown in Listing 4-2:
Listing 4-2 XML Entry to Configure the SampleServlet Servlet
<web-app>
<servlet>
<servlet-name>
SampleServlet
</servlet-name>
<servlet-class>
sample.SampleServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
SampleServlet
</servlet-name>
<url-pattern>
/SampleServlet/*
</url-pattern>
</servlet-mapping>
</web-app>
SampleServlet can then by invoked by entering the following URL in the location field of your web browser:
http://<host>:<port>/SampleServlet
If WebLogic Server is running on your local machine and you used the default port (7001) when you installed WebLogic Server, SampleServlet can be invoked by the following URL:
http://localhost:7001/SampleServlet
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |