Home arrow Java & J2EE arrow Page 4 - Slapping Together A JSP Development Environment

Connecting The Dots - Java

Deploying a JSP development environment on your workstation cantest even the strongest of wills, since it requires the peacefulco-existence and cooperation of a number of complex software packages. Thistutorial guides you through the process of getting Apache, JServ and Tomcatconfigured, alerts you to some of the problems you're likely to encounter,and briefly discusses Tomcat contexts and JSP-mySQL connections. Coversboth Windows and Linux.

TABLE OF CONTENTS:
  1. Slapping Together A JSP Development Environment
  2. Essential Software
  3. One Tomcat, Standing Alone
  4. Connecting The Dots
  5. Same Story, Different OS
  6. Putting It In Context
  7. Making The Grade
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 4
March 05, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
In order to get Apache and Tomcat working together, you need to load the JServ Apache module. Under Windows, this module is currently named "ApacheModuleJServ.dll", and you need to place it in the C:\PROGRAM FILES\APACHE GROUP\APACHE\MODULES\ directory. Next, open up your "httpd.conf" file, and add the following line to the "DSO Support" section:

LoadModule jserv_module modules/ApacheModuleJServ.dll

This loads the JServ module into memory.

And then add the following line to the end of "httpd.conf":

Include "c:/tomcat/conf/tomcat-apache.conf"

Each time Tomcat starts, it automatically creates a configuration file for Apache, customized to your system - this file is named "tomcat-apache.conf", and is stored in the Tomcat CONF\ directory. This file contains JServ settings specific to Tomcat, together with directives designed to help Apache deal with JSP files, and is essential to getting Tomcat and Apache working together.

If Apache is running, you'll need to stop and restart it for the new settings to take effect. And if all has gone well, the next time you start Apache, you'll see something like this:

Apache/1.3.14 (Win32) tomcat/1.0 running...

This indicates that the JServ module has been loaded, and is available for use with Tomcat.

There is another Windows-specific problem you might encounter at this stage. If your Tomcat server has been installed to a directory with a so-called "long" file path, and this long path contains spaces or strange characters (say, C:\PROGRAM FILES\TOMCAT\WEBAPPS\EXAMPLES), Apache may barf with a complaint about aliases. In this case, note the line number with the error, open up the "tomcat-apache.conf" file, and enclose the long file paths in double quotes to fix the problem.

Finally, the acid test. Start up Tomcat

C:\TOMCAT\BIN>TOMCAT START Including all jars in C:\TOMCAT\LIB in your CLASSPATH. Using CLASSPATH: C:\TOMCAT\CLASSES;C:\TOMCAT\LIB\ANT.JAR;C:\TOMCAT\LIB\JAXP.JAR;C:\TOMCAT\LIB \SERVLET.JAR;C:\TOMCAT\LIB\PARSER.JAR;C:\TOMCAT\LIB\WEBSER~1.JAR;C:\TOMCAT\L IB\JASPER.JAR;C:\JDK\LIB\TOOLS.JAR Starting Tomcat in new window 2001-01-30 02:47:19 - ContextManager: Adding context Ctx( /examples ) 2001-01-30 02:47:19 - ContextManager: Adding context Ctx( /admin ) Starting tomcat. Check logs/tomcat.log for error messages 2001-01-30 02:47:20 - ContextManager: Adding context Ctx( ) 2001-01-30 02:47:20 - ContextManager: Adding context Ctx( /test ) 2001-01-30 02:47:22 - PoolTcpConnector: Starting HttpConnectionHandler on 8080 2001-01-30 02:47:22 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007

Then start up Apache.

Apache/1.3.14 (Win32) tomcat/1.0 running...

And point your browser to http://localhost/examples/jsp/hello.jsp. If Tomcat, Apache and JServ are all configured properly, your JSP page should be parsed by the Tomcat engine and returned correctly to the browser. You can now use Apache to serve JSP documents without the necessity of specifying the port number in the URL.

In case you need to stop the Tomcat server, you can use

C:\TOMCAT\BIN>TOMCAT STOP Including all jars in C:\TOMCAT\LIB in your CLASSPATH. Using CLASSPATH: C:\TOMCAT\CLASSES;C:\TOMCAT\LIB\ANT.JAR;C:\TOMCAT\LIB\JAXP.JAR;C:\TOMCAT\LIB \SERVLET.JAR;C:\TOMCAT\LIB\PARSER.JAR;C:\TOMCAT\LIB\WEBSER~1.JAR;C:\TOMCAT\L IB\JASPER.JAR;C:\JDK\LIB\TOOLS.JAR

Stop Tomcat

 
 
>>> More Java & J2EE Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: