Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > activating JSP in Panther

activating JSP in Panther
Thread Tools
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Beaverton, OR, USA
Status: Offline
Reply With Quote
Oct 30, 2003, 12:59 PM
 
Hi all, I am not a Unix guru by any stretch of the imagination, but I do know my way around a bit. After a ton of searching, I did figure out how to get the tomcat server started, but when I try to go to http://localhost:8080/ as the documentation tells you to do, I get an error. I know PHP and MySQL pretty well, but I have never really played with JSP, and am looking to get a development system set up so I can play around with it and learn it. I know I installed the JSP/Java options from all the install discs for Panther, but I can't seem to find how to get it finally working anywhere? If anyone could give me fairly simple walk-through instructions, I would greatly appreciate it, thanks.
Ryan
iMac G5 1.8 17" SD/768MB/80GB
iPod Mini 4gb Rev. B
external firewire 400 120GB drive
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Oct 30, 2003, 07:25 PM
 
You probably need to setup some environment variables. Here's what I have (I assume you are terminal savy):

In my home directory I created a directory called dev and in it another one call bin. This is where I put some executable shell scripts.

With that in mind, add this line to your .tcshrc file:

set path = ($path /Users/YourLoginName/Dev/bin)

Inside the Users/YourLoginName directory I have a tomcat_start script and a tomcat_stop script. These are just two text files, you can call them whatever you want. The contents of the files are as follows (only what's in between the dashed lines).

tomcat_start
------------------------
#!/bin/sh
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Home
export CATALINA_HOME=/usr/local/jakarta-tomcat-5/dist

$CATALINA_HOME/bin/startup.sh
------------------------


tomcat_stop
------------------------
#!/bin/sh
export CATALINA_HOME=/usr/local/jakarta-tomcat-5/dist
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Home

$CATALINA_HOME/bin/shutdown.sh
------------------------


Note that my tomcat is version 5 and the installation root is:

/usr/local/jakarta-tomcat-5/dist

If you are not terminal savy then all the above could be a mild headache -time to buy a book?. Once you get the hang of Unix then you'll realize that the setup is pretty straight forward. No black magic anywhere.

As side note, Unix allows great flexibility in setting up apps like Tomcat, so all the above is not unique by any measure but it sure works well for me.

One more thing... you have to make the above text files executables. That is in the terminal type:

chmod 755 tomcat_*

(investigate the 755 in some unix tutorial, those permission settings work for me but maybe not for you)

Restart your terminal, type in:

tomcat_start

Heck, as an exercise, you could make the scripts double-clickable icons! But that hides the beauty of Unix! Dig into the terminal and enjoy!

(Last edited by DaGuy; Oct 30, 2003 at 07:42 PM. )
     
pysan  (op)
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Beaverton, OR, USA
Status: Offline
Reply With Quote
Oct 30, 2003, 11:45 PM
 
OK to clarify a bit more, I have Tomcat installed in the default place in Panther, which is the the root library/tomcat/ and then the startup and shutdown scripts are within its bin/ dir. That works fine, and running the startup.sh script results in this:
Using CATALINA_BASE: /library/tomcat
Using CATALINA_HOME: /library/tomcat
Using CATALINA_TMPDIR: /library/tomcat/temp
Using JAVA_HOME: /Library/Java/Home

So I would guess that means it is running, and then when I run the bin/shutdown.sh script it repeats the same thing, and takes a litle bit to think, and then returns to the prompt. So my issue is that I am pretty sure tomcat is running fine, but where or how do I actually run .jsp files and scripts? I have put them within the root library/webserver/documents dir and try to pull them up but they don't process at all. Then if I just got to http://localhost:8080/ as I mentioned before it just gives me an error? It also doesn't seem like there is an apache mod installed for working w/ tomcat by default from Apple?

On a side note: with php running, and running phpinfo(); it looks like MySQL is installed now by default from Apple, but does anyone know how to access or use this installation, such as where it resides or anything. Thanks again for all your help.
iMac G5 1.8 17" SD/768MB/80GB
iPod Mini 4gb Rev. B
external firewire 400 120GB drive
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Oct 31, 2003, 05:27 AM
 
You are simple placing your jsp files in the wrong location.

Read this article:

http://www.macdevcenter.com/pub/a/ma...18/tomcat.html
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Oct 31, 2003, 06:11 AM
 
Originally posted by pysan:
OK to clarify a bit more, I have Tomcat installed in the default place in Panther, which is the the root library/tomcat/ and then the startup and shutdown scripts are within its bin/ dir. That works fine, and running the startup.sh script results in this:
Using CATALINA_BASE: /library/tomcat
Using CATALINA_HOME: /library/tomcat
Using CATALINA_TMPDIR: /library/tomcat/temp
Using JAVA_HOME: /Library/Java/Home

So I would guess that means it is running, and then when I run the bin/shutdown.sh script it repeats the same thing, and takes a litle bit to think, and then returns to the prompt. So my issue is that I am pretty sure tomcat is running fine, but where or how do I actually run .jsp files and scripts? I have put them within the root library/webserver/documents dir and try to pull them up but they don't process at all. Then if I just got to http://localhost:8080/ as I mentioned before it just gives me an error? It also doesn't seem like there is an apache mod installed for working w/ tomcat by default from Apple?

On a side note: with php running, and running phpinfo(); it looks like MySQL is installed now by default from Apple, but does anyone know how to access or use this installation, such as where it resides or anything. Thanks again for all your help.
I don't have any compatability problems without the default Apache install.

Check to see if tomcat is running i.e., look for a JVM process.

ps -ax | grep JavaVM

What does:

ping localhost

give you?

Also do a:

tail -f $CATALINA_HOME/logs/catalina.out
     
pysan  (op)
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Beaverton, OR, USA
Status: Offline
Reply With Quote
Oct 31, 2003, 11:29 AM
 
OK, I read that article, but it still seems mine is working as well as that installation, the only thing is that mine still won't respond to localhost:8080/

ps -ax | grep JavaVM
running the above command I got this:
398 std S+ 0:00.00 grep JavaVM

Whatever that means, don't really understand that, hehe.

ping localhost response:
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.244 ms

tail -f $CATALINA_HOME/logs/catalina.out

When I ran this one I got this:
tail: /logs/catalina.out: No such file or directory
Do I need to be in a particular dir before I run it? Sorry for the supreme lack of knowledge here, I only know what I have picked up from tinkering, which isn't a whole lot. So where do I want to place my .jsp files? Once again, any help is greatly appreciated. I figure I will at least understand terminal much better by the end of all of this.
iMac G5 1.8 17" SD/768MB/80GB
iPod Mini 4gb Rev. B
external firewire 400 120GB drive
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Oct 31, 2003, 02:51 PM
 
It's not running on port 8080. Try port 9006. For some reason that is how it's configured.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
pysan  (op)
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Beaverton, OR, USA
Status: Offline
Reply With Quote
Oct 31, 2003, 03:15 PM
 
Ok, the port 9006 thing did the trick, sure enough, it is working. Now do I need to put my .jsp files in that same directory that the default index page is at, according to it:
$CATALINA_HOME/webapps/ROOT/index.html
or how do I get apache to parse the .jsp files and hand it off to tomcat?
iMac G5 1.8 17" SD/768MB/80GB
iPod Mini 4gb Rev. B
external firewire 400 120GB drive
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Oct 31, 2003, 07:44 PM
 
Originally posted by pysan:

When I ran this one I got this:
tail: /logs/catalina.out: No such file or directory
Do I need to be in a particular dir before I run it? Sorry for the supreme lack of knowledge here, I only know what I have picked up from tinkering, which isn't a whole lot. So where do I want to place my .jsp files? Once again, any help is greatly appreciated. I figure I will at least understand terminal much better by the end of all of this.
Yeah, you'll get some unix for sure.

1. The tail -f is a very useful command. It dynamically displays some lines at the end of the file i.e., as it's being updated. It failed because your tomcat installation is different than mine. Just find the path to catalina.out and you will be fine.

2. The JSPs go under the webapp directory. You can configure tomcat to any dir of your choice. There should be some good tutorials in the Jakarta site.

3. The Apache thing... I don't know but I there's plenty of stuff out there. Do google on
mod_jk and see what you get.

4. Dude, time to get a book? Once you get more comfortable, you will surely want to do more things. The O'rielly books are very good and they have one on Tomcat.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2