Servlet : SEVERE: Allocate exception for servlet

前端 未结 11 1764
故里飘歌
故里飘歌 2021-02-06 03:38

The following stacktrace is what I get when i try to access a servlet, which seems running fine from Tomcat manager.

11 Sep, 2012 11:50:12 AM org.apache.catalin         


        
相关标签:
11条回答
  • 2021-02-06 04:13

    Somehow you are missing the servlet-api.jar. It should be located in the tomcat\lib folder.

    0 讨论(0)
  • 2021-02-06 04:14

    After looking into the Exceptions, you got, some where you have misplaced the jar files

    (servlet-api.jar). It should be under your Project/WEB-INF/lib folder. I think it will

    works if your jar files are in the path specified above.

    0 讨论(0)
  • 2021-02-06 04:14

    If you get this error "SEVERE: Allocate exception for servlet" coupled with a "java.lang.InstantiationException" exception, make sure that your servlet class has a public no-argument constructor since the servlet container needs to be able to instantiate it.

    If your servlet class does not have an explicit non-zero argument constructor defined (which is usually the case), the default constructor provided by the compiler would suffice.

    0 讨论(0)
  • 2021-02-06 04:17

    "java.lang.Error: Unresolved compilation problems: "

    says that application is not compiled properly. Please put the servlet-api.jar in classpath, not just in lib folder of project, but also attach that to classpath.

    Please make sure that same jar also available in tomcat/common/lib folder.

    0 讨论(0)
  • 2021-02-06 04:24

    I had the same problem! Spent 2 hours searching for solution! And here it is!

    WebContent (under Dynamic Web Project) -> WEB-INF -> lib (it's empty- all right) -> right click on it (lib) -> Build Path -> Use as Source Folder.

    DONE!

    0 讨论(0)
提交回复
热议问题