当前位置: 动力学知识库 > 问答 > 编程问答 >

java - how to make the input for ANTLR from textarea in a jsp without error?

问题描述:

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: