根号申 发表于2021-11-09 11:49
给出控制台的异常日志
Stacktrace:
java.lang.NullPointerException
at mingrisoft.Function.CheckLogin(Function.java:17)
at mingrisoft.Login.LoginCheck(Login.java:18)
at org.apache.jsp.admin.login_jsp._jspService(login_jsp.java:131)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:467)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:378)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
根号申 发表于2021-11-11 08:59
光从这俩日志看,应该是程序连不上你的数据库,检查代码中数据库的配置
package mingrisoft;
import java.sql.*;
import java.util.*;
import java.io.*;
import mingrisoft.Function;
public class DBConnection
{
private String FileName;
private int DBType;
private Connection conn;
private String MySqlDriver;
private String MySqlURL;
public DBConnection()
{
conn = null;
}
public Connection getConn()
{
DBType= new Function().StrToInt(getPara("DBType"));
switch(DBType)
{
case 1:return(getConnToMySql());
default:return null;
}
}
public String getPara(String ParaName)
{
FileName="../DBConfig.property";
Properties prop= new Properties();
try
{
InputStream is=getClass().getResourceAsStream(FileName);
prop.load(is);
if(is!=null) is.close();
}
catch(Exception e) {
return "Error!";
}
return prop.getProperty(ParaName);
}
public Connection getConnToMySql()
{
try{
MySqlDriver = getPara("MySQLDriver");
MySqlURL = getPara("MySQLURL");
Class.forName(MySqlDriver).newInstance();
conn = DriverManager.getConnection(MySqlURL);
}catch(Exception e){
}
return conn;
}
}