運行我的java web項目時出現奇怪的異常。看起來這是「隨機」發生後,我保存了一些我的JSP的一些變化。我永遠不會記得改變任何設置。我從來沒有遇到過這樣的錯誤,因爲之前找到HubPortal
類沒有任何問題。獲取一個奇怪的java.lang.NoClassDefFoundError異常
下面是完整的堆棧跟蹤:
org.apache.jasper.JasperException: An exception occurred processing JSP page /hubmainpage.jsp at line 7
4: %>
5: <%
6: String responsepage = request.getParameter("show");
7: HubPortal hp = new HubPortal();
8: List processList = hp.getProcessList();
9: List clientList = hp.getClientList();
10: List transList = hp.getTransactionTypeList();
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.hubmainpage_jsp._jspService(hubmainpage_jsp.java:783)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
com.middleware.hts.HubPortal.<clinit>(HubPortal.java:23)
org.apache.jsp.hubmainpage_jsp._jspService(hubmainpage_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
任何想法,爲什麼我突然遇到這個錯誤的?
我把罐子裏的src(裏面有HubPortal類),它修復了我遇到的錯誤,但是它確實產生了另一個錯誤。 (我會把它放在這裏,但是我超過了字符數限制!) http://pastebin.com/s5Ldg7hz – user906153
顯然還有其他的依賴關係,但是這個異常現在不包含有用的信息。將Java代碼放入普通Java類而不是JSP文件應該會導致更明顯的例外。另見http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files/3180202#3180202 – BalusC
好的,謝謝。但是,關於爲什麼這個錯誤出現在藍色之外的任何想法? – user906153