使用jsp:useBean的時候出錯!

aill發表於2004-12-22
其他jsp頁面正常
有一個頁面是
<%@ page contentType="text/html"%>
<jsp:useBean id="test" scope="session" class="testBean"/>
<%=test.getUserid()%>
<%=test.getPassword()%>

類testBean程式碼為
public class testBean implements java.io.Serializable{
private String userid = "init";
private String password = "init";

public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
並且編譯透過

但是執行的時候報錯
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.


應該是找不到編譯所需的類包,但是所需要的類我都在CLASSPATH中宣告瞭啊
我的CLASSPATH是
.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\msbase.jar;%JAVA_HOME%\lib\mssqlserver.jar;%JAVA_HOME%\lib\msutil.jar;%JAVA_HOME%\lib\msutil.jar;%JAVA_HOME%\lib\jbcl.jar;%JAVA_HOME%\lib\servlet-api.jar;%JAVA_HOME%\jre\lib\

我的JAVA_HOME是
c:\j2sdk1.4

請問哪出錯了,謝謝

相關文章