This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a web application in which I am facing one wiered pbm. I see tomcat loading servlet twice , on which my application logic is failing and quits.
Getting below error in log file.
My findings : One thing I did was , inside comp folder I made a copy of website folder and renamed it to website_old. Now both folders contains servlet.jar. Will it be causing a pbm???
Jan 29, 2009 10:48:34 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(.\comp\website_old\WEB-INF\lib\servlet.jar) - jar no
t loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
SCJP 1.4 : 91%
SCWCD 5: 96%
Joined: Dec 23, 2008
One more findings :
Server.xml has an entry of below
So tomcat should look for website folder in the specified directory, but in the C:\Program Files\Avaya/comp directory, there are two directories , website and website_old.
Why tomcat is searching for C:\Program Files\Avaya/comp/website_old application if it gets the C:\Program Files\Avaya/comp/website . ??
I have tomcat6.
While I'm not sure why the servlet would get loaded twice, there are two things you should fix:
1) Don't keep the Servlet and JSP API jar files anywhere in your web app. Tomcat has its own copy, and will refuse to load it from elsewhere. That's what that message is telling you.
2) Any servlet can be loaded more than once. You need to write your servlets in such a way that loading it, then unloading it, and then loading it again will not cause problems. The container is free to do that. So if loading the servlet a second time causes problems, then you need to write the servlet's destroy method so that there will be no problems when it is loaded again.
When that happens, we appreciate it if you could drop a note into the thread stating that you found the solution and what it was. This will, first and foremost, prevent someone from wasting time answering a question that's already been answered and also, possibly provide the answer to someone else with the same problem who is searching the forums before asking the question..
Glad it's working for you.
Joined: Dec 23, 2008
I mean to say , I have received the reply on tomcat forum. I didnt mean to say that my issues/doubt has been released. I appreciate , your time for responding my posts. I am always be and will take care here forth too , to update about the status of the query .