• 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

problem accesing the servlet

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello I am trying to access the servlet in WEB-INF\servlet folder directly using the servlet name only without using the DD .
The problem is solved using the DD but I want to know how to access without DD.

The servlet I have created is:


I am using tomcat 5.0.
The servlet is in the correct directory.
i.e webapps/example/WEB-INF/classes/servlet/HelloWorld.

On the browser I am entering

http://localhost:8080/example/servlet/HelloWorld
and I am getting error 404.

Help me.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No can do. You'll need to declare and map the servlet in the deployment descriptor. And the class file must be placed in the correct location.

Or, you can look up the deprecated Invoker -- but it's use is strongly discouraged.
 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok.
I wanted to try this because the "Java 2 complete reference " uses this as a first servlet example.
And the book says to access the servlet directly without using the DD.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I imagine that's a rather old reference...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I just looked it up. That book is from 2002. That's like reading a book on black and white televeisions to learn how to repair plasma flat screen TVs.

You really really need to use a much more modern reference.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please spell out abbreviations at least once in a message--I had *no* idea what you meant by DD.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read about the dread Invoker Servlet here.

Early versions of Tomcat thought it would be clever to give you a simple way to address a servlet by class name so they invented the "invoker" servlet. This was a VERY BAD IDEA - it makes it harder to move on to real world servlet applications.

"It seemed like the thing to do at the time"

Bill
 
Greenhorn
Posts: 10
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Actually you can't access any file within WEB-INF. I you wish to get access to your servlet you have to use deployment descriptor (DD) and address servlet-url defined there.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic