#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    3
    Rep Power
    0

    servlets on port 80


    I'm running Tomcat 4 on windows 2000.
    When i change the port to 80 in server.xml, only JSPs work..and not the servlets. ie:

    http://localhost/jclub/servlet/TestServlet
    cannot find anything


    But when I go back to 8080, it all works. ie:
    http://localhost:8080/jclub/servlet/TestServlet displays the results.

    How do i fix this? I do not want users to always type url:8080to access my site.



  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    13
    Rep Power
    0
    Put a little of you web.xml on line.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    3
    Rep Power
    0
    ok here goes:

    -------------------------------------------------------------------------------
    <servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>
    org.apache.catalina.servlets.DefaultServlet
    </servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>


    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>
    org.apache.catalina.servlets.InvokerServlet
    </servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>




    <!-- The mapping for the invoker servlet -->

    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>


    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    13
    Rep Power
    0
    I do not see anything in you web.xml your test servlet at all.
  8. #5
  9. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    I am assuming your TestServlet class is not in a package? If so, try putting it in a package called "test" or something. Then try the url
    http://localhost/jclub/servlet/test.TestServlet

    And see what it does. I believe some app servers have a problem accessing servlets/classes that are in the default package (read: no package).
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    13
    Rep Power
    0
    Ahh, i agree. I normally map all of my servlets in the web-xml, and do nto use the DefaultServlet. I agree with Nemi
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    3
    Rep Power
    0
    The web.xml is from the /conf directory not WEB-INF
    I did map the servlet in /WEB-INF/web.xml

    Anyways...i'll try to put it in a package and c how it goes.

    Thanks
  14. #8
  15. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    web.xml MUST go in the WEB-INF directory. servlets and beans MUST go in the WEB-INF/classes directory. Jar files MUST go in the WEB-INF/lib directory. The app server requires this.

    The two sentences you posted were contradictory, so I am not sure if you have a web.xml in the WEB-INF directory or not.
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    13
    Rep Power
    0
    Tomcat has two web.xml, one global and one for the local Web App.
  18. #10
  19. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    Interesting. Now that you mention it I remember reading references to this fact, but I must admit I did not think of it when he posted. I am currently running an older version of Websphere at work, which is quite behind the times.

IMN logo majestic logo threadwatch logo seochat tools logo