Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在Weblogic服务器上使用Fileupload Multipart_Java_Docker_Weblogic - Fatal编程技术网

Java 无法在Weblogic服务器上使用Fileupload Multipart

Java 无法在Weblogic服务器上使用Fileupload Multipart,java,docker,weblogic,Java,Docker,Weblogic,在docker上请求Weblogic 12.2.1.4-dev中的servlet部分时出现阻塞异常。(请注意,这在Wildfly服务器上工作) 我使用的Java代码是: import javax.servlet.http.*; protected void doPut(HttpServletRequest request, HttpServletResponse response) throws IOException { ... Collection<Part>

在docker上请求Weblogic 12.2.1.4-dev中的servlet部分时出现阻塞异常。(请注意,这在Wildfly服务器上工作)

我使用的Java代码是:

import javax.servlet.http.*;

protected void doPut(HttpServletRequest request, HttpServletResponse response) throws IOException {
    ...
    Collection<Part> parts = request.getParts();
    ...
}
<Oct 2, 2020 9:17:59,302 AM GMT> <Warning> <HTTP> <BEA-101394> <The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.> 
javax.servlet.ServletException: The request content-type is not a multipart/form-data
    at weblogic.servlet.utils.fileupload.Multipart.getParts(Multipart.java:158)
    at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.getParts(ServletRequestImpl.java:2497)
    at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.access$3000(ServletRequestImpl.java:2181)
    at weblogic.servlet.internal.ServletRequestImpl.getParts(ServletRequestImpl.java:3652)
    at javax.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:375)
// GENERAL
Request URL: http://172.21.1.1:8310/backoffice/service
Request Method: PUT
Status Code: 400 Bad Request
Remote Address: 172.1.1.1:8310
Referrer Policy: strict-origin-when-cross-origin
// REQUEST HEADERS
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-BE,en;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,es;q=0.5,it;q=0.4
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 647482
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryoCBB96YNI9S3vXob
Cookie: JSESSIONID=XIjomkiRAVxEtEn0qwlILe46arjsphNNibL00t2dHEhj75oc167A!-481127499
Host: 172.1.1.1:8310
Origin: http://172.1.1.1:8310
Pragma: no-cache
Referer: http://172.1.1.1:8310/backoffice/products/edit?id=MA01
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
X-Requested-With: XMLHttpRequest
// FORM DATA
subside-velo-pedelec25.pdf: (binary)
actionId: 98c6e900-0289-4bb6-8e98-2b967b2ee363 
windowId: YbVZr0XiCFHxU7K4hUlmBJmLoXwzY6

我也面临同样的问题

WebLogic核心库中FileUpload的servlet实现仅允许“POST”方法下的多部分请求:

如果此验证失败,它将引发异常,包括与实际错误没有任何关系的消息:

    if (!isMultipart())
      throw new ServletException("The request content-type is not a multipart/form-data"); 

因此,我将方法从PUT切换到POST。

是否使用方法request.getContentType()检查容器中到达请求的内容类型值@RokProdan request.getContentType():“多部分/表单数据;边界=----WebKitFormBoundaryDMBJ9xysJG9IK0D”您使用的是哪个版本的Servlet API?您的servlet类是否如中所述使用@MultipartConfig进行注释?我使用的是:
javax.servlet-api v3.1.0
,我的servlet类有以下两个注释:
@WebServlet(value=“/service”,loadOnStartup=1)@MultipartConfig(location=“/tmp”,fileSizeThreshold=1024*1024,maxFileSize=1024*1024*30,maxRequestSize=1024*1024*5*5)
请注意,文件上载在Widlfly服务器上运行正常
    if (!isMultipart())
      throw new ServletException("The request content-type is not a multipart/form-data");