Stuck on Tomcat

mhuntley

Registered
I'm trying to move a JSP-based web site from NT/IIS to OS X/Apache.

I've installed Tomcat 4.0.3 with Apache on OS X 10.1.3. I can run the Tomcat examples via Tomcat's web server (localhost:8080) and via Apache (localhost).

I put my JSP code in /webapps/mydir/, configure Tomcat's server.xml with a Context for /mydir and add a webappdeploy line to httpd.conf. I have permissions in /mydir set the same as those in /examples.

When I try to access jsp files in /mydir I get a "404" error, regardless of whether I'm accessing them via Tomcat or Apache.

Some of you appear to have Tomcat working. Can you help? I'm probably missing something very elementary.

Martin
 
I would like to have an answer for you, but unfortunately I am stuck in trying to download Tomcat. I have downloaded and installed it on Linux and windows, but everytime I attempt to download the same file (jakarta-tomcat-4.0.3-LE-jdk14.tar.gz ), I get an error from the download manager. I am new to MacOS X (two weeks), but I do have a light background with Tomcat and apache.

Any ideas on what is wrong? I have a work around, I am downloading the file to my Win2000 machine and using a file share to bring it over.
 
I downloaded jakarta-tomcat-4.0.3.tar.gz.

Initially I had problems because I was using the jakarta-tomcat-4.0.3 folder that resulted from Stuffit automatically unpacking and decompressing. Don't use that. Discard the folder created by Stuffit (and make sure Stuffit isn't set in its Preferences to discard the archive after unpacking).

Move the archive to where you want to install it (/usr/local).

I then had problems (which weren't immediately evident) using the tar program built into OS X. Various things I read said to use gnutar, which wasn't included (even though there appeared to be a man page for it).

Eventually, I installed the OS X Developer Tools from Apple, which included gnutar (there are other ways to get this).

Then I used:

gnutar -xzvf jakarta-tomcat-4.0.3.tar.gz jakarta-tomcat-4.0.3

to unpack.

Hope this helps.
 
Hey there,

I got a "precompiled for Mac OS X" version of Tomcat which has been working fine. One thing it did for me is to create a symbolic link in the /etc/httpd/users called mod_jk.conf, which is linked to /Library/Tomcat/conf/mod_jk.conf ... this has the effect that the autogenerated version of the conf file is always available to Apache. Also, always make sure you restart Apache so that the changes in the config file take effect (apachectl graceful).

Those are just things I'd check for if I was having that problem ... hope they're of help :)

C
 
Thanks for the replies, I actually downloaded it to my win2000 box and used Samba to transport it to my Mac.

I hear you on the stuffit, but by not downloading through http, it did not kick in. I moved it to the proper dir -- in my case I made /opt/pkg and unpacked it there using tar. I went into my /etc/profile and added the CATALINA_HOME and JAVA_HOME variables and exported them.

So all is good right? Wrong!

I run the pre-built script (CATALINA_HOME/bin/startup.sh), to start the Tomcat, I get no errors. I checked the CATALINA_HOME/logs/catalina.out file and all looked great! No errors, BUT when I make a request on 127.0.0.1:8080 or localhost:8080 no dice.

I restarted Apache (not that that should matter as I am not using the mod_jk.conf yet) and even rebooted the machine. Still no dice.
 
... in fact your post implies this in one of your comments, but if you are using localhost:8080 then its the Tomcat web server that handles the request, not Apache, so restarting Apache wouldn't have made any difference ;)

Now to something slightly more helpful:
Try doing a port scan on your machine (There's a utility that can do this for you in the Applications/Utilities folder called Network Utility) and see if port 8080 is listed. If not, then your server hasn't started properly.

Normally, when I start up Tomcat on my machine then I get some debug output to the console ... but that depends on how the start script is configured - if you're not seeing any output, have you got a redirect in your start script?

C
 
I am at work right now and on Win2000, so I cannot tell you the exact screen output, but it basically echos the CATALINA_HOME variable and a few lines like that. No errors or any indication that something is wrong, and the /logs/catalina.out file shows no errors.

I did portscan box, and 8080 has no service running. I double-checked my server.xml file and 8080 is the default port. I went so far as to change it to 80, stop Apache and restart Tomcat. No dice!

Could it be that I need a different startup script than the /bin/startup.sh that came with the app? I read the webpage MacOSX Tomcat webpage . The author makes a reference to building their own startup script, but does not show how or explain why.

I have installed this on Linux several times and I am doing the same thing, only it is not working.
 
You've probably done this, but make sure you've got permissions to the entire jakarta-tomcat-4.0.3 directory. You need to be able to write to the logs dir. and execute what's in bin.

However, I think you'd get errors in the response when you run the startup.sh script if permissions were wrong.

What I get is:

Using CATALINA_BASE: /usr/local/jakarta-tomcat-4.0.3
Using CATALINA_HOME: /usr/local/jakarta-tomcat-4.0.3
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-4.0.3/temp
Using JAVA_HOME: /usr

reflecting the particular assignments I made to JAVA_HOME and CATALINA_HOME. I read the same article you read, and it got me to the first step of being able to run on 8080 just fine.

Sorry I can't be more helpful. Blind leading the blind?
 
I get the same output you did.

I have not checked permissions. I only have one user on my machine (except for root, which I do not use). So I assumed all would be fine. The catalina.out is getting written to, as it is displaying the java classes that have been invoked to get Tomcat up and running. So I believe it is writing just fine.

:confused:
 
Okay, I wiped out my installation of tomcat and re-downloaded it. I went through the same steps and ths time when I read the catalina.out it starts with a
Exception during startup processing
java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: org/xml/sax/HandlerBase

So what does this mean?
 
... that you're Java VM can't find some of the classes that it needs to process XML - hence your classpath may be set wrong. Check the installation manual whether it mentions anything about setting your global classpath (${CLASSPATH}) and also check the startup.sh script to see if all of the references in that are correct. If memory serves, Tomcat uses Xerces to do its XML parsing/processing - so there should be a xerces.jar in the ${CATALINA_HOME}/lib directory ... that needs to be a part of the -classpath argument to the java command in the startup.sh script.

Hope that helps ;-)

C
 
Back
Top