This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException: javax.servlet.Servlet at Tomcat startup

 
Keerthi Kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I am trying to start the tomcat server directly by running startup.bat file of the tomcat/bin folder. But I am getting the below mentioned servlet exception:



I have added all the necessary jar files in the tomcat lib folder as well.
jars.JPG
[Thumbnail for jars.JPG]
List of jar files in the tomcat lib folder
 
Keerthi Kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

The server is getting started successfully, but the application is not loading. It is throwing the above mentioned servlet exception. Please help me out to resolve the issue.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EaseUp. I've changed the title of your thread.
 
Praneeth Yeri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. First check to which Jar does the Servlet class belongs to (I feel it is j2ee.jar). You can use the windows Search to find out where the jar lies in your system.
2. Put the Jar in the Runtime path of tomcat.
3. Restart the Server
 
Keerthi Kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear,

I added the j2ee.jar file into the tomcat/lib folder and when i started the server, I am getting the below error:

 
Praneeth Yeri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Do you have any working web app that is present in the webapps folder ? I feel that this error is coming because tomcat is not able to find any webapps ( web.xml). Try to clean up the webapps folder and try to put a working webapp with all the requried files ( web.xml etc.) in it.

2. One more way which works most of the time is, instead of doing debugging this way ,

I would suggest you download a fresh copy of Tomcat from the Internet and then directly start the server. Every tomcat download will have some working webapps in them. This would save you a lot of time instead of spending time on debugging a messed up tomcat install. After this, you can add your webapp to the working one.
 
Keerthi Kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Praneeth,

Just clarify below doubts of mine:

1. Where should i place the j2ee.jar and servlet-api.jar files?? ( in tomcat/lib or web-inf/lib folder)
2. can i place the servlet-api.jar in both tomcat/lib or web-inf/lib folder?
3. can i use both j2ee.jar and servlet-api.jar? will this lead to any conflict?

Awaiting your response.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't be adding those jars anywhere! If they're in WEB-INF/lib remove them!

Tomcat already has the jars it needs. Just leave them be.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic