Asif Kamran Malick
Asif Kamran Malick

Reputation: 3251

ClassNotFoundException is thrown upon Starting the Tomcat server

I was just following a tutorial regarding pre-initialization of servlets using the legacy way of adding the <load-on-startup> element to the web.xml. I have a simple sysout statement in the init method of my servlet. When I try to start the server to check if the pre-initialization really works, I get below exception(I can provide the whole log if you need it):

INFO: Marking servlet PreInitServlet as unavailable
Apr 08, 2017 8:42:55 PM org.apache.catalina.core.StandardContext loadOnStartup`
SEVERE: Servlet [PreInitServlet] in web application [/PreInitDemo] threw load() exception
java.lang.ClassNotFoundException: com.codingethics.trainings.servlets.preinit.PreInitSevlet

I have done great amount of searching over the internet, but no luck. Almost all the suggestions that I came across were somewhat related to Spring. I'm not at all using Spring here.
I'm trying to learn the servlets technology. Any help in this regard is highly appreciated.

Thanks.

Upvotes: 0

Views: 69

Answers (1)

Kriegel
Kriegel

Reputation: 433

The class missing is: com.codingethics.trainings.servlets.preinit.PreInitSevlet The Servlets name is: PreInitServlet

I guess you have to add a "r" in the web.xml for the Servlet's class name, so from

...PreInitSevlet

to

...PreInitServlet

Upvotes: 1

Related Questions