aspose file tools*
The moose likes Servlets and the fly likes problem accesing the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem accesing the servlet" Watch "problem accesing the servlet" New topic
Author

problem accesing the servlet

rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
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.


Rakesh Kadulkar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

I imagine that's a rather old reference...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please spell out abbreviations at least once in a message--I had *no* idea what you meant by DD.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
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
Alex Pustovit
Greenhorn

Joined: Jul 22, 2009
Posts: 10

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem accesing the servlet