五月 23, 11:09:27 上午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [HANA.HanaInputOracle] in context with path [/JAVA_HANA] threw exception
java.lang.NullPointerException
at HANA.HanaInputOracle.doPost(HanaInputOracle.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
at org.apache..JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
这是报错信息,以下是相对应的java文件
package HANA;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
Servlet implementation class HanaInputOracle
*/
@WebServlet("/HanaInputOracle")
public class HanaInputOracle extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
@see HttpServlet#HttpServlet()
*/
HanaInputOracle() {
super();
// TODO Auto-generated constructor stub
}
/**
@see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
response)
*/
void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
@see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
response)
*/
void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
ORACLE oarcle = new ORACLE();
Connection conn = oarcle.connoracle();
PreparedStatement st = null;
USER user = (USER) request.getSession().getAttribute("zb");
String INSERT = "insert into SCM_S901 VALUES('" + user.getSPMON() + "','" + user.getSPTAG() + "','"
user.getVTWEG() + "','" + user.getMATNR() + "','" + user.getZXSJE() + "')";
//String SEC = "select * from SAPRED.S901 where SPMON='06'";
{
// st.executeUpdate(SEC);
st.executeUpdate(INSERT);
response.sendRedirect("../result.jsp");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
response.sendRedirect("../error.jsp");
}
}
}