macOsX
macOsX

Reputation: 457

Class cast exception while running the jsp file

I'm trying to run one of my .jsp file and i'm getting class cast exception.

('org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomcat.InstanceManager')

I have placed all my jars in WEB-INF/lib folder and I have included all the required jars.

Is this error occurs because of .jar versions mismatch?

Kindly let me know if anyone knows about this error.

Upvotes: 4

Views: 8071

Answers (1)

JB Nizet
JB Nizet

Reputation: 692121

You must not put tomcat's jar files into WEB-INF/lib. Tomcat already has thoses classes, and they must be loaded by the root tomcat classloader, not by the webapp's classloader. Unless there is a specific library in this list of jars that is not part of Tomcat, all those jars shouldn't be there.

What you put in WEB-INF/lib are libraries that your code uses, like Guava or OpenCSV or whatever jar you could have created yourself. Not Tomcat's own libraries.

Upvotes: 5

Related Questions