File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes What can it be, init() did not called? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "What can it be, init() did not called?" Watch "What can it be, init() did not called?" New topic
Author

What can it be, init() did not called?

sindy lee
Greenhorn

Joined: Aug 05, 2010
Posts: 14
Hi, everybody,

I wrote a servlet, there are standard Methods like init() (without parameters), doPost(), doAll(), doGet(). But i found that init() is not called at all. There is no log file to be written.
So anyone has idea, what can it be?

Thanks!!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
Probably an error in configuration.

Exactly what happens if you try to open the URL in a browser?

(If you are using MSIE make sure that "friendly" error messages are turned off.)

Bill

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

Has the servlet been requested? The container can choose to delay calling init() until it actually has to.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42911
    
  68
Make sure you put @Override annotations on all methods that are intended to override some other method. (For example, "doAll" is not a standard servlet method.)
prem pillai
Ranch Hand

Joined: Nov 02, 2007
Posts: 87

Why dont you post your code? Your servlet is extended from which class?
sindy lee
Greenhorn

Joined: Aug 05, 2010
Posts: 14
William Brogden wrote:
Exactly what happens if you try to open the URL in a browser?




there's nothing in the browser, even no erro messages.
sindy lee
Greenhorn

Joined: Aug 05, 2010
Posts: 14
prem pillai wrote:Why dont you post your code? Your servlet is extended from which class?


actualy I wrote many servlets, all extends from the class HttpServlet. The problem is, all other servlets work fine, only one of them is "empty", just no any reaction, all of them seems like very closely in the code-structur, why just only one?
sindy lee
Greenhorn

Joined: Aug 05, 2010
Posts: 14
But anyway, thanks a lot, guys!
prem pillai
Ranch Hand

Joined: Nov 02, 2007
Posts: 87

sindy lee wrote:all of them seems like very closely in the code-structur, why just only one?

Sindy , the information you have posted is not enough .......
If I ask you a question like "I have 100 cows , why one of them is white in colour?"...what would be your answer?

So post the problem creating code here , provide us details of your servlet configuration/mapping (if possible web.xml itself) , your server ..etc.
Ashutosh M Kulkarni
Ranch Hand

Joined: Jun 07, 2010
Posts: 41

prem pillai wrote:If I ask you a question like "I have 100 cows , why one of them is white in colour?"...what would be your answer?

lol dude

@Sindy:
Please post the code for just the servlet that's been bothering you. And other supporting code too.
Maybe someone else will find what you've been missing all this time.


SCJP 6, next stop - OCPJWCD!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What can it be, init() did not called?