GeeCON Prague 2014*
The moose likes Tomcat and the fly likes Servlet getting loaded twice.... dont know why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlet getting loaded twice.... dont know why?" Watch "Servlet getting loaded twice.... dont know why?" New topic
Author

Servlet getting loaded twice.... dont know why?

Abhi Bharade
Greenhorn

Joined: Nov 25, 2004
Posts: 11
A servlet which is meant to run as soon as tomcat(5.5.7) starts is getting loaded twice and generates exception the second time.
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
... and what would that Exception be Abhi.

share the wisdom

J.
Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
Did you ever figure out why the servlet is beeing run twice?

I have the same problem now with Tomcat 5.5.17. What happens is that ALL of the classes, including the servlets, are instantiated twice by Tomcat.

I can't figure out why.

Hope someone can help!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
As I recall, this can happen if you are using both the invoker servlet and a web.xml mapping of an individual servlet, or multiple mappings of a single servlet, but that was on a servlet by servlet basis.

Why are you sure that all servlets are being loaded twice. Does this happen all at once on startup or gradually as requests come in?

Bill
Dirk Schumacher
Greenhorn

Joined: Sep 06, 2006
Posts: 8
Having the same problem. I willinvestigate in the InvokerServlet and my web.xml. I am running tomcat 5.5 with eclipse(wtp). I could imagine there's the problem since eclipse uses its own "virtual" web-app directory for tomcat.
Let me know if anyone figured out why it loads twice....
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Egil Poma:

I have the same problem now with Tomcat 5.5.17. What happens is that ALL of the classes, including the servlets, are instantiated twice by Tomcat.
...


The Tomcat Manager application has a screen that lists the deployed applications and their status. See if your app was deployed twice.

This can happen if you explicitly configure your app (either in server.xml or with a context fragment file) AND put your app in Tomcat's webapps directory.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
GeeCON Prague 2014
 
subject: Servlet getting loaded twice.... dont know why?