• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with Tomcat

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
People, when I put this path "http://localhost:8080/Beer-v1/Test.do" into my web browser instead of going to the servlet and creating a html page, the browser starts downloading of a Test.do type archive.

All my classes are ok and my web.xml is like this:

<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/web-app_2_4.xsd" version="2.4">

<servlet>
<servlet-name>Teste</servlet-name>
<servlet-class>com.example.ListenerTester</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Teste</servlet-name>
<url-pattern>/Test.do</url-pattern>
</servlet-mapping>

<context-param>
<param-name>breed</param-name>
<param-value>Beagle</param-value>
</context-param>

<listener>
<listener-class>
com.example.MyServletContextListener
</listener-class>
</listener>
</web-app>




Anyone knows what the problem is and how to fix it?

Thanks for the help.

Claudio
[ December 06, 2006: Message edited by: Claudio Donat� ]
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is Test.do type archive?
i suppose Test.do is just a url name.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Claudio Donat�:

All my classes are ok and my web.xml is like this:


How do you know they're all OK?

What URL are you using when trying to access your servlet?
 
Claudio Donat�
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rahul Bhattacharjee, Test.do is the name that I put on my web.xml archive to be the reference that the client uses to call the servlet. Like this:
<url-pattern>/Test.do</url-pattern>.

Ben Souther, I suppose my classes are ok because I copy them from the book Head first, Servlets and JSP. I check more than 1 time to see if I made a mistake there. The url that I am using is "http://localhost:8080/Beer-v1/Test.do", and it is the url that the book tell us to use.

Thanks for the reply people. I hope we can find out what I doing wrong.
 
Claudio Donat�
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the message that I am getting when I try to access the servlet:


[ December 07, 2006: Message edited by: Claudio Donat� ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks to me that your class is not alright.

Post the code to your servlet.
When doing so, be sure to wrap the code in UBB Code tags (there is a button on the edit screen to help with this.
 
Claudio Donat�
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the code to my servlet.



This is the Listener code.

 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not very sure , but are you having any file named Test.do in webapp/Beer-v1 folder in tomcat ?
What happends when you say yes to download?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Should be:
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One lesson here is not to say "all is ok" when something is not working
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic