#### Deploying to JBoss 3.0.7

Take the following steps to deploy JReport Engine Bean as an EJB to JBoss 3.0.7:

1. Preparation
2. Building and deploying the JReport demo program
3. Running the client application
4. Managing the entity beans

##### Preparation

Assume that:

- Java TM 2 SDK Version 1.4.1 has been installed to `C:\j2sdk1.4.1_01`;
- JReport Designer has been installed to `C:\JReport\Designer`;
- JBoss 3.0.7 with integrated Tomcat 4.1.24 has been installed to `D:\jboss-3.0.7_jakarta-tomcat-4.1.24`.

In order to simplify your work, you are provided with a zip called ant_jreport_ejb.zip, which can be found in `<designer_install_root>\help\designer\samples`. You can extract it to `D:\jboss-3.0.7_jakarta-tomcat-4.1.24 directory`. This zip file contains a build utility Ant and the JReport EJB demo source code.

- Ant is a third party tool, which compiles the Java source code, builds the EJB.jar, and deploys the JAR by copying it to JBoss's deploy folder.

  A file called build.xml is also included in the zip file. This is required by the Ant utility for working out what to compile and how to build your JARs. It gives the Ant utility information about how to compile and deploy your Java programs and EJBs. You can find the build.xml file in the `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb` folder created by the extraction process.

  If you need to know more about the Ant utility, visit the Ant project at the Jakarta website at http://jakarta.apache.org/ant/index.html.

- In jreport_ejb folder, there is a folder src, which contains the JReport EJB demo source code (`workbook/src/main/jreport`) and two xml files used in JBoss deployment (`workbook/src/resources/META-INF)`.

##### Building and deploying the JReport demo program

Follow the steps below to build and deploy the demo program:

1. Copy JREngine.jar in `C:\``JReport\Designer\lib` to `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\client`.
2. In the Command Prompt window, switch to the `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb` folder that was created by the extraction process.
3. Set the JAVA_HOME and JBOSS_HOME environment variables to point to where your JDK and JBoss 3.0.7 have been installed:

       D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb>
       set JAVA_HOME=C:\j2sdk1.4.1_01
       D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb>
       set JBOSS_HOME=D:\jboss-3.0.7_jakarta-tomcat-4.1.24

4. Add Ant to your execution path.

   `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb> set PATH=..\ant\bin;%PATH%`

5. Change the path and key information in JREngineClient.java according to your own environment in the file ant_jreport_ejb.zip.
6. Issue the command Ant and press the Enter key as follows:

   `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb>ant`

   A screen message will then be shown as below:

       Buildfile: build.xml
       prepare:
       compile:
       [javac] Compiling 1 source file to
       D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb\build\classes
       ejbjar:
       [jar] Building jar:
       D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb\build\sdk_egbn_ejb_jrengine.jar
       [copy] Copying 1 file to D:\jboss-3.0.7_jakarta-tomcat-4.1.24\server\default\deploy
       BUILD SUCCESSFUL
       Total time: 3 seconds

The ejb_jrengine.jar has now been successfully built and deployed to `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\server\default\deploy`.

##### Running the client application

Perform the following tasks:

1. Open a Command Prompt window, and change to the `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\bin` folder.
2. Invoke the JBoss Server using run.bat, located in `<JBossServer_install_root>\bin` folder.

   Note: Before you run the batch file, be sure to add the bold part of the following to the class path:

   `set JBOSS_CLASSPATH= C:\JReport\Designer\lib\JREngine.jar;C:\JReport\Designer\lib\sac.jar;C:\JReport\Designer\lib\log4j-1.2.8.jar;C:\JReport\Designer\lib\Itext.zip; %JBOSS_CLASSPATH%;%JAVAC_JAR%;%RUNJAR%`

3. In another Command Prompt window, run the JREngineClient application by invoking ant run.client_jreport. Remember to set your JBOSS_HOME and PATH environment variables.

   `D:\jboss-3.0.7_jakarta-tomcat-4.1.24\workbook\jreport_ejb>ant run.client_jreport`

   The output of JREngineClient will look something like this:

       Buildfile: build.xml
       prepare:
       compile:
       ejbjar:
       run.client_jreport:
       [java] ReportHome: true
       [java] ReportName: true
       [java] CatName: true
       [java] RstName: true
       [java] getStatus = OK
       [java] exportToPdf OK
       [java] Exit
       BUILD SUCCESSFUL
       Total time: 15 seconds

   Three files: CustomerList.pdf, CustomerList.rst and JReport.log, specified in JREngineClient.java, will be generated in `C:\JReport\Designer\temp`.

Note: You will need a User ID and a JReport Runtime Key to run the JReport client application. If you do not have this, contact Jinfonet Software sales at sales@jinfonet.com or visit Jinfonet website http://www.jinfonet.com for more information.

##### Managing the entity beans

Every EJB in JBoss is deployed and managed as a JMX MBean. You can view and manage EJBs deployed within JBoss through your web browser by accessing the JMX management console. The console is available at `http://localhost:8080/jmx-console/index.jsp`.