Deploying a Java Web Service to a Linux/UNIX Server
Technical Note 40024
Last Reviewed 16-Nov-2009
Applies To
Verastream Host Integrator version 6.0 through 6.6
Summary
This technical note details how to deploy a Verastream Host Integrator (VHI) Java web service project to a Linux or UNIX server.
Background
Web Builder, a component of VHI Development Kit on Windows, generates code for web applications and web services. After Web Builder creates a Java web service, it is deployed to the local Tomcat server (also known as the VHI Web Server service). This technical note describes how to deploy the Java web service to a remote Linux/UNIX server running Tomcat (typically a VHI Server Kit installation).
Prerequisites
The following components must be installed on the Linux/UNIX system:
- Apache Jakarta Tomcat: Tomcat provides application server functionality for the web server. You may use either Tomcat included in VHI Server Kit for UNIX, or a separately-installed instance. Customers have reported success with various Tomcat 5.x and 6.x versions. For more information about Tomcat, see http://tomcat.apache.org/.
- Apache Axis: Axis runs in the Tomcat server and provides support for web services. Axis is included in VHI Server Kit, or can be installed separately. For more information on Axis, see http://ws.apache.org/axis/.
- Java Runtime Environment (JRE): You may use either the JRE included in VHI Server Kit, or a separately installed instance. JRE version 1.4 or higher is supported; JRE version 1.5.x is installed with VHI versions 6.x; JRE versions 1.6.x are also fine. Sample commands below assume the JRE bin directory (java command) is in your PATH.
- VHI Java Connector API: After installing VHI Server Kit, the files wcp.jar, vhiprop.jar, and apptrieve.jar are located in the <VHI directory>/lib/java directory. This API is used for connecting to the VHI Session Server component.
Deployment Procedure
Complete the steps in the following sections to configure your Linux/UNIX environment and deploy the Java web service.
Configuring your Linux/UNIX environment
To configure the environment, do the following:
- Note your Tomcat directory, such as /opt/vhi/tomcat or /usr/local/Jakarta-tomcat-5.0.19, which is typically set in the environment variable $CATALINA_HOME.
- Start Tomcat by running the script <VHI directory>/tomcat/bin/vhitomcat.sh or <Tomcat home>/bin/startup.sh at the shell command prompt.
- Verify Axis is running at http://<host name>:<port number>/axis where <port number> is normally 8081 (for Axis installed with VHI) or 8080 (for Axis installed separately). The Apache Axis welcome page should display.
Figure 1. Apache Axis Welcome Page
- Open <Tomcat home>/conf/server.xml in a text editor, add the following entry (shown in red) under <!Tomcat Root Context ->, and then save the file.
- Set and export the AXIS_LIB and AXISCLASSPATH environment variables using the following commands:
- Set the AXIS_LIB environment variable:
AXIS_LIB=<Tomcat home>/webapps/axis/WEB-INF/lib
where <Tomcat home> is the directory from step 1 above.
- Set the AXISCLASSPATH environment variable (enter all on one line):
AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:
$AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/
saaj.jar:$AXIS_LIB/log4j-1.2.8.jar
Note: If you have installed Axis version 1.4, substitute commons-discovery-0.2.jar instead of commons-discovery.jar, and commons-logging-1.0.4.jar instead of commons-logging.jar.
- Export the environment variables:
export AXIS_LIB; export AXISCLASSPATH
- Verify that they were correctly exported:
- It is also recommended you verify the CLASSPATH environment variable contains the VHI Connector and Axis .jar directories. For example:
# echo $CLASSPATH
/opt/vhi/lib/java:/opt/vhi/tomcat/webapps/axis/WEB-INF/lib
Deploying the Web Service
To deploy the Java web service, do the following:
- In VHI Web Builder on the Windows system, note the Server in the Project Properties. It is suggested you change this value to the host name where the web service will be running.
- Build the Java web service project.
- On the Windows system, Web Builder creates a <project name>.jar file in the C:\Program Files\VHI\projects\<project name>\webservice directory. Copy this file to the UNIX/Linux system <Tomcat home>/webapps/axis/WEB-INF/lib directory.
Note: If you use FTP to transfer this file, use the binary transfer method.
- On the Windows box, locate the deployment descriptor file C:\Program Files\VHI\projects\<project name>\webservice\deploy.wsdd. Copy this file to somewhere on the UNIX/Linux system, to be used in the deployment step 12 below.
Note: If you use FTP to transfer this file, use the ASCII text transfer method.
- Re-start the Axis server, so it reads the new .jar file. This can be accomplished by stopping and starting Tomcat, as described in step 2 above.
- Change to the directory containing deploy.wsdd, from step 10 above. Deploy the web service to Axis using one of the following commands (enter all on one line):
java org.apache.axis.client.AdminClient deploy.wsdd
java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient -h<host name> -p<port number> deploy.wsdd
where <host name> is the value from step 7 above, and <port number> is from step 3 above.
Note: If log4j warnings are displayed, you may have a .jar file missing from the AXISCLASSPATH (see step 5 above).
- After deploy.wsdd is processed, open http://<host name>:<port number>/axis in a web browser.
- Click the View link to view the deployed web services. Verify your project is listed.
After successfully completing these steps, the web service generated WSDL document can be retrieved at http://<host name>:<port number>/axis/services/<project name>?wsdl.
Related Technical Notes
| 10040 |
Deploying a Verastream Web Service Project to a Windows Server |
| 40999 |
Verastream Host Integrator Technical Notes |