Solved

Server problem (Tomcat 5.5)

Posted on 2004-10-28
303 Views
Last Modified: 2010-04-01
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]
0
Question by:DrWarezz
    34 Comments
     
    LVL 9

    Accepted Solution

    by:
    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
     
    LVL 9

    Expert Comment

    by:Nick_72
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    :o\ Thanks Nick.
    However, I'm getting the same problem. :o(

    ?

    cheers,
    [r.D]
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 35

    Assisted Solution

    by:TimYates
    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
     
    LVL 35

    Expert Comment

    by:TimYates
    > 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
     
    LVL 9

    Author Comment

    by:DrWarezz
    >"you should see a welcome page :-)"
    Nope -- no webpage loads :'(    lol

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

    thanks,
    [r.D]
    0
     
    LVL 9

    Expert Comment

    by:Nick_72
    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
     
    LVL 9

    Expert Comment

    by:Nick_72
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 9

    Expert Comment

    by:Nick_72
    did you put 8080 as the default port?
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    Yup.
    0
     
    LVL 9

    Expert Comment

    by:Nick_72
    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
     
    LVL 35

    Expert Comment

    by:TimYates
    and check there is an "index.jsp" inside webapps/ROOT
    0
     
    LVL 9

    Expert Comment

    by:Nick_72
    a good thing to do is also to check the logs:

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 35

    Expert Comment

    by:TimYates
    what about /logs/catalina.out ?
    0
     
    LVL 35

    Expert Comment

    by:TimYates
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    Note: R-DESKTOP is my computername, and M-DESKTOP is the computername of the ICS host. :-)
    0
     
    LVL 35

    Expert Comment

    by:TimYates
    does it say anything in catalina.out?
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    Oh yeah -- I searched for "catalina.out", and it doesn't exist. :o\
    0
     
    LVL 35

    Expert Comment

    by:TimYates
    Does tomcat work if you just run it normally?  (Not as a service)
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    :o\ How would I do that?
    0
     
    LVL 35

    Expert Comment

    by:TimYates
    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
     
    LVL 2

    Expert Comment

    by:siliconeagle
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 35

    Expert Comment

    by:TimYates
    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
     
    LVL 9

    Author Comment

    by:DrWarezz
    Thanks, Tim -- I'll do some reading around there  :-)
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    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
     
    LVL 35

    Expert Comment

    by:TimYates
    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
     
    LVL 9

    Expert Comment

    by:Nick_72
    Thanks :)

    /Nick
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    The Complete Ruby on Rails Developer Course

    Ruby on Rails is one of the most popular web development frameworks, and a useful tool used by both startups and more established companies to build strong graphic user interfaces, and responsive websites and apps.

    This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
    Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now