解决java.lang.NoClassDefFoundError错误的方法

好端端辛苦做的项目  突然jsp页面打不开。报错如下


<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.29 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 500 - javax.servlet.ServletException: java.lang.NoClassDefFoundError: performance/WMac</h1><div class="line"></div><p><b>type</b> Exception report</p><p><b>message</b> <u>javax.servlet.ServletException: java.lang.NoClassDefFoundError: performance/WMac</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b></p><pre>org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: performance/WMac
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:555)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:461)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</pre><p><b>root cause</b></p><pre>javax.servlet.ServletException: java.lang.NoClassDefFoundError: performance/WMac
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:909)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:838)
	org.apache.jsp.net_005finfo_jsp._jspService(net_005finfo_jsp.java:486)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</pre><p><b>root cause</b></p><pre>java.lang.NoClassDefFoundError: performance/WMac
	org.apache.jsp.net_005finfo_jsp._jspService(net_005finfo_jsp.java:365)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</pre><p><b>root cause</b></p><pre>java.lang.ClassNotFoundException: performance.WMac
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
	org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:125)
	org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:62)
	org.apache.jsp.net_005finfo_jsp._jspService(net_005finfo_jsp.java:365)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</pre><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/8.0.29 logs.</u></p><hr class="line"><h3>Apache Tomcat/8.0.29</h3></body></html>


报错信息是java.lang.NoClassDefFoundError这是因为“引用自定义标签库出现异常”,根治此疑难杂症的方法

1、在lib目录下导入servlet-api.jar和jsp-api.jar这两个包,基本药到病除。这两个包在tomcat的lib目录下找到

2·、

        (1)项目根目录下新建一个libs文件夹

         (2)把要加的包放到这个目录下

         (3)右键 Build Path-> Use as source folder

         (4)在jar包上右键->add to build path

         (注意,上面的是libs,不是lib

3.

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页