aspose file tools*
The moose likes Tomcat and the fly likes Localhost leads to nowhere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Localhost leads to nowhere" Watch "Localhost leads to nowhere" New topic
Author

Localhost leads to nowhere

Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Ive installed Tomcat 5.5 and started it without issue via the console. Trying it via the command line just gets 'no such command' response.

Anyway after doing the htt://localhost:8080 im getting nothing.

Any reason why? Ive been told its a 5.5 problem and should uninstall and stick in a 4.x version instead.
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Doesnt matter......... i scrapped 5.5 and installed 4.1. So much for an improved version.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Fatti,

I installed Tomcat 5.0.28 because it's stable and is based on Servlet 2.4 and JSP 2.0. For more info, check out here.

I tried Tomcat 5.5.2 (still in alpha phase) and I had no problem deploying the examples and my applications under webapps. However, I received "Invalid Context Path" error when I deployed an application which was placed somewhere other than under the webapps directory. I don't have this problem with Tomcat 4.X and 5.0.28.

Joyce
[ October 06, 2004: Message edited by: Joyce Lee ]
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Thanx Joyce. I reinstalled 4.1.30 and all was good FOR A WHOLE DAY. Today i get nothing. I put in the localhost:8080 and it connects but i get a blank page. When i turn off Tomcat i get an "Unable to Connect" dialogue box as usual. When Tomcat is running though i get just a blank page.

Whats the deal here? Ive got an app for uni due in 10 days and its a bit hard when i cant even get the server to work.
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Fatti,

Ensure all these things after re-installing ur Tomcat

1. Set the environment variable CATALINA_HOME to your Tomcat holder
say c:\Tomcat(Better to delete all the 4.1.stuff....to avoid chaos
due to spaces)

2. Set JAVA_HOME variable to the JDK folder.

Say c:\jdk1.3 or something

3. Set CLASSPATH variable to %CATALINA_HOME%\commons\lib\servlet.jar;

4. Set Path variable to ;%JAVA_HOME%\bin;%CATALINA_HOME%\bin;

This will make any Tomcat work properly.

Secondly, check whether index.jsp file is there in the ROOT folder of the
Tomcat.

And

The things that we have to look into while creating our own web apps are

1. The directory structure is proper
say some c:\Tomcat\webapps\OwnApp
2. Then inside our application, we need to create a web-inf
say c:\Tomcat\webapps\OwnApp\WEB_INF
3. Then we can arrange our own things here in this space

a. Java Script Files
say c:\Tomcat\webapps\OwnApp\WEB_INF\script - say

b. CSS
say c:\Tomcat\webapps\OwnApp\WEB_INF\css - Say

c. Images
say c:\Tomcat\webapps\OwnApp\WEB_INF\Images - say

d. Of course our servlets will be in the classes folder

say c:\Tomcat\webapps\OwnApp\WEB_INF\classes.

e. And beans in a package
say c:\Tomcat\webapps\OwnApp\WEB_INF\classes\mypack\mybeans\com\SomeBeanClass

And don't forget to have ur own web.xml configured for ur new servlets....

Think Tomcat should start...if it doesn't, we find several Tomcat versions to be loaded down from the internet. Try loading one down.

Cheers,
Swamy
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Ok thats all done. The install done it all. Like i said i installed it and it worked right away. Now it doesnt and nothing has changed.
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Im getting this error message in the Catalina log file:
2004-10-07 19:49:12 CoyoteAdapter An exception or error occurred in the container during the request processing
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getContextPath()Ljava/lang/String;

There are no other errors.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Fatti, I did a Google and found this thread. Could you check the CLASSPATH if you are pointing to more than 1 servlet.jar? Also check if there is one in java/jre/lib/ext. Which version of jdk are you using? Which system are you running (winXXX, linux)?

Joyce
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Im using Win Xp Pro.
Im only pointing to one Servlet.jar
There is a servlet.jar in the java folder you mentioned(not the one the classpath points to though) and im using the JDK 1.4.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Fatti, could you remove the "serlvet.jar" from java/jre/lib/ext and place it in a temp directory? I guess this is an old version one. Next, modify the CLASSPATH in Environment Variable and add in this (based on your message, it seems like you've already done this step):

CLASSPATH c:\tomcat-4.1\common\lib\servlet.jar

You should see the latest version of servlet.jar in c:\tomcat-4.1\common\lib\servlet.jar.

For more info on setting up the tomcat, you can check out CoreServlets.com

Joyce
[ October 08, 2004: Message edited by: Joyce Lee ]
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Joyce,

Thankyou for all your help. I tried everything and it still wouldnt work. Again I have uninstalled Tomcat 4.1.30 and installed 5.0.28 as you said. No configuration and it runs without fault. Only test now is to turn it off and see if it runs again in the morning.
Again thanx for all the help.
You rock.

Paul,
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Paul, hope everything is fine for you.

Only test now is to turn it off and see if it runs again in the morning.

How about you reboot the system and see if it's still working?

My system is win98 and basically I used the following steps for setting up the tomcat 4.X and 5.0.28.

Steps:
-------
1) Set CATALINA_HOME=c:\tomcat-5.0.28
2) Set the CLASSPATH=c:\tomcat-5.0.28\common\lib\servlet-api.jar
3) Set PATH=c:\tomcat-5.0.28\bin
4) Modify conf/server.xml by adding <DefaultContext reloadable="true" /> (optional)
5) Modify conf/web.xml by uncommenting <server> and <server-mapping> for invoker
6) Reboot the system or manually run the autoexec.bat
7) To start the tomcat: c:\tomcat\bin\startup.bat
8) Open a browser and try out this: http://localhost:8080/servlets-examples/
9) To shutdown the tomcat: c:\tomcat\bin\shutdown.bat

Joyce
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
IMO, steps 2,3 and 5 are unnecessary (5 is only recommended for development, you should be properly mapping your servlets in the associated web.xml).

6 only applies if you're running a Win9x system. It's been a while, but I believe you can set environment parameters in Win9x. You can also move the set CATALINA_HOME to the proper startup/shutdown.bat and run both tomcat 4 and 5 on the same system (granted, not at the same time, unless you change the port on one of them)

and - don't forget to set JAVA_HOME=/path/to/java

also - Tomcat 5 requires either java 1.5 or java 1.4 with an additional compatibility package. (plus it's alpha, unless you're contributing to development, you should be using a stable release, but that's already been brought up...)
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Ray,

Step 2 is necessary otherwise the compiler javac will not able to compile the servlet code. Unless you're only trying to deploy the already compiled servlet code.

Step 3 is a convenience for me. So that I don't have to specify the full path like c:\tomcat\bin\startup.bat. I can simply type in "startup.bat".

Yes, I agree with you for Step 5. It is not necessary if the developers know or bother to do the mapping <servlet-mapping> in web.xml.

6 only applies if you're running a Win9x system. It's been a while, but I believe you can set environment parameters in Win9x.

Could you please tell me the alternative way of setting the environment variables in win98 besides using autoexec.bat? Thanks.

Btw, the basic steps stated are used for my servlet/jsp development purpose.

Joyce
[ October 08, 2004: Message edited by: Joyce Lee ]
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
As I said, it's been some time since I used Win98 I no longer have a Win98 machine handy...anyway, it's fog-ridden memory of a feature that's probably not there.

On 2, now I see how you're using it. My preferred way is to include a classpath with the call to javac from my 'development environment' (code-genie) I have my reasons, you have your reasons...whatever, so long as the code gets compiled.
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Well it still works this morning so im sorta happy. None of my DB apps work though even after setting up the data sources. Something is amiss somewhere. Ill find it in the end.

Thanx guys.
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
I went shopping...... come home and now i get the blank page again.

Everything is configured right and points in the right direction.

Im over it.
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Fatti,

If that is happening continuously, it would be some problem with the configuration. Did u try pinging the port that you are.

The best way would be to get some working Tomcat and load into your machine. That would be fine to determine whether there is any problem with your configuration of the port.

This is my opinion.

Cheers,
Swamy.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Originally posted by Ramaswamy Srinivasan:
The best way would be to get some working Tomcat and load into your machine. That would be fine to determine whether there is any problem with your configuration of the port.


Good suggestions by Swamy.

Paul, it seems like before the configuration, running http://localhost:8080 was ok. By removing the configuration, do you still have the "blank page" problem?

Joyce
[ October 10, 2004: Message edited by: Joyce Lee ]
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
I can get this to work
http://localhost:8080/servlets-examples/
But not the index page. Any suggestions?
[ October 11, 2004: Message edited by: Fatti Stuff ]
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392

Could you manage to run the servlet examples by clinking the link "Execute"? If ok, could you try http://localhost:8080/jsp-examples/ as well?

But not the index page. Any suggestions?

Hmmm...how about trying out these?
http://localhost:8080/index.jsp
http://127.0.0.1:8080
http://127.0.0.1:8080/index.jsp
Try using different browser, e.g. Netscape
[ October 11, 2004: Message edited by: Joyce Lee ]
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
None of them work. They must be just html pages then as nothing jsp works.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Paul, since accessing html file is ok, could it be the JAVA_HOME set incorrectly?

You might want to take a look at CoreServlets: 2. Try Some Simple HTML and JSP Pages.
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
One of the things ive noticed it that tomcat doesnt come with a servlet.jar file. The closest it has is a servlet-api.jar file. Are these the same?
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Originally posted by Fatti Stuff:
One of the things ive noticed it that tomcat doesnt come with a servlet.jar file. The closest it has is a servlet-api.jar file. Are these the same?


Yes. In Tomcat 4.XX, the servlet and jsp classes are stored in servlet.jar. Whereas Tomcat 5.XX, the servlet and jsp classes are stored in servlet-api.jar and jsp-api.jar respectively.

You can view the jar file using "jar tf servlet-api.jar".
[ October 13, 2004: Message edited by: Joyce Lee ]
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Does Tomcat 5.0.28 require a newer version of the JDK?
Im using C:\j2sdk1.4.2_05
This is my JAVA_HOME path by the way.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
According to the running.txt under tomcat, it says


* Download a Java Development Kit (JDK) release (version 1.3 or later) from:
http://java.sun.com/j2se/


So that should be no problem with j2sdk1.4.2_05. I'm using Jdk 5 (tiger) cos I wanted to test out the new features.

Have the "blank page" problem been resolved? How about you remove and reinstall the jdk? Remember to go to the "Add/Remove Program" to uninstall the JRE as well.

Joyce
[ October 18, 2004: Message edited by: Joyce Lee ]
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Paul, you might want to search the Web Applications Forums to see if anyone has the similar problem.

Joyce
[ October 18, 2004: Message edited by: Joyce Lee ]
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
nah still got the blank page thing happening. Ill have a hunt around elsewhere and see what i can fathom.

Thanx anyway for the help.
Paul Wright
Ranch Hand

Joined: Oct 05, 2004
Posts: 42
Joyce you have the patience of a saint. Its all going now. In the end it turned out the only thing i hadnt done was:

5) Modify conf/web.xml by uncommenting <server> and <server-mapping> for invoker

Now ive done that and its all working fine.
Thanx heaps for all your help.
I appreciate it more than you know.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Paul, that's great!

Your perseverance paid off.

Joyce
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Localhost leads to nowhere