Server problem (Tomcat 5.5)

Yup, me again :-)

Basically, I've installed Tomcat 5.5 on my local machine, and have started the service.

In the following directory:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes

I've placed the following file:
HelloWorld.java
I then compiled it in this same directory, with no errors :-)

Now, when I load up IE, and type: http://localhost:8080/servlet/HelloWorld

The title of the IE window says: "Cannot find server", and the page displays "The page cannot be displayed, etc....".

I don't know what I've done wrong, but.. any ideas? :-\
Have I 'installed' the HelloWorld files to the right directory?

Thanks in advance,
[r.D]
LVL 9
DrWarezzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nick_72Commented:
Hi,

add this to your C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\web.xml
and restart tomcat:

    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloWorld</servlet-name>
        <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>

Then you should be able to run:

http://localhost:8080/HelloWorld

/Nick



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nick_72Commented:
The default applikation doesn't seem to load the invoker servlet which is used if the servlet is not defined in the web.xml file, so the easiest way is to do as above.
0
DrWarezzAuthor Commented:
:o\ Thanks Nick.
However, I'm getting the same problem. :o(

?

cheers,
[r.D]
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

DrWarezzAuthor Commented:
Although it says that the server is started, is there anyway that I can verify that the server is running properly, and has created a Server socket?? :o\
0
TimYatesCommented:
You may need to stick your servlet in a package as well...

ie:  put:

    package test ;

at the top of your servlet java file, copy it to

    WEB-INF/classes/test

and compile it there

(and change Nick_72's config from

    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>

to

    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>test.HelloWorld</servlet-class>
    </servlet>
0
TimYatesCommented:
> Although it says that the server is started, is there anyway that I can verify that the server is running properly, and has created a Server socket?? :o\

Go to

http://localhost:8080

you should see a welcome page :-)
0
DrWarezzAuthor Commented:
>"you should see a welcome page :-)"
Nope -- no webpage loads :'(    lol

This would appear to be the problem then, right??

thanks,
[r.D]
0
Nick_72Commented:
Just a note:

The servlet does not have to be in a package.
If you would create a Java bean, however, the package is mandatory.

/Nick
0
Nick_72Commented:
DrWarezz, maybe you installed Tomcat as a service?
Go to Control Panel -> Administrative Tools -> Services.

Check for Apache Tomcat, if it is not started, rightclick and choose Start.

/Nick
0
DrWarezzAuthor Commented:
Okay, according to the Services area, it hadn't been started. I started it, but no "Welcome" page is displayed when I go to: http://localhost:8080/

:-\
0
Nick_72Commented:
did you put 8080 as the default port?
0
DrWarezzAuthor Commented:
Yup.
0
Nick_72Commented:
hmm...another thing (though which I believe the installer would have told you about in that case) is that the java runtime is not sufficient for running Tomcat. You need to install the Java SDK. Have you got the SDK installed?
0
TimYatesCommented:
and check there is an "index.jsp" inside webapps/ROOT
0
Nick_72Commented:
a good thing to do is also to check the logs:

C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs
0
DrWarezzAuthor Commented:
Oh, okay.

>"Have you got the SDK installed"
Yes. However, when I installed Tomcat, it automatically located  'what is ment to be the JRE', in a directory other than my SDK dir. :o\
Maybe that's the problem...?

>"and check there is an "index.jsp" inside webapps/ROOT"
Yeah, it's there.

>"a good thing to do is also to check the logs:"
Is this what you refer to...?

file:
jakarta_service_20041028.txt

content:
[2004-10-28 11:52:02] [info] Service Tomcat5 name Apache Tomcat
[2004-10-28 11:52:03] [info] Service Tomcat5 installed
[2004-10-28 11:52:03] [info] Procrun finished.
[2004-10-28 11:52:31] [info] Updating service...
[2004-10-28 11:52:31] [info] Service Tomcat5 updated
[2004-10-28 11:52:31] [info] Update service finished.
[2004-10-28 11:52:31] [info] Procrun finished.
[2004-10-28 11:52:32] [info] Updating service...
[2004-10-28 11:52:32] [info] Service Tomcat5 updated
[2004-10-28 11:52:32] [info] Update service finished.
[2004-10-28 11:52:32] [info] Procrun finished.
[2004-10-28 11:52:59] [info] Running Service...
[2004-10-28 11:52:59] [info] Starting service...
[2004-10-28 11:53:01] [info] Service started in 1687 ms.
[2004-10-28 11:53:05] [info] Run service finished.
[2004-10-28 11:53:05] [info] Procrun finished.
[2004-10-28 11:53:17] [info] Running Service...
[2004-10-28 11:53:17] [info] Starting service...
[2004-10-28 11:53:18] [info] Service started in 1421 ms.
[2004-10-28 11:53:22] [info] Run service finished.
[2004-10-28 11:53:22] [info] Procrun finished.


ThanQ.
0
TimYatesCommented:
what about /logs/catalina.out ?
0
TimYatesCommented:
You could also try running "netstat" in a command window, and look for port numbers that are being listened on...

Maybe it isn't running on 8080?
0
DrWarezzAuthor Commented:
Okay, I ran netstat, and here's the results:

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    R-DESKTOP:1027         localhost:2794         TIME_WAIT
  TCP    R-DESKTOP:1027         localhost:2800         TIME_WAIT
  TCP    R-DESKTOP:1027         localhost:2804         TIME_WAIT
  TCP    R-DESKTOP:1027         localhost:2822         TIME_WAIT
  TCP    R-DESKTOP:1027         localhost:2823         TIME_WAIT
  TCP    R-DESKTOP:2459         localhost:1027         CLOSE_WAIT
  TCP    R-DESKTOP:1970         M-DESKTOP.mshome.net:2869  ESTABLISHED
  TCP    R-DESKTOP:1975         baym-cs335.msgr.hotmail.com:1863  ESTABLISHED
  TCP    R-DESKTOP:5000         M-DESKTOP.mshome.net:3227  ESTABLISHED

I thought that I'd try "1027", as it seemed a common port above :-), so, I attempted:
http://localhost:1027/
And the results:

Title: HTTP 403 (Forbidden)
Content: You are not authorized to view this page, etc..

:o\
[r.D]
0
DrWarezzAuthor Commented:
I done netstat with the -a switch, to see all the listenning connections, and here's the results :-|

  Proto  Local Address          Foreign Address        State
  TCP    R-DESKTOP:epmap        R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:microsoft-ds  R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:1025         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:1026         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:1027         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:1970         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:1975         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:2459         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:2882         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:2890         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:2906         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:2907         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:3389         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:5000         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:5555         R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:1027         localhost:2895         TIME_WAIT
  TCP    R-DESKTOP:2459         localhost:1027         CLOSE_WAIT
  TCP    R-DESKTOP:2889         localhost:microsoft-ds  TIME_WAIT
  TCP    R-DESKTOP:netbios-ssn  R-DESKTOP:0            LISTENING
  TCP    R-DESKTOP:netbios-ssn  M-DESKTOP.mshome.net:3013  ESTABLISHED
  TCP    R-DESKTOP:1970         M-DESKTOP.mshome.net:2869  ESTABLISHED
  TCP    R-DESKTOP:1975         baym-cs335.msgr.hotmail.com:1863  ESTABLISHED
  TCP    R-DESKTOP:2882         M-DESKTOP.mshome.net:2869  CLOSE_WAIT
  TCP    R-DESKTOP:2883         M-DESKTOP.mshome.net:2869  TIME_WAIT
  TCP    R-DESKTOP:2890         a193-108-153-95.deploy.akamaitechnologies.com:http  CLOSE_WAIT
  TCP    R-DESKTOP:2906         www-level3.experts-exchange.com:http  ESTABLISHED
  TCP    R-DESKTOP:2907         www-level3.experts-exchange.com:http  ESTABLISHED
  TCP    R-DESKTOP:5000         M-DESKTOP.mshome.net:3009  ESTABLISHED
  TCP    R-DESKTOP:5000         M-DESKTOP.mshome.net:3423  ESTABLISHED
  UDP    R-DESKTOP:microsoft-ds  *:*                    
  UDP    R-DESKTOP:1037         *:*                    
  UDP    R-DESKTOP:1067         *:*                    
  UDP    R-DESKTOP:1130         *:*                    
  UDP    R-DESKTOP:1226         *:*                    
  UDP    R-DESKTOP:1251         *:*                    
  UDP    R-DESKTOP:1979         *:*                    
  UDP    R-DESKTOP:ntp          *:*                    
  UDP    R-DESKTOP:1031         *:*                    
  UDP    R-DESKTOP:1053         *:*                    
  UDP    R-DESKTOP:1900         *:*                    
  UDP    R-DESKTOP:2106         *:*                    
  UDP    R-DESKTOP:discard      *:*                    
  UDP    R-DESKTOP:ntp          *:*                    
  UDP    R-DESKTOP:netbios-ns   *:*                    
  UDP    R-DESKTOP:netbios-dgm  *:*                    
  UDP    R-DESKTOP:1900         *:*                    
  UDP    R-DESKTOP:2051         *:*                    
  UDP    R-DESKTOP:17987        *:*                    
  UDP    R-DESKTOP:48945        *:*            


I must remind you, that I'm on a network, running the internet off of another machine (the ICS host). :o)
But... isn't that weird?

[r.D]
0
DrWarezzAuthor Commented:
Note: R-DESKTOP is my computername, and M-DESKTOP is the computername of the ICS host. :-)
0
TimYatesCommented:
does it say anything in catalina.out?
0
DrWarezzAuthor Commented:
Oh yeah -- I searched for "catalina.out", and it doesn't exist. :o\
0
TimYatesCommented:
Does tomcat work if you just run it normally?  (Not as a service)
0
DrWarezzAuthor Commented:
:o\ How would I do that?
0
TimYatesCommented:
errr...  you *should* be able to run tomcat/bin/startup.bat

I'm not sure about how to get it set up right for windows though :-(

Hmmm
0
siliconeagleCommented:
lets try a basic one:-
do you have JDK installed? if so what version?

have you set a user enviroment variable for JAVA_HOME?
to do so, go to :-
MyComputer->rt clk->properties.
Advanced(tab) -> Environent variables(clk)
under user environemnt variables for <username> add an environment variable
"JAVA_HOME" , value is the path to your JDK top level dir (in my case"C:\j2sdk1.4.2_04")
0
DrWarezzAuthor Commented:
Yeah, I have JDK, version 1.4.
I've added the environment variable JAVA_HOME, with the value of: C:\j2sdk1.4.1_06

>"you *should* be able to run tomcat/bin/startup.bat"
As in: Tomcat 5.5\bin\startup.bat ?
If so, startup.bat doesn't exist (and neither does startup.sh).

:o\
Ta
0
DrWarezzAuthor Commented:
This is all really weird.
Would you lot recommend that I just download an earlier version of Tomcat? One that you lot are slightly more familiar with perhaps? :-)  Because, if you think it would help, then I'll be more than happy to do that.

btw; I'll be back in about 50 minutes :)

ThanQ.
[r.D]
0
TimYatesCommented:
Have you looked at this:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/windows-service-howto.html

It may contain something that helps? :-/
0
DrWarezzAuthor Commented:
Thanks, Tim -- I'll do some reading around there  :-)
0
DrWarezzAuthor Commented:
Okay, I decided that I'd give an earlier version of Tomcat a go. I installed the latest version of Tomcat 4, and it ALL works great! :D

So, I'll leave v5.5 for another time ;-)

I really appreciate all the help though - so I'll split the points. :-)

Thanks again,
[r.D]
0
TimYatesCommented:
Damn...that's a shame :-)  Still, hopefully when 5.5 is out of beta it will work better, and you can give it another go ;-)

It's one of those things that is really hard to fix without being there :-(

> so I'll split the points

Aww!  Thanks :-)

Good luck with it...

Tim
0
Nick_72Commented:
Thanks :)

/Nick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.