Manually Configuring Apache Tomcat With or Without Apache HTTP Server

Topics:

Note: If you chose the option for the WebFOCUS installation to install Tomcat, you can skip this chapter.

This section explains how to install and configure Apache Tomcat, with or without Apache HTTP web server. There are two configurations available when using Apache Tomcat:

This section contains information for installing and configuring Tomcat and setting up the connection between the HTTP and Tomcat Servers. If you are using the HTTP Server, it should already be installed. Apache HTTP Server 2 is recommended, but 1.3 should work.

Steps are the following:

  1. If it is not installed, install Tomcat 8.
  2. Set environment variables and create contexts to deploy WebFOCUS web applications, as explained in Tomcat Configuration.
  3. If you are using Apache HTTP Server to serve WebFOCUS content, create aliases, as explained in Configuring Apache HTTP Server.
  4. If you are using Apache HTTP Server, configure communications between Tomcat and the HTTP Server, as explained in Connecting Apache HTTP and Tomcat Servers.
  5. Verify the configuration, as explained in Verifying the WebFOCUS Configuration With Tomcat and Apache HTTP Server.

Preparing Tomcat for WebFOCUS Configuration

How to:

To prepare Tomcat for WebFOCUS, you need to choose how to create WebFOCUS graphs and add the ReportCaster JDBC driver.

Procedure: How to Configure Tomcat for WebFOCUS Graphs

To generate graphs, WebFOCUS Servlets either need access to an X Server or they can use the Java VM headless option. You can set either by editing the catalina.sh file.

  • DISPLAY. If an X Windows Server is available, you should set a DISPLAY environment variable. Open the following file in a text editor:
    /tomcat_home/bin/catalina.sh

    Near the beginning of the file just after the commented section, add the appropriate DISPLAY definition. For example:

    DISPLAY=xserver_host:0.0
    export DISPLAY
    TERM=xterm
    export TERM

    where:

    xserver_host

    Is the host name or IP Address of a machine that is running an X server.

    Note: Graphs are not actually displayed on the machine you set to DISPLAY, but WebFOCUS Servlets must access this X Server to generate graphs. After finishing this chapter, be sure to review the tests to verify graphs in Verifying and Troubleshooting Server Side Graphics (PCHOLD).

  • Headless. If an X Windows Server is not available, you can set the headless Java VM option. However, be aware that headless does not support GIF files or the older WebFOCUS graph engine (GRAPH32). Open the following file in a text editor:
    /tomcat_home/bin/catalina.sh

    You can add the headless option by setting the $JAVA_OPTS variable. Near the beginning of the file, just after the commented section, add the following line:

    export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"

Procedure: How to Set the Tomcat CLASSPATH for the WebFOCUS Repository

Before a WebFOCUS application can connect to the WebFOCUS repository, you must first add the location of a JDBC driver to the CLASSPATH in setclasspath.sh.

  1. Open the following file in a text editor:
    /tomcat_home/bin/catalina.sh 
  2. Find the line that sets CLASSPATH. For example:
    CLASSPATH=/home/oracle/oracle/ojdbc6.jar

    Note: If there is more than one jar file, it should be appended, separated by a colon (:).

  3. Append a colon followed by the path to the JDBC drivers for your repository. Include any ZIP or JAR files. For example:
    CLASSPATH="$JAVA_HOME"/lib/tools.jar:/home/oracle/oracle/ojdbc6.jar                

    Note: You must include the full path including the file name. Specifying a directory is not sufficient.

  4. Save and close the editor.

Deploying WebFOCUS Web Applications With Tomcat

How to:

Reference:

Configuring Tomcat mainly requires telling Tomcat where WebFOCUS files are located and the context roots in which to use them. For example, you must tell Tomcat to serve files from the WebFOCUS web application:

/install_directory/ibi/WebFOCUS82/webapps/webfocus

When it receives a request for the WebFOCUS context root:

http://TomcatHost:tomcatHTTPport/ibi_apps

By creating this context, you deploy the WebFOCUS web application.

  • When using Tomcat as the application server and Apache HTTP Server as the web server, create only the following context on Tomcat:

    Context (path): /ibi_apps

    Directory (DocumentBase): /install_directory/ibi/WebFOCUS82/webapps/webfocus

    The approot context is then created as aliases on the HTTP Server. The HTTP Server is then configured to send requests for ibi_apps to Tomcat. However, this assumes the HTTP Server handles some WebFOCUS content directly. If you want the HTTP Server to only forward requests through a firewall, do not create aliases on the HTTP Server, but instead configure Tomcat to handle all WebFOCUS content.

  • When using Tomcat as both web and application server, the following contexts must be created:

    Context (path)

    Directory (DocumentBase)

    /ibi_apps
    /install_directory/ibi/WebFOCUS82/webapps/webfocus
    /ibi_help
    /install_directory/ibi/WebFOCUS82/webapps/ibi_help
    /approot
    /install_directory/ibi/apps

    Tomcat can be used as both a web server and application server, so Tomcat can also serve files outside of a web application after it knows their location and context. On a traditional web server, you create aliases. With Tomcat, a traditional web server alias is treated like a context root, even when serving files outside of a web application.

Procedure: How to Create Contexts

There are several ways to create contexts:

  • You can manually create individual XML files for each web application or context under /tomcat_home/conf/Catalina/localhost.
  • You can edit server.xml to define contexts.
  • You can copy webfocus.war to /tomcat_home/webapps and then rename it to ibi_apps.war.
  • You can use the Tomcat web-based tools.

This procedure explains how to create contexts using the web-based tools. When you create a context for a web application, the web application is deployed.

To create contexts for Tomcat 8, Information Builders recommends creating or editing XML files in the following directory to define the contexts:

/tomcat_home/conf/Catalina/localhost

Reference: Reloading Web Applications

This is not a consideration if you just installed WebFOCUS for the first time, but you should be aware of it for when you install a service pack or new release. When you upgrade WebFOCUS or install a service pack, Tomcat must use the new web applications rather than cached copies of the old version.

  • If you install a service pack in the same location and you had deployed the expanded directories, the new web applications should be used automatically, but you should remove the following work directories and then restart Tomcat.
    /tomcat_home/work/Catalina/localhost/ibi_apps
    /tomcat_home/work/Catalina/localhost/ibi_help

    Note: The redirect.war file is available for redirecting custom applications with URLs containing rcaster as the ReportCaster context root. If you are planning to deploy this file, you should also remove the following work directory and then restart Tomcat:

    /tomcat_home/work/Catalina/localhost/rcaster
  • If you are installing in a different location or you deployed WAR files, you need to completely remove the existing WebFOCUS contexts and then recreate them. To remove contexts, you can use the Tomcat Manager Tool or remove the corresponding files and directories of the context. For example:
    /tomcat_home/conf/Catalina/localhost/ibi_apps.xml
    /tomcat_home/work/Catalina/localhost/ibi_apps
    /tomcat_home/webapps/ibi_apps

    Note: When you deploy WAR files, Tomcat expands them into its own directory structure and does not always know the original location.

Configuring Apache HTTP Server

How to:

Tomcat can be used with or without Apache HTTP Server.

  • If you are using Tomcat without the HTTP Server, you should have created the approot alias as a Tomcat context. If you are not using the HTTP Server, proceed to Verifying the WebFOCUS Configuration With Tomcat and Apache HTTP Server.
  • If you are using Tomcat with the HTTP Server, you need to create aliases and configure communications between the HTTP Server and Tomcat.

To create aliases, edit the httpd.conf configuration file as explained below making sure to replace install_directory with the correct path on your machine. If you changed the default names for the WebFOCUS aliases and context root (/ibi_apps), substitute accordingly.

Procedure: How to Modify the Apache httpd.conf File

  1. Using a text editor, open the httpd.conf file located in the /apache_home/conf directory.
  2. Add the following lines in the Alias section making sure to use the correct install_directory on your machine:
    • Point an alias to the apps directory.
      Alias /approot/ "/install_directory/ibi/apps/"

    For example:

    Alias /approot/ "/home/iadmin/ibi/apps/"
    Alias /icons/ "/usr/apache2/icons/"
  3. Save and close the file.
  4. Restart the HTTP Server.

Connecting Apache HTTP and Tomcat Servers

How to:

There are many different ways to connect from Apache HTTP Server to Tomcat. This section addresses JK1.2, mod_jk. If you wish to use another approach, such as ProxyPass or JK2, refer to Apache and Tomcat documentation.

The following files are needed for Apache to connect to Tomcat when using JK1.2:

mod_jk.so

Provides binary instructions for Apache to connect to Tomcat. See How to Download or Build the mod_jk.so File.

workers.properties

Provides configuration information needed by the mod_jk.so binary. See How to Create the mod_jk.conf File.

mod_jk.conf

Tells Apache to load the mod_jk.so binary and use settings in workers.properties. See How to Create the workers.properties File.

httpd.conf

Tells Apache to Include mod_jk.conf. See How to Edit httpd.conf to User JK1.2.

Additional documentation on using the JK1.2 connector is available at:

http://tomcat.apache.org/connectors-doc/index.html

Procedure: How to Download or Build the mod_jk.so File

The mod_jk.so binary must be compiled specifically for your platform and Apache HTTP Server release (1.3 or 2.0). Binaries and source code can be downloaded from:

http://jakarta.apache.org/tomcat/connectors-doc/index.html
  1. Test the WebFOCUS web application by going to the following URL in a browser:
    http://TomcatHost:TomcatHTTPport/ibi_apps/diagnostics/about.jsp

    A page should appear displaying information about the current build. For example:

    Version:WEB82                

    If the page fails to load, restart Tomcat, and ensure it can compile JSP files. In some environments, the very first time a JSP file is compiled you might receive an error.

  2. If you are using Tomcat as both web and application server, proceed to Verifying the WebFOCUS Configuration With Tomcat and Apache HTTP Server.

The binaries you download will have a long name indicating the platform and Apache release. You should rename this file to mod_jk.so.

If a binary is not available for your platform, you can download the source code and compile it. If you do an online search, you should be able to find information on compiling mod_jk.so. The compiled file may have a different name, such as libmod_jk.so.

The mod_jk.so file should be placed on your system in a directory to which the HTTP Server has at least read permissions.

Procedure: How to Create the workers.properties File

  1. If the file does not exist, create the following file in a directory to which Apache HTTP Server has at least read permissions:
    workers.properties

    For example:

    /apache_home/conf/tomcat/workers.properties
  2. Open the file in a text editor to edit or add the following text to the file replacing text in italics with absolute paths:
    workers.tomcat_home=tomcat_home 
    workers.java_home=java_homeps=/
    worker.list=ajp13
    worker.ajp13.port=8009 
    worker.ajp13.host=localhost
    worker.ajp13.type=ajp13

    where:

    tomcat_home

    Is the installation directory for Apache Tomcat. Use an absolute path.

    java_home

    Is the installation directory for the Java JDK. Use an absolute path.

    8009

    Is the Ajp13 port defined in server.xml. 8009 is the default, but if you changed this, provide the new value.

Procedure: How to Create the mod_jk.conf File

  1. If the file does not exist, create the following file in a directory to which Apache HTTP Server has read access:
    mod_jk.conf

    For example:

    /apache_home/conf/tomcat/mod_jk.conf
  2. Open the file in a text editor to edit or add the following text to the file replacing /PATH_TO/ with absolute paths to the file in question:
    <IfModule !mod_jk.c>
      LoadModule jk_module /PATH_TO/mod_jk.so
    </IfModule>
    JkWorkersFile "/PATH_TO/workers.properties"
    JkLogFile "/PATH_TO/tomcatjk1.2/mod_jk.log"
    JkLogLevel emerg
    JkMount /ibi_apps ajp13
    JkMount /ibi_apps/* ajp13

    Note: If you changed the default context roots, substitute accordingly.

Procedure: How to Edit httpd.conf to Use JK1.2

  1. Using a text editor, open the httpd.conf file located in the /apache_home/conf directory.
  2. Add the following line to the end of the file specifying where the mod_jk.conf file is located on your system:
    Include /PATH_TO/mod_jk.conf

Verifying the WebFOCUS Configuration With Tomcat and Apache HTTP Server

How to:

After finishing the configuration, run test calls to verify operability.

Procedure: How to Verify the WebFOCUS Configuration

  1. If they are not started, start the following:
    • Apache Tomcat
    • WebFOCUS Reporting Server
  2. Enter the following URL in your browser:
    http://hostname:port/ibi_apps

    where:

    hostname:port

    Are the host name and port of the web server. However, if you use an application server only configuration, then these are the host name and HTTP port of the application server. If you require SSL, use https instead of http.

    The WebFOCUS Sign In page opens, as shown in the following image.

  3. Sign in as an administrator. The default user name and password is admin and admin.

    The WebFOCUS Home Page opens in your web browser.

  4. Click Administrator in the top pane, and then from the Administration menu, select Administration Console, as shown in the following image.

    The WebFOCUS Administration Console opens.

  5. Select the Configuration tab, expand Reporting Servers, and then expand Server Connections.
  6. Right-click a node, select Test, and then select TABLE Request, GRAPH Request, or Stored Procedure, as shown in the following image.
  7. Click Run to run the test procedure.

    A procedure is normally launched using the WebFOCUS Servlet and a sample report should display. You can manually use a servlet to run a procedure, such as carinst.fex, using:

    http://host:[port]/ibi_apps/WFServlet?IBIF_ex=carinst
  8. If you are using Tomcat stand-alone, proceed to Post-Installation Verification and Configuration.

WebFOCUS

Feedback