### Integrating remote JReport Enterprise Server with IBM WebSphere 5.0 by a WAR file

Here is an example illustrating the case of using JSPs based on remote server APIs to integrate with IBM WebSphere 5.0.

It is assumed that:

- WebSphere 5.0 is installed in `C:\WebSphere`.
- JReport Enterprise Server is installed in `C:\JReport\Server`.
- JReport jsp.war file is located in `C:\jsp`.

Take the following steps to integrate remote JReport Enterprise Server with IBM WebSphere 5.0:

1. Generate a WAR file.
2. Configure JReport Enterprise Server.
3. Deploy the WAR file.

Below show the details for each step:

#### Generating the WAR file

1. Create a new directory in your local disk, e.g. `c:\jsp`.
2. Create a sub directory WEB-INF in it: `c:\jsp\WEB-INF`.
3. Generate a web.xml like following and put it in `c:\jsp\WEB-INF`.

       <?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>

       <context-param>
       <param-name>jrs.remote.host</param-name>
       <param-value>127.0.0.1</param-value>
       </context-param>

       <context-param>
       <param-name>jrs.remote.rmiport</param-name>
       <param-value>1129</param-value>
       </context-param>

       <!-- The third param(jrs.rmi.auth_file) is optional.
       "authFileName" includes the auth file's realpath and auth file name. For example: C:\JReport\Server\bin\rmi.auth.
       The content of the auth file specified here should be kept consistent with that of the auth file used
       by JReport Enterprise Server, though there is no need to point to the same auth file.-->

       <context-param>
       <param-name>jrs.rmi.auth_file</param-name>
       <param-value>C:\JReport\Server\bin\rmi.auth</param-value>
       </context-param>

       <filter>
       <filter-name>Character Encoding</filter-name>
       <filter-class>jet.server.servlets.CharacterEncodingFilter</filter-class>
       <init-param>
       <param-name>encoding</param-name>
       <param-value>UTF-8</param-value>
       </init-param>
       </filter>

       <filter-mapping>
       <filter-name>Character Encoding</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>

       <servlet>
       <servlet-name>sendfile</servlet-name>
       <servlet-class>jet.server.servlets.SendFileServlet</servlet-class>
       </servlet>

       <servlet>
       <servlet-name>dhtml</servlet-name>
       <servlet-class>jet.web.dhtml.DHTMLlet</servlet-class>
       </servlet>

       <servlet>
       <servlet-name>jrdhtml</servlet-name>
       <servlet-class>jet.web.dhtml.DHTMLRunReportlet</servlet-class>
       </servlet>

       <servlet>
       <servlet-name>help</servlet-name>
       <servlet-class>jet.web.dhtml.JHelplet</servlet-class>
       </servlet>

       <servlet-mapping>
       <servlet-name>sendfile</servlet-name>
       <url-pattern>/sendfile/*</url-pattern>
       </servlet-mapping>

       <servlet-mapping>
       <servlet-name>dhtml</servlet-name>
       <url-pattern>/dhtml/*</url-pattern>
       </servlet-mapping>

       <servlet-mapping>
       <servlet-name>jrdhtml</servlet-name>
       <url-pattern>/jrdhtml/*</url-pattern>
       </servlet-mapping>

       <servlet-mapping>
       <servlet-name>help</servlet-name>
       <url-pattern>/help/*</url-pattern>
       </servlet-mapping>

       </web-app>

4. Create a directory lib in `c:\jsp\WEB-INF`.
5. Copy the class files JREngine.jar, JRESServlets.jar, JRWebDesign.jar, log4j-1.2.8.jar and sac.jar from `C:\JReport\Server\lib` to `C:\jsp\WEB-INF\lib`.
6. Create a jar file to include the resources folder which is located in server installation root and name it languages.jar. For example, run the following command:

   `C:\JReport\Server>jar -cvf languages.jar resources`

   Then put the jar in `C:\jsp\WEB-INF\lib`.

7. Copy all the folders in `C:\JReport\Server\public_html` to `c:\jsp`. If you are not using remote administration functions you can remove the admin directory.
8. Optionally copy the folder help in `C:\JReport\Server` to `C:\jsp`. Remove all the directories except for help\server\en\userguide. If you copy the help folders then you can remove the JHelplet servlet from the web.xml file. The help documents will be served locally rather than go through the remote JHelplet servlet.
9. Use the following command to create a WAR file, and name it as jsp.war:

   `C:\jsp>jar -cvf jsp.war *`

#### Configuring JReport Enterprise Server

1. Make sure JReport Enterprise Server has been started once in order that the server.properties file is generated.
2. Change server.properties file in `<server_install_root>\bin` as follows:

   `server.rmiserver.enable=true
   server.rmiadminservice.enable=true`

   Note: You only need to turn on server.rmiadminservice if you include the admin JSP pages from public_html.

#### Deploying the WAR file

1. Start IBM WebSphere 5.0.
2. Open the Administrative Console.

   You can open the Administrative Console by using the Start menu, or by using the URL: `http://hostname:9090/admin/`, where the hostname is host name or IP address, and 9090 is the port number.

3. After successfully log in, expand the Applications node, and then click Install New Application.
4. Click Browse to select your .war file. In the Context Root field, type a context path such as /jsp, and then click Next.
5. Do not check any option on this page, click Next.
6. On the Step 1: Provide options to perform the installation page, type JReport JSP in the Application Name field, and then click Next.
7. Do not make any changes to the next two pages.
8. Click Finish on the Summary page. The installing process may take several minutes, wait until the process is completed.
9. After the installation process successfully completed, click Save to Master Configuration, and then click Save.
10. Start JReport Enterprise Server and access it using the following URL:

    `http://localhost:9080/jsp/jinfonet/index.jsp`