MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » The server encountered an internal error () that

The server encountered an internal error () that prevented it from fulfilling this request

www.MyException.Cn  网友分享于:2013-09-12  浏览:875次
向JSP页面引入自定义类,求救;
我写了一个JAVA类
public class test
{
public void speak()
{
System.out.println("hello world");
}
}
编译成CLASS后放在\webapps\ROOT\WEB-INF\classes\deal下面;
然后在JSP页面引用
<%@page import = "deal.test"%>
<%
test tt = new test();
%>
可是老报错:
请问是我写错了吗, 我也是刚学, 麻烦大家帮忙下, 看看是什么错误,谢谢//
type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /connectDatabase.jsp at line 3

1: <%@page import = "deal.test"%>
2: <%
3: test tt = new test();
4: %>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:567)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

javax.servlet.ServletException: java.lang.NoClassDefFoundError: test
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
org.apache.jsp.connectDatabase_jsp._jspService(connectDatabase_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

java.lang.NoClassDefFoundError: test
org.apache.jsp.connectDatabase_jsp._jspService(connectDatabase_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

java.lang.ClassNotFoundException: test
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:126)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
org.apache.jsp.connectDatabase_jsp._jspService(connectDatabase_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)



------解决方案--------------------
漏了这句?
Java code
package deal;

------解决方案--------------------
引用类放在lib下面就行了!
别搞得那么复杂。。
------解决方案--------------------
class no found 没找到指定的类呗 package deal; 应该这样就行了

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有