Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP method GET is not supported by this URL

 
arturo cruz
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run a servlet using tomcat 6 but cannot get past the HTTP method GET is not supported by this URL message. I have pasted below the servlet code, the web.xml and the directory structure.

Any help is appreciated.


******* the URL : http://localhost:8080/listenerTest/ListenTest.do

********** the directory structure ****************

webapps
listenerTest
WEB-INF
classes
com
example
** the servlet goes here****
***********the servlet ******************


************** Web.xml ************************


  • <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <description>
    JSP 2.0 Examples.
    </description>
    <display-name>JSP 2.0 Examples</display-name>

    <servlet>

    <servlet-name>listenerTester</servlet-name>

    <servlet-class>com.example.listenerTester</servlet-class>

    </servlet>

    <servlet-mapping>

    <servlet-name>listenerTester</servlet-name>

    <url-pattern>/ListenTest.do</url-pattern>


    </servlet-mapping>

    <context-param>

    <param-name>breed</param-name>
    <param-value>Great Dane</param-value>

    </context-param>


    <listener>
    <listener-class>
    com.example.myServletContextListener
    </listener-class>

    </listener>


    </web-app>

  •  
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 64980
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Likes 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Check your spelling.
     
    sagar kumar nerella
    Greenhorn
    Posts: 18
    Java Notepad Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hi

    from examining your code posted at the very first glance it is clear that the method should be named doGet() not goGet() .

    try this change if it doesn't works then try with the using the post method.
     
    arturo cruz
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That was the problem. doGet was mispelled as goGet. Amazing how I looked at the mehod name and didn't catch it.

    Thank you Sagar and Bear.

     
    Tim Moores
    Bartender
    Posts: 2851
    46
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    An excellent example of why you need to get into the habit of using the @Override annotation.
     
    Consider Paul's rocket mass heater.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic