www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Web Application Development

The HTTP Server
Web Services ACL (Access Control List)
Virtuoso Server Pages (VSP)
Virtuoso Server Pages for XML (VSPX)
Writing ASP.Net Web Applications
ASMX Web Service Hosting
Blogging & Weblogs
Writing PHP Applications
Writing JSP Applications
Environment Setup & Verification
Perl Hosting
Python Hosting
Ruby Hosting

12.9. Writing JSP Applications

The Virtuoso server with Java hosting support can be used to execute JSP pages, however, Virtuoso requires a JSP container engine first. Jakarta provide such an engine that can be hosted inside Virtuoso with Java support. This section describes how JSP's can be executed using Jakarta Tomcat JSP implementation.

Figure: 12.9.1. The HTTP JSP handler using Jakarta Tomcat
The HTTP JSP handler using Jakarta Tomcat

12.9.2. Environment Setup & Verification

The following components are required:

The virtuoso.ini file must edited to including the following settings in the [Parameters] section:

.....
JavaClasspath = <jdk install dir>/lib/tools.jar:<tomcat install dir>/bin/bootstrap.jar 
JavaVMOption1 = -Djava.endorsed.dirs=<tomcat install dir>/bin:<tomcat install dir>/common/endorsed
JavaVMOption2 = -Dcatalina.base=<tomcat install dir>
JavaVMOption3 = -Dcatalina.home=<tomcat install dir>
JavaVMOption4 = -Djava.io.tmpdir=<tomcat install dir>/temp
.....
Note:

The above has been tested for the jakarta-tomcat-4.1.18 distribution only. Setting may vary for any other versions of Jakarta Tomcat, in which case we advise you consult the Tomcat documentation.

Run the virtuoso-*-javavm*-t binary, The Virtuoso server that includes Java hosting.

Start the Jakarta Tomcat server inside virtuoso server process using the following command from ISQL:

SQL> java_call_method ('org.apache.catalina.startup.BootstrapService', null, 'main', 'V',
     vector ('[Ljava/lang/String;', vector ('start')));

In order to invoke the above command automatically at server startup you might put it in the autoexec.isql init script.

Make a virtual directory for accessing JSP server, here is an example:

vhost_define (lpath=>'/tomcat',ppath=>'http://localhost:8080/');

Verify that your installations are correct by pointing your web browser of choice to http://localhost:8890/tomcat/ (assuming you are working on your local machine). Run some of JSP examples provided with Tomcat distribution to verify that they are executed without errors.

Note:

For debugging purposes you may run the virtuoso-*-javavm*-t server with foreground option to receive Java error messages, if any occur.

See Also:

In-Process Data Access Client