HTTP 500错误:无法解析类型

时间:2012-12-04 16:19:02

标签: jsp

这是我的文件结构:

-webapps
 -ROOT
  -helloworld
  |-WEB-INF
  | -classes
  |  -team2
  |   -Hello.class
  -test.jsp

Hello.java是:

package team2;
public class Hello {
    public Hello() {}
    public String sayHello() {
        return "Hello World";
    }
}

test.jsp是:

<%@page import="team2.*" %>
say something
<%
    Hello hello = new Hello();
    out.println(hello.sayHello());
%>

我很确定我的实施是对的。但仍然不知道为什么它总是失败并返回以下错误:

Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)

0 个答案:

没有答案