问题描述:

I build dynamic web project in eclipse JAVA EE , I make a servlet and write in this code :

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException

{

try {

String comment = request.getParameter("comment") ;

ANTLRInputStream input = new ANTLRInputStream(request.getParameter("comment"));

} catch(Exception exception) {

exception.printStackTrace();

}

}

when I run the project on server "apache-tomac-7" it take the input from text area then throw exciption :

**java.lang.NoClassDefFoundError: org/antlr/v4/runtime/ANTLRInputStream

MyServlet.doPost(MyServlet.java:41)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)**

so How I can solve this problem ?

网友答案:

Usually NoClassDefFoundErrors happen because you compiled your project with certain libraries, that are not found during runtime (or because a different version of your library is used by tomcat). You may want to check your classpath and make sure antlr is listed in your runtime libraries or copied within your tomcat libraries.

There are similar questions on this website, you may want to check it out: How to Solve java.lang.NoClassDefFoundError?

网友答案:

ok , My Problem solve by add to my WEB-INF the (antlr-x.jar) and (annotation-api.jar) Thanks for all

相关阅读:
Top