Deploying a BC4J Web Application to JBoss

This topic describes in detail the requirements and steps to deploy the BC4J runtime components as well as a BC4J application as both a J2EE web module (WAR) and as Enterprise JavaBeans (EJB) to JBoss 3.0.4 with Apache Tomcat 4.1.12.

Note: The information in this topic is also available from http://otn.oracle.com/products/jdev/howtos/appservers/deploy_bc4j_to_jboss.html

To deploy BC4J web applications to JBoss:

  1. Create a BC4J project.
  2. On Step 1 of the Business Components Project Wizard, change the SQL Flavor to SQL92 and the Type Map to Java. This change is required since we will be using the JBoss emulated XA DataSource implementation when the BC4J application is deployed as an EJB session bean.
  3. Create an entity object with the default view object and the default application module in the Business Components Wizard.
  4. Start JBoss
  5. Start JBoss using the setvars.bat script on Windows.

    On UNIX (Bourne Shell), set the JAVA_HOME environment variable and add the Java2 SDK's bin directory to your PATH. For example:

    export JAVA_HOME=/usr/java/jdk1.4
    export PATH=${PATH}:${JAVA_HOME}/bin

  6. Execute the run_with_catalina script (or run_with_tomcat script) located in the JBoss/bin directory. For example:

    C:/JBoss-3.0.4_Tomcat-4.1.12/jboss/bin

    After JBoss is started, several lines appear in the command shell.

  7. Once started, verify that JBoss with Tomcat 4.0.1 is running by entering:

    http://localhost:8080/jboss/index.html

  8. To deploy the BC4J application to JBoss, you must copy the following BC4J runtime libraries to the <JBOSS_install>/lib/ext directory on your computer. For example:
    C:/JBoss-3.0.4_Tomcat-4.1.1/jboss/lib/ext
  • %jdev_install%\bc4j\lib\bc4jct.jar
  • %jdev_install%\bc4j\lib\bc4jctejb.jar
  • %jdev_install%\bc4j\lib\bc4jdomorcl.jar
  • %jdev_install%\bc4j\lib\bc4jhtml.jar
  • %jdev_install%\bc4j\lib\bc4jimdomains.jar
  • %jdev_install%\bc4j\lib\bc4jmt.jar
  • %jdev_install%\bc4j\lib\bc4jmtejb.jar
  • %jdev_install%\bc4j\lib\bc4juixtags.jar
  • %jdev_install%\bc4j\lib\collections.jar
  • %jdev_install%\bc4j\lib\datatags.jar
  • %jdev_install%\bc4j\lib\uixtags.jar
  • %jdev_install%\bc4j\redist\cabo.war
  • %jdev_install%\jdbc\lib\classes12.jar
  • %jdev_install%\jdbc\lib\nls_charset12.jar
  • %jdev_install%\jdev\lib\jdev-rt.jar
  • %jdev_install%\jlib\jdev-cm.jar
  • %jdev_install%\jlib\uix2.jar
  • %jdev_install%\jlib\share.jar
  • %jdev_install%\jlib\regexp.jar
  • %jdev_install%\lib\xmlparserv2.jar
  • %jdev_install%\ord\jlib\ordim.jar
  • %jdev_install%\ord\jlib\ordhttp.jar
  • %jdev_install%\sqlj\lib\runtime12.jar

Note: where %jdev_install% refers to the directory where JDeveloper is installed. You can also use the installbc4j.bat Windows script to copy these files.

  1. If you are using BC4J web applications, you must also deploy the bc4j.ear file by copying this file from <jdev_install>/BC4J/redist to <JBOSS_install>\deploy. For example:
    C:\JBoss-3.0.4_Tomcat-4.1.12\jboss\deploy
    This file contains the required web application and UIX files required for deployment. You only need to perform this task once, not every time a BC4J web application is deployed.
  2. Restart JBoss after copying these files to the JBoss lib\ext directory.
  3. Create a library in JDeveloper for the JBoss client side libraries to test an EJB deployed inside JBoss. The client side libraries from JBoss are located in the client directory under the JBoss directory, for example, C:\JBoss-3.0.4\client, and are used to test an EJB deployed within JBoss. See Including Libraries in a Project.

To deploy BC4J applications as a WAR to JBoss:

If you are deploying the BC4J application as an EJB session bean, see Deploying BC4J as an EJB Session to JBoss section. The Business Components for Java Deployment Wizard deploys BC4J applications.

  1. In the Navigator, select the bc4j_project_icon <ProjectName>.bcdeploy deployment profile you want to deploy.
  2. Right-click and choose Deploy.

    JDeveloper creates the BC4J simple archive file and writes it to the output directory. You can view the deployment messages in the Deployment Log window.

After creating a BC4J JSP application, package the middle-tier JAR file with the WAR. The default name for this JAR file is Project1CSMT.jar.

Creating a BC4J JSP Application.

To test the business components for Java, create a JSP application which will use them.

  1. Create a new empty project.
  2. Using the Business Components JSP Application wizard, create a default JSP Application for the BC4J objects just created.
  3. From the main menu, choose File | Save All.

Deploying the BC4J JSP Application.

When you create a default BC4J JSP Application, a default deployment profile will be automatically created. The name of this profile is <myappwar>.deploy.

Here are the steps to deploy our WAR file:

  1. In the Navigator, right-clickWAR_dep_profile_icon <myappwar>.deploy, and choose Deploy to WAR file from the context menu .
  2. In the Deployment Log window, a message displays the location of the newly created WAR file. Copy this file to the JBoss\deploy directory.

You now have a fully functional BC4J JSP application deployed as a web module. You may now invoke the application in your web browser by entering the application URL similar to the following:

http://localhost:8080/<context root>

where <context root> is the J2EE context root for your project containing the BC4J JSP application. For example, Workspace1-Project1-context-root/.

References