J2EE Sample Code: Accessing the Resource Adapter from a Web Application

The following code sample illustrates how to use the resource adapter inside a Web application. This sample uses the AMNU test application supplied by IBM and does some simple add, update, and query operations.

Creating the AmnuRaSample.WAR

To distribute a Web application, you must package it in a Web application archive (WAR). The WAR supports SunOne, WebLogic, WebSphere, and Oracle, with some minor differences that are noted below. To veiw the correct source code, select the appropriate link:

Once the directory structure and files have been created, you might use the following command to create the WAR:
$JAVA_HOME/bin/jar -cf ../AmnuRaSample.WAR .

Deploying the AmnuRaSample.WAR

There are two options:

Accessing the AmnuRaSample.WAR

After you have deployed the Web application (WAR), it can be accessed through the following URL:

http://machine:port/AmnuRaSample/index.jsp

This application server
Uses this default port...
SunOne 81 or 4444 (see HTTP Port(s) listed on App Server Instances / server1 / General tab)
WebLogic 7001
WebSphere 9080
Oracle9i 7777

Persistence

Since multiple calls need to be made to the same instance of the resource adapter, the reference to the resource adapter is saved in the session object and closed when finished.


Source code for index.jsp

<%@page contentType="text.html"%>

<%@page import="javax.naming.InitialContext" %>
<%@page import="javax.resource.cci.ConnectionFactory" %>
<%@page import="com.attachmate.cicsbridge.j2ee.outputs.*" %>
<%@page import="com.attachmate.cicsbridge.j2ee.resource.cci.IBridgeAPI" %>

<%
        IBridgeAPI m_ra = null;
        // inputs
        String m_hostIP = request.getParameter("hostIP");
        String m_hostPort = request.getParameter("hostPort");
        String m_terminalModel = request.getParameter("terminalModel");
        String m_userid = request.getParameter("userid");
        String m_password = request.getParameter("password");
        // modes
        boolean m_add = false;
        boolean m_update = false;
        boolean m_query = false;
        // outputs
        String m_number = "";
        String m_name = "";
        String m_address = "";
        String m_phone = "";
        String m_date = "";
        String m_amount = "";
        String m_comment = "";
        PutString putstring;
        GetString getstring;
        int m_returnCode = 0;
        // get the resource adapter out of the session object
        m_ra = (IBridgeAPI) session.getAttribute("ra");
        if ("connectBridge".equals(request.getParameter("Execute")))
        {
            javax.naming.InitialContext ic = new javax.naming.InitialContext();
            // look up resource adapter with resource name
            // (mapped to jndi name in weblogic.xml, sun-web.xml, orion.xml or as setup in WebSphere)
            ConnectionFactory cf = (ConnectionFactory) ic
                    .lookup("java:comp/env/eis/BridgeAPI");
            m_ra = (IBridgeAPI) cf.getConnection();
            // save resource adapter instance in the session object for future reference
            session.setAttribute("ra", m_ra);
            m_returnCode = m_ra.connectBridge(m_hostIP, Integer
                    .parseInt(m_hostPort), Integer.parseInt(m_terminalModel),
                    m_userid, m_password);
        }
        else if ("disconnect".equals(request.getParameter("Execute")))
        {
            session.removeAttribute("ra");
            m_returnCode = m_ra.disconnect();
            // close resource adapter connection
            m_ra.close();
            // cleanup session object, etc.
            m_ra = null;
        }
        else if ("cancel".equals(request.getParameter("Execute")))
        {
            m_add = false;
            m_update = false;
        }
        else if ("AddEntry".equals(request.getParameter("Execute")))
        {
            m_number = request.getParameter("number");
            m_add = true;
        }
        else if ("EnterAdd".equals(request.getParameter("Execute")))
        {
            m_number = request.getParameter("number");
            m_returnCode += m_ra.sendKeys("@CAMNU@EAADD" + m_number + "@E");
            // check that navigation worked here
            putstring = m_ra.putString(request.getParameter("name"), 4, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("address"), 5, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("phone"), 6, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("date"), 7, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("amount"), 8, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("comment"), 9, 11);
            m_returnCode += putstring.getReturnCode();
            m_returnCode += m_ra.sendKeys("@E");
        }
        else if ("UpdateEntry".equals(request.getParameter("Execute")))
        {
            m_number = request.getParameter("number");
            m_returnCode += m_ra.sendKeys("@CAMNU@EAINQ" + m_number + "@E");
            // check that navigation worked here
            getstring = m_ra.getString(-1, 4, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_name = getstring.getText().trim();
            getstring = m_ra.getString(-1, 5, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_address = getstring.getText().trim();
            getstring = m_ra.getString(-1, 6, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_phone = getstring.getText().trim();
            getstring = m_ra.getString(-1, 7, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_date = getstring.getText().trim();
            getstring = m_ra.getString(-1, 8, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_amount = getstring.getText().trim();
            getstring = m_ra.getString(-1, 9, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_comment = getstring.getText().trim();
            m_returnCode += m_ra.sendKeys("@E");
            m_update = true;
        }
        else if ("EnterUpdate".equals(request.getParameter("Execute")))
        {
            m_number = request.getParameter("number");
            m_returnCode += m_ra.sendKeys("@CAMNU@EAUPD" + m_number + "@E");
            // check that navigation worked here
            putstring = m_ra.putString(request.getParameter("name"), 4, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("address"), 5, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("phone"), 6, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("date"), 7, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("amount"), 8, 11);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(request.getParameter("comment"), 9, 11);
            m_returnCode += putstring.getReturnCode();
            m_returnCode += m_ra.sendKeys("@E");
        }
        else if ("QueryEntry".equals(request.getParameter("Execute")))
        {
            m_number = request.getParameter("number");
            m_returnCode += m_ra.sendKeys("@C");
            putstring = m_ra.putString("AMNU", 1, 1);
            m_returnCode += putstring.getReturnCode();
            m_returnCode += m_ra.sendKeys("@E");
            putstring = m_ra.putString("AINQ", 12, 21);
            m_returnCode += putstring.getReturnCode();
            putstring = m_ra.putString(m_number, 12, 33);
            m_returnCode += putstring.getReturnCode();
            m_returnCode += m_ra.sendKeys("@E");
            // check that navigation worked here
            getstring = m_ra.getString(-1, 4, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_name = getstring.getText().trim();
            getstring = m_ra.getString(-1, 5, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_address = getstring.getText().trim();
            getstring = m_ra.getString(-1, 6, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_phone = getstring.getText().trim();
            getstring = m_ra.getString(-1, 7, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_date = getstring.getText().trim();
            getstring = m_ra.getString(-1, 8, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_amount = getstring.getText().trim();
            getstring = m_ra.getString(-1, 9, 11, 25);
            m_returnCode += getstring.getReturnCode();
            m_comment = getstring.getText().trim();
            m_returnCode += m_ra.sendKeys("@E");
            m_query = true;
        }
%>

<html>
<head>
    <title> AMNU Resource Adapter Sample </title>
</head>
<body>
    <form action='<%=request.getRequestURI()%>' method='post'>
    <table>
        <tr>
            <td align=center colspan=2> <b> AMNU Resource Adapter Sample </b> </td>
        </tr>
<%
        if (m_ra == null)
        {
%>
        <tr>
            <td align=right> hostIP: </td>
            <td>
                <input type='text' name='hostIP' size='15' value='<%=m_hostIP%>'>
            </td>
        </tr>
        <tr>
            <td align=right> hostPort: </td>
            <td>
                <input type='text' name='hostPort' size='10' value='<%=m_hostPort%>'>
            </td>
        </tr>
        <tr>
            <td align=right> terminalModel: </td>
            <td>
                <input type='text' name='terminalModel' size='5' value='<%=m_terminalModel%>'>
            </td>
        </tr>
        <tr>
            <td align=right> userid: </td>
            <td>
                <input type='text' name='userid' size='20' value='<%=m_userid%>'>
               </td>
        </tr>
        <tr>
            <td align=right> password: </td>
            <td>
                <input type='password' name='password' size='20' value='<%=m_password%>'>
            </td>
        </tr>
        <tr>
            <td align=center colspan=2>
                <input type='submit' name='Execute' value='connectBridge'>
            </td>
        </tr>
<%
        }
        else
        {
            if (m_add == true)
            {
%>
        <tr>
            <td align=center colspan=2> </td>
        </tr>
        <tr>
            <td align=right> number: </td>
            <td>
                <b> <%=m_number%> </b> 
                <input type='hidden' name='number' value='<%=m_number%>'>
            </td>
        </tr>
        <tr>
            <td align=right> name: </td>
            <td>
                <select name='name'>
                    <option value='GEORGE WASHINGTON'> GEORGE WASHINGTON </option>
                    <option value='SIR JOHN A MACDONALD'> SIR JOHN A MACDONALD </option>
                    <option value='ROBERT WALPOLE'> ROBERT WALPOLE </option>
                    <option value='GUADALUPE VICTORIA'> GUADALUPE VICTORIA </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> address: </td>
            <td>
                <select name='address'>
                    <option value='1600 PENNSYLVANIA AV'> 1600 PENNSYLVANIA AV </option>
                    <option value='24 SUSSEX DRIVE'> 24 SUSSEX DRIVE </option>
                    <option value='10 DOWNING STREET'> 10 DOWNING STREET </option>
                    <option value='LOS PINOS'> LOS PINOS </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> phone: </td>
            <td>
                <select name='phone'>
                    <option value='456 1414'> 456 1414 </option>
                    <option value='239 5000'> 239 5000 </option>
                    <option value='79250918'> 79250918 </option>
                    <option value='682 9822'> 682 9822 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> date: </td>
            <td>
                <select name='date'>
                    <option value='07 04 76'> 07 04 76 </option>
                    <option value='07 01 67'> 07 01 67 </option>
                    <option value='04 03 21'> 04 03 21 </option>
                    <option value='05 05 62'> 05 05 62 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> amount: </td>
            <td>
                <select name='amount'>
                    <option value='$1776.00'> $1776.00 </option>
                    <option value='$1867.00'> $1867.00 </option>
                    <option value='$1721.00'> $1721.00 </option>
                    <option value='$1862.00'> $1862.00 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> comment: </td>
            <td>
                <select name='comment'>
                    <option value='*USA*'> *USA* </option>
                    <option value='*CANADA*'> *CANADA* </option>
                    <option value='*ENGLAND*'> *ENGLAND* </option>
                    <option value='*MEXICO*'> *MEXICO* </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=center colspan=2>
                <input type='submit' name='Execute' value='EnterAdd'>
                <input type='submit' name='Execute' value='Cancel'>
            </td>
        </tr>
<%
            }
            else if (m_update == true)
            {
%>
        <tr>
            <td align=center colspan=2>
            </td>
        </tr>
        <tr>
            <td align=right> number: </td>
            <td>
                <b> <%=m_number%> </b> 
                <input type='hidden' name='number' value='<%=m_number%>'>
            </td>
        </tr>
        <tr>
            <td align=right> name: </td>
            <td>
                <select name='name'>
                    <option value='GEORGE WASHINGTON'<%=("GEORGE WASHINGTON".equals(m_name) ? " selected" : "")%>> GEORGE WASHINGTON </option>
                    <option value='SIR JOHN A MACDONALD'<%=("SIR JOHN A MACDONALD".equals(m_name) ? " selected" : "")%>> SIR JOHN A MACDONALD </option>
                    <option value='ROBERT WALPOLE'<%=("ROBERT WALPOLE".equals(m_name) ? " selected" : "")%>> ROBERT WALPOLE </option>
                    <option value='GUADALUPE VICTORIA'<%=("GUADALUPE VICTORIA".equals(m_name) ? " selected" : "")%>> GUADALUPE VICTORIA </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> address: </td>
            <td>
                <select name='address'>
                    <option value='1600 PENNSYLVANIA AV'<%=("1600 PENNSYLVANIA AV".equals(m_address) ? " selected" : "")%>> 1600 PENNSYLVANIA AV </option>
                    <option value='24 SUSSEX DRIVE'<%=("24 SUSSEX DRIVE".equals(m_address) ? " selected" : "")%>> 24 SUSSEX DRIVE </option>
                    <option value='10 DOWNING STREET'<%=("10 DOWNING STREET".equals(m_address) ? " selected" : "")%>> 10 DOWNING STREET </option>
                    <option value='LOS PINOS'<%=("LOS PINOS".equals(m_address) ? " selected" : "")%>> LOS PINOS </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> phone: </td>
            <td>
                <select name='phone'>
                    <option value='456 1414'<%=("456 1414".equals(m_phone) ? " selected" : "")%>> 456 1414 </option>
                    <option value='239 5000'<%=("239 5000".equals(m_phone) ? " selected" : "")%>> 239 5000 </option>
                    <option value='79250918'<%=("79250918".equals(m_phone) ? " selected" : "")%>> 79250918 </option>
                    <option value='682 9822'<%=("682 9822".equals(m_phone) ? " selected" : "")%>> 682 9822 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> date: </td>
            <td>
                <select name='date'>
                    <option value='07 04 76'<%=("07 04 76".equals(m_date) ? " selected" : "")%>> 07 04 76 </option>
                    <option value='07 01 67'<%=("07 01 67".equals(m_date) ? " selected" : "")%>> 07 01 67 </option>
                    <option value='04 03 21'<%=("04 03 21".equals(m_date) ? " selected" : "")%>> 04 03 21 </option>
                    <option value='05 05 62'<%=("05 05 62".equals(m_date) ? " selected" : "")%>> 05 05 62 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> amount: </td>
            <td>
                <select name='amount'>
                    <option value='$1776.00'<%=("$1776.00".equals(m_amount) ? " selected" : "")%>> $1776.00 </option>
                    <option value='$1867.00'<%=("$1867.00".equals(m_amount) ? " selected" : "")%>> $1867.00 </option>
                    <option value='$1721.00'<%=("$1721.00".equals(m_amount) ? " selected" : "")%>> $1721.00 </option>
                    <option value='$1862.00'<%=("$1862.00".equals(m_amount) ? " selected" : "")%>> $1862.00 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=right> comment: </td>
            <td>
                <select name='comment'>
                    <option value='*USA*'<%=("*USA*".equals(m_comment) ? " selected" : "")%>> *USA* </option>
                    <option value='*CANADA*'<%=("*CANADA*".equals(m_comment) ? " selected" : "")%>> *CANADA* </option>
                    <option value='*ENGLAND*'<%=("*ENGLAND*".equals(m_comment) ? " selected" : "")%>> *ENGLAND* </option>
                    <option value='*MEXICO*'<%=("*MEXICO*".equals(m_comment) ? " selected" : "")%>> *MEXICO* </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=center colspan=2>
                <input type='submit' name='Execute' value='EnterUpdate'>
                <input type='submit' name='Execute' value='Cancel'>
            </td>
        </tr>
<%
            }
            else
            {
%>
        <tr>
            <td align=right> Number: </td>
            <td>
                <select name='number'>
                    <option value='900123'<%=("900123".equals(m_number) ? " selected" : "")%>> 900123 </option>
                    <option value='900234'<%=("900234".equals(m_number) ? " selected" : "")%>> 900234 </option>
                    <option value='900345'<%=("900345".equals(m_number) ? " selected" : "")%>> 900345 </option>
                    <option value='900456'<%=("900456".equals(m_number) ? " selected" : "")%>> 900456 </option>
                </select>
            </td>
        </tr>
        <tr>
            <td align=center colspan=2>
                <input type='submit' name='Execute' value='AddEntry'>
                <input type='submit' name='Execute' value='UpdateEntry'>
                <input type='submit' name='Execute' value='QueryEntry'>
            </td>
        </tr>
<%
                if (m_query == true)
                {
%>
        <tr>
            <td align=center colspan=2> </td>
        </tr>
        <tr>
            <td align=right> number: </td>
            <td> <b> <%=m_number%> </b> </td>
        </tr>
        <tr>
            <td align=right> name: </td>
            <td> <%=m_name%> </td>
        </tr>
        <tr>
            <td align=right> address: </td>
            <td> <%=m_address%> </td>
        </tr>
        <tr>
            <td align=right> phone: </td>
            <td> <%=m_phone%> </td>
        </tr>
        <tr>
            <td align=right> date: </td>
            <td> <%=m_date%> </td>
        </tr>
        <tr>
            <td align=right> amount: </td>
            <td> <%=m_amount%> </td>
        </tr>
        <tr>
            <td align=right> comment: </td>
            <td> <%=m_comment%> </td>
        </tr>
        <tr>
            <td align=center colspan=2> </td>
        </tr>
<%
                }
            }
%>
        <tr>
            <td align=center colspan=2>
                <input type='submit' name='Execute' value='disconnect'>
            </td>
        </tr>
<%
        }
%>
        <tr> <td align=center colspan=2>returnCode [<%=m_returnCode%>] </td> </tr>
    </table>
</form>
</body>
</html>

Source code for sun-web.xml

Required when deploying to SunOne.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sun-web-app PUBLIC
 '-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Servlet 2.3//EN'
 'http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_3-0.dtd'>

<sun-web-app>
	<session-config>
		<session-manager persistence-type="memory">
			<manager-properties/>
			<store-properties/>
		</session-manager>
		<session-properties/>
		<cookie-properties/>
	</session-config>
	<resource-ref>
		<res-ref-name>eis/BridgeAPI</res-ref-name>
		<jndi-name>eis/BridgeAPI</jndi-name>
	</resource-ref>
	<cache max-entries="4096" timeout-in-seconds="30" enabled="false">
		<default-helper/>
	</cache>
	<jsp-config>
		<property name="classdebuginfo" value="true">
			<description>Enable debug info compilation in the generated servlet class</description>
		</property>
		<property name="mappedfile" value="true">
			<description>Maintain a one-to-one correspondence between static content and the generated servlet class' java code</description>
		</property>
	</jsp-config>
</sun-web-app>

Source code for web.xml

Required for all application servers.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
	<display-name>AMNU RA Sample WAR</display-name>
	<session-config>
		<session-timeout> 30 </session-timeout>
	</session-config>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<resource-ref>
		<description>BridgeAPI</description>
		<res-ref-name>eis/BridgeAPI</res-ref-name>
		<res-type>javax.resource.cci.ConnectionFactory</res-type>
		<res-auth>Container</res-auth>
		<res-sharing-scope>Unshareable</res-sharing-scope>
	</resource-ref>
</web-app>

Source code for weblogic.xml

Required when deploying to WebLogic.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE weblogic-web-app PUBLIC
 '-//BEA Systems, Inc.//DTD Web Application 7.0//EN'
 'http://www.bea.com/servers/wls700/dtd/weblogic700-web-jar.dtd'>

<weblogic-web-app>
	<description>AMNU RA Sample WAR</description>
	<reference-descriptor>
		<resource-description>
			<res-ref-name>eis/BridgeAPI</res-ref-name>
			<jndi-name>eis/BridgeAPI</jndi-name>
		</resource-description>
	</reference-descriptor>
	<session-descriptor>
		<session-param>
			<param-name>URLRewritingEnabled</param-name>
			<param-value>true</param-value>
		</session-param>
		<session-param>
			<param-name>IDLength</param-name>
			<param-value>52</param-value>
		</session-param>
		<session-param>
			<param-name>CookieComment</param-name>
			<param-value>WebLogic Server Session Tracking Cookie</param-value>
		</session-param>
		<session-param>
			<param-name>CookieMaxAgeSecs</param-name>
			<param-value>-1</param-value>
		</session-param>
		<session-param>
			<param-name>CookieName</param-name>
			<param-value>JSESSIONID</param-value>
		</session-param>
		<session-param>
			<param-name>InvalidationIntervalSecs</param-name>
			<param-value>60</param-value>
		</session-param>
		<session-param>
			<param-name>JDBCConnectionTimeoutSecs</param-name>
			<param-value>120</param-value>
		</session-param>
		<session-param>
			<param-name>PersistentStoreCookieName</param-name>
			<param-value>WLCOOKIE</param-value>
		</session-param>
		<session-param>
			<param-name>PersistentStoreDir</param-name>
			<param-value>session_db</param-value>
		</session-param>
		<session-param>
			<param-name>PersistentStoreType</param-name>
			<param-value>memory</param-value>
		</session-param>
		<session-param>
			<param-name>PersistentStoreTable</param-name>
			<param-value>wl_servlet_sessions</param-value>
		</session-param>
		<session-param>
			<param-name>CookiesEnabled</param-name>
			<param-value>true</param-value>
		</session-param>
		<session-param>
			<param-name>TrackingEnabled</param-name>
			<param-value>true</param-value>
		</session-param>
		<session-param>
			<param-name>TimeoutSecs</param-name>
			<param-value>3600</param-value>
		</session-param>
	</session-descriptor>
	<context-root>/AmnuRaSample</context-root>
</weblogic-web-app>

Source code for orion-web.xml

Required when deploying to Oracle.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE orion-web-app PUBLIC
 "-//Evermind//DTD Orion Web Application 2.3//EN"
 "http://xmlns.oracle.com/ias/dtds/orion-web.dtd">

<orion-web-app>
	<resource-ref-mapping location="BridgeAPI" name="eis/BridgeAPI"/>
</orion-web-app>

Oracle specific source code

With Oracle you can use ORMI to find a resource adapter by its JNDI name inside an enterprise application. Refer to the Oracle application server documentation for complete instructions on how to do this.


Source code for application.xml

Required for all application servers.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE application PUBLIC
 "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
 "http://java.sun.com/dtd/application_1_3.dtd">

<application>
	<display-name>BridgeAPI_EAR</display-name>
	<module>
		<connector>BridgeAPI.rar</connector>
	</module>
	<module>
		<ejb>BridgeAPI-ejb.jar</ejb> 
	</module>
	<module>
		<web>
			<web-uri>AmnuRaSample.WAR</web-uri>
			<context-root>/AmnuRaSample</context-root>
		</web>
	</module>
</application>

Placing BridgeAPI-ra-client.jar in Application Server class path

The BridgeAPI-ra-client.jar is not required in the Application Server class path if the sample WAR is repackaged inside the BridgeAPI.ear before deployment.

To deploy the EAR and WAR separately
  1. Modify the Application Servers class path to include the BridgeAPI-ra-client.jar, or perform the required steps in the Application server table (below.

  2. Restart the applicaiton server.

  3. Deploy the BridgeAPI.ear and sample WAR to the application server.

Application server

Description

WebLogic Place the BridgeAPI-ra-client.jar file in the [install dir]/weblogic81/server/ext directory. In directory [install dir]/user_projects/domains/your domain edit the startWebLogic.sh & startManagedWebLogic.sh files and modify set CLASSPATH= line to include %WL_HOME%/server/ext/BridgeAPI-ra-client.jar .
SunOne Place the BridgeAPI-ra-client.jar file in the /var/appserver/domains/domain1/server1/lib directory. Through the administration console add /var/appserver/domains/domain1/server1/lib/BridgeAPI-ra-client.jar to the Classpath Suffix (found in tree under Server / JVM Settings / Path Settings ).
WebSphere Place the BridgeAPI-ra-client.jar file in the [install dir]/WebSphere/AppServer/lib/ext directory.
Oracle Place the BridgeAPI-ra-client.jar file in the [install dir]/j2ee/home/lib directory.

Related Topics
Bullet RA and EJB Requestors
Bullet Packaging Enterprise Applications
Bullet RA and EJB Requestor Errors
Bullet J2EE Sample Code: Accessing the Stateful Session EJB in a Web Application
  Attachmate