- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的 JSP 页面,它显示一个表并重定向到 servlet 的 url。单击“保存”按钮时收到的错误是“HTTP 状态 404 - 未找到”。附言。我还制作了另一个 jsp,它是使用 doPost 上传文件的 servlet,它工作得很好,但只有项目的这一部分已经困扰我将近一个星期了!
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin's page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<%=request.getContextPath() %>/bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/jquery.min.js"></script>
<script src="bootstrap/js/popper.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<!-- <div class="container-fluid">
<h1>Admin's page</h1>
<p>Table with downloadable files uploaded by each manager</p>
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">User IDs</div>
<div class="col-sm-8" style="background-color:lavenderblush;">Uploaded File</div>
</div>
</div>
</body>
</html> -->
<div class="container-fluid">
<h2 style="text-align: center">Admin's page</h2>
<p style="text-align: center">Table with downloadable files uploaded by each manager</p>
<table class="table">
<thead class="thead-light">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>File</th>
</tr>
</thead>
<tbody>
<%
try
{
Class.forName("com.mysql.cj.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/login";
String username="root";
String password="your-password";
String query="select * from employeesloginaccount";
Connection conn=DriverManager.getConnection(url, username, password);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
%>
<tr>
<td><%=rs.getInt("id") %></td>
<td><%=rs.getString("first_name") %></td>
<td><%=rs.getString("last_name") %></td>
<td>
<form method="get" action="<%=request.getContextPath()%>/downloadFileServlet/?id="<%=rs.getInt("id") %> >
<input style="text-align: center" type="submit" value="Save">
</form>
</td>
</tr>
<%
}
%>
</tbody>
</table>
<%
rs.close();
stmt.close();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</div>
</body>
</html>
我的 servlet 页面,
package servlets;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/downloadFileServlet")
@MultipartConfig(maxFileSize = 536870912)
public class DBFileDownloadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
// size of byte buffer to send file
private static final int BUFFER_SIZE = 536870912;
// database connection settings
private String dbURL = "jdbc:mysql://localhost:3306/login";
private String dbUser = "root";
private String dbPass = "your-password";
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// get upload id from URL's parameters
int uploadId = Integer.parseInt(request.getParameter("id"));
Connection conn = null;
String message="";// connection to the database
try {
// connects to the database
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
conn = DriverManager.getConnection(dbURL, dbUser, dbPass);
// queries the database
String sql = "SELECT file FROM employeesloginaccount WHERE upload_id = ?";
PreparedStatement statement = conn.prepareStatement(sql);
statement.setInt(1, uploadId);
ResultSet result = statement.executeQuery();
if (result.next()) {
// gets file name and file blob data
String fileName = result.getString("file_name");
Blob blob = result.getBlob("file_data");
InputStream inputStream = blob.getBinaryStream();
int fileLength = inputStream.available();
System.out.println("fileLength = " + fileLength);
ServletContext context = getServletContext();
// sets MIME type for the file download
String mimeType = context.getMimeType(fileName);
if (mimeType == null) {
mimeType = "application/octet-stream";
}
// set content properties and header attributes for the response
response.setContentType(mimeType);
response.setContentLength(fileLength);
String headerKey = "Content-Disposition";
String headerValue = String.format("attachment; filename=\"%s\"", fileName);
response.setHeader(headerKey, headerValue);
// writes the file to the client
OutputStream outStream = response.getOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outStream.write(buffer, 0, bytesRead);
}
inputStream.close();
outStream.close();
message="File successfully downloaded";
} else {
// no file found
message="No file to be downloaded";
response.getWriter().print("File not found for the id: " + uploadId);
}
} catch (SQLException ex) {
ex.printStackTrace();
response.getWriter().print("SQL Error: " + ex.getMessage());
} catch (IOException ex) {
ex.printStackTrace();
response.getWriter().print("IO Error: " + ex.getMessage());
} finally {
if (conn != null) {
// closes the database connection
try {
conn.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
// sets the message in request scope
request.setAttribute("Message", message);
// forwards to the message page
getServletContext().getRequestDispatcher("/JSPs/Message.jsp").forward(request, response);
}
}
}
控制台显示以下内容,但我仍然必须通过它找出任何错误。
May 17, 2018 4:03:31 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MajorProject' did not find a matching property.
May 17, 2018 4:03:31 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:registration' did not find a matching property.
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.5.30
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 3 2018 20:04:09 UTC
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.5.30.0
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_162
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_162-b12
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=E:\Stationery\apache-tomcat-8.5.30\endorsed
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 17, 2018 4:03:31 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_162\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_162/bin/server;C:/Program Files/Java/jre1.8.0_162/bin;C:/Program Files/Java/jre1.8.0_162/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program Files\Java\jdk1.8.0_162\bin;E:\eclipse1;;.]
May 17, 2018 4:03:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 17, 2018 4:03:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 4:03:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 4:03:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 4:03:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 932 ms
May 17, 2018 4:03:32 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
May 17, 2018 4:03:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.30
May 17, 2018 4:03:32 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 17, 2018 4:03:33 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 17, 2018 4:03:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 17, 2018 4:03:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 4:03:33 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 981 ms
下面给出了新错误 HTTP Status 500 Internal Server Error 的堆栈跟踪,但首先我提到了运行代码时在 chrome 中给出的堆栈跟踪部分
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:41)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
May 17, 2018 10:50:57 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MajorProject' did not find a matching property.
May 17, 2018 10:50:57 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:registration' did not find a matching property.
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.5.30
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 3 2018 20:04:09 UTC
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.5.30.0
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_162
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_162-b12
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=E:\Stationery\apache-tomcat-8.5.30\endorsed
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 17, 2018 10:50:57 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_162\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_162/bin/server;C:/Program Files/Java/jre1.8.0_162/bin;C:/Program Files/Java/jre1.8.0_162/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program Files\Java\jdk1.8.0_162\bin;E:\eclipse1;;.]
May 17, 2018 10:50:57 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 17, 2018 10:50:58 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 10:50:58 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 10:50:58 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 10:50:58 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2107 ms
May 17, 2018 10:50:58 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
May 17, 2018 10:50:58 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.30
May 17, 2018 10:50:59 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 17, 2018 10:50:59 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 17, 2018 10:50:59 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 17, 2018 10:50:59 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 10:50:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1584 ms
1
May 17, 2018 10:53:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [servlets.DBFileDownloadServlet] in context with path [/MajorProject] threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
java.sql.SQLSyntaxErrorException: Unknown column 'upload_id' in 'where clause'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
at servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
May 17, 2018 10:55:45 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [servlets.DBFileDownloadServlet] in context with path [/MajorProject] threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
最佳答案
JSP 中的表单获取 URL 不正确,删除 servlet 名称后和查询参数前的“/”。
关于eclipse - 运行我的 servlet 页面时 HTTP 错误 404 意味着使用 JSP 和 servlet 从数据库下载长 BLOB 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50389410/
我在 OS X 中构建菜单栏项时找到了一些示例代码。它使用了单个 |我不确定它的实际含义。 (我想做的是在菜单项左键单击时调用一个函数,但在右键单击时显示菜单) 这是我的代码 //Get refere
为什么它在第 23 行抛出编译错误。'a' 是 Apple 类的对象,col 是包含 Apple 对象的列表,但它仍然是抛出下面提到的编译错误: 类型 Collection 中的方法 add(capt
我有一个类A,它扩展了抽象类B。 让B有一个 protected 字段值 我想在 A 中使用这个字段。如果 A 没有 value,我可以编写 this.value 从 B 获取它。 与super.va
DBLint 用于检查数据库状态。有46条规则。在 www.dblint.org 上对每条规则都有一些简单的解释,但对规则 31 的描述如下: 定义的主键不是最小键:主键是最小的 super 键。如果
var aa: (()?) = (john.residence?.address = someAddress) var bb: ()? = john.residence?.printNumberOfR
我对 jquery 的可重用插件有点陌生。我已经多次遇到这段代码,但无法弄清楚究竟发生了什么。 (function( $ ){ ... })( jQuery ); 谁能帮我解答一下吗? 最佳答案
这个问题已经有答案了: int foo (int argc, ...) vs int foo() vs int foo(void) in C (4 个回答) 已关闭 9 年前。 所以我最近在 Hack
typedef struct Element { struct Element *next; void *data; } Element; 在 pop 函数中,(!(elem = *s
数据加载两次...意味着 AsyncTask onPostExecute 加载相同的数据两次?我的 AsyncTask onPostExecute 运行两次它加载相同的数据...我正在运行异步任务以从
运行“yomeanjs”时,我无限期地挂起“这可能需要几分钟”。当我尝试运行 grunt 时,它失败了,与 npm start 相同。 我使用的是 Win 8.1,并安装了最新的 Node 和 Mon
我正在看 big nerd ranch 的“Android Programming”中的这个页面,我对下面的句子感到困惑。它声明“当 Activity 被隐藏时, Activity 对象不存在”。这让
是否 const vector意味着它的元素是const也一样? 在下面的代码中, v[0].set (1234);在 void g ( const vector & v )产生编译器错误 const
我是 xml 相关事物的新手 我无法理解: SelectNodes(@"//Form/*[. = 'on']"); 注:SelectNodes是 XmlNode 的函数.(与 XmlDocument
我想方便地控制命令行参数。因此我想使用 ShellLib。 我的代码是这样的: ... #include ... EFI_STATUS EFIAPI UefiMain ( EFI_HANDL
着眼于更正 Debian 上/etc/init.d/hostapd 中的一个问题。但是,我不知道这行代码是做什么的,也不知道它是如何工作的 [ -n "$DAEMON_CONF" ] || exit
有没有人遇到过类似我下图所示的情况? 我有一个变量 landingBools.didSlowPast40Knots(正如您从调试打印输出中看到的那样)为假,但出于某种原因,if 语句评估为真。 知道为
我设法使用 flexbox 和一些非常基本的 JavaScript 为自己构建了三个下拉菜单。 因为我不太了解,所以我使用了一个简单的函数三次,而不是使用参数、变量和其他东西。我将其称为丑陋的“蛮力”
这周刚开始学习 javascript。我有一个非常菜鸟的问题。 exports.displayName = (undefined: ?string); 在 React Native 中意味着什么? 这
我正在阅读有关 NaN here 的内容它说: A comparison with a NaN always returns an unordered result even when compari
编码格式:引入*表示“从头开始重复”。例子。输入-{a,b,a,b,c,a,b,a,b,c,d}可以写成{a,b,*,c,*,d}。输出:5;例如2:ABCABCE,输出- 5。 这里*表示从头开始重
我是一名优秀的程序员,十分优秀!