EXCEPTION java.lang.ClassNotFoundException: servlet - But the Servlet is present; And web.xml is absolutely correct

会有一股神秘感。 提交于 2019-12-04 19:32:46

Well, seems that Servlet and Web.xml were correct but there was missing a tag that is a must for using Google App Engine. I wonder why it is not underlined and written with capital letters inside documentation.

Tag is <load-on-startup>1</load-on-startup>

Please refer to Java Application Configuration

Each custom servlet must be loaded on startup to let GA Engine instatiate the class and accept requests. Here is the final web.xml to use for deploying the application in GAE

    <servlet>
    <servlet-name>Clock</servlet-name>
    <servlet-class>clock.ClockServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Clock</servlet-name>
    <url-pattern>/clock</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
Nadav Finish

Hi please have a look at: ClassNotFoundException with ServletContextlistener

check the issue (second one) with the servlet-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!