Tomcat question... Need a little help...

Posted by: lopan

Tomcat question... Need a little help... - 16/01/2003 08:53

I realize way off topic... but hey, thats why I'm posting here right?

Anyway I have an IIS server which is being set up to work along with tomcat. That configuration is good working (kinda), the deal is Tomcat will not run via Win2k services, you start it, it says it's started but doesn't compile the .jsp pages I'm sending it. It works perfectly if I start tomcat via command line, however being that this is for a demo I need it to be pretty and run through the Services of Win2k. Could this be a java issue? It works fine on a different machine that was configured correctly from the start, however the machine in question has the java runtime environment as well as the jdk... would it make a difference to just remove the runtime environment?
Posted by: tonyc

Re: Tomcat question... Need a little help... - 16/01/2003 09:02

It is an amazing coincidence that you bring this up right now. Last night I started a graduate course where we needed to install and use Tomcat. I had an old Tomcat install lying around but wanted to start fresh, since I'll be sharing it with a few team members, and wanted to get a current version (I downloaded 4.1.18 I think.) And I ran into a similar problem, being unable to run JSP's.

If you can't compile JSP's, chances are you don't have "tools.jar" (from the JDK lib directory) in your classpath. I tried many different methods for getting the directory where it's located into my classpath, but eventually I ended up just copying tools.jar from the JDK lib directory into <Tomcat Root>/common/lib, since any JAR files in that directory are automatically loaded into the classpath on startup.

Once I did this, I was able to run JSP's, and start it as a service. Your mileage may vary, but I was thinking maybe in some kind of cosmic coincidence it's the same problem.
Posted by: lopan

Re: Tomcat question... Need a little help... - 16/01/2003 09:32

cool... I moved tools.jar to a directory listed in the classpath and fixed it right up.... Thanks, now they want me to diagnose why I have to go through those steps.

But yeah strange coincidence... I love this board!
Posted by: tonyc

Re: Tomcat question... Need a little help... - 16/01/2003 09:39

now they want me to diagnose why I have to go through those steps.

Why you need tools.jar to be in the classpath? That's easy. JSP's are compiled on demand, and the JVM needs to use Sun classes to do that. So it invokes various classes under the com.sun.tools.javac.*, which are included in tools.jar.
Posted by: lopan

Re: Tomcat question... Need a little help... - 16/01/2003 09:48

Understood, but they want to know why it works fine on one box and I have the other issues on the other box. I noticed that the box in question had no pointers to the lib directory.... Neither did the box that works correctly. So does tomcat generate it's own set of classpaths at start up? If so where is that configuration contained? The only difference in the boxes is one has oracle thrown in the mix which does have it's own class paths for java.
Posted by: tonyc

Re: Tomcat question... Need a little help... - 16/01/2003 09:54

Hmm, that one I can't answer. I do know, however, that regardless of what CLASSPATH environment settings you have, Tomcat automatically loads any JAR files that it finds under common/lib. Like the Servlet API (servlet.jar) the XML parsing libs, etc. If somehow one of the boxes is picking up tools.jar via the system or user environment classpath, then you wouldn't have to copy it into the common/lib directory. But my attempts last night to just add the path to tools.jar to my CLASSPATH variables didn't yield successful JSP compilation, I had to copy it into common/lib. That tells me that Tomcat is basically ignoring my CLASSPATH settings and using some other mechanism for defining the class path. Haven't read enough to find out what that mechanism is, though.
Posted by: lopan

Re: Tomcat question... Need a little help... - 16/01/2003 09:59

Well thanks anyway... You've definately steered me in the right direction here. I'll post what I find...
Posted by: mcomb

Re: Tomcat question... Need a little help... - 16/01/2003 15:59

IIRC you need to define JAVA_HOME which is an environment variable that is supposed to point to your jdk directory. Off the top of my head I don't remember how to do that under windows, but once you get that setup tomcat should be able to find the tools.jar and any thing else provided by the jdk that it may need later.

-Mike
Posted by: Dignan

Re: Tomcat question... Need a little help... - 16/01/2003 18:04

Am I the only one who didn't know what Tomcat was and thought this was going to be a very personal question?
Posted by: tonyc

Re: Tomcat question... Need a little help... - 16/01/2003 19:21

FWIW, setting JAVA_HOME wasn't enough for my Tomcat install, as I did have it set, yet it didn't find tools.jar.

You know, with all the various installation, configuration, and general stability issues I've encountered in various application servers (Netscape, iPlanet, WebSphere, and Tomcat) I'm starting to wonder if Microsoft has it right after all... Someone please put me out of my misery before I go over to the dark side...
Posted by: wfaulk

Re: Tomcat question... Need a little help... - 16/01/2003 19:40

Well, you are running it under Windows, where it wasn't initially designed to work. It's more-or-less trivial under any Unix.

Or maybe you're not using it under Windows -- I assume because you were offering constructive help to someone who was.

Anyway, you're right to at least some extent that Java involves a good amount of magic, at least when it comes to classpath-type issues.
Posted by: mcomb

Re: Tomcat question... Need a little help... - 16/01/2003 22:45

FWIW, setting JAVA_HOME wasn't enough for my Tomcat install

Yeah, I just reread the original post and realized that probably has nothing to do with it since it does work for him when he starts it from the command shell. Sounds like some weird windows thing where the environment variables aren't getting passed to services. You could test that theory by setting JAVA_HOME and any classpath you need from the batch script that starts tomcat. Beyond that I have no idea as I have never tried to use windows for a server.

-Mike
Posted by: lopan

Re: Tomcat question... Need a little help... - 17/01/2003 06:39

In reply to:

Sounds like some weird windows




I've about come to that conclusion, everything is set right, everything is configured exactly as the functional machine... I got it working by copying tools.jar to the root of JAVA_HOME, and it works fine. I searched high and low for an answer and found a few links about tomcat bugs in windows. So.. I'm passing it off as a glitchy bug thing.
Posted by: klaruz

Re: Tomcat question... Need a little help... - 17/01/2003 11:44

You may want to check out:

HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ {SERVICE_NAME}\ Parameters

You can change the vars that get passed to java via an nt service that way. I use it to change the amount of ram I give tomcat on our clusters, along with a few other details. You should be able to pass a class path variable to tomcat with it, since it doesn't appear to pick up your global (local maybe?) variables.

See this page for more info:


http://www.alexandriasc.com/software/JavaService/documentation.html
Posted by: lopan

Re: Tomcat question... Need a little help... - 17/01/2003 11:54

Thanks a lot! That little gem was EXTREMELY helpful....