Error parsing http request header java io eofexception null

Exception coming in logs org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1588823341079 sessioncount 1 {"@timestamp":"2020-05-07T09:19:01.079+05:30&...

Exception coming in logs

org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1588823341079 sessioncount 1
{«@timestamp»:»2020-05-07T09:19:01.079+05:30″,»@Version»:»1″,»message»:»Start expire sessions StandardManager at 1588823341079 sessioncount 1″,»logger_name»:»org.apache.catalina.session.ManagerBase»,»thread_name»:»Catalina-utility-2″,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:01.079 DEBUG [,,,] 15884 — [alina-utility-2] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0
{«@timestamp»:»2020-05-07T09:19:01.079+05:30″,»@Version»:»1″,»message»:»End expire sessions StandardManager processingTime 0 expired sessions: 0″,»logger_name»:»org.apache.catalina.session.ManagerBase»,»thread_name»:»Catalina-utility-2″,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:53.629 DEBUG [,,,] 15884 — [o-9288-Acceptor] o.apache.tomcat.util.threads.LimitLatch : Counting up[http-nio-9288-Acceptor] latch=1
{«@timestamp»:»2020-05-07T09:19:53.629+05:30″,»@Version»:»1″,»message»:»Counting up[http-nio-9288-Acceptor] latch=1″,»logger_name»:»org.apache.tomcat.util.threads.LimitLatch»,»thread_name»:»http-nio-9288-Acceptor»,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:53.630 DEBUG [,,,] 15884 — [o-9288-Acceptor] o.apache.tomcat.util.threads.LimitLatch : Counting up[http-nio-9288-Acceptor] latch=2
2020-05-07 09:19:53.630 DEBUG [,,,] 15884 — [nio-9288-exec-5] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31807916:org.apache.tomcat.util.net.NioChannel@71b7af05:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53786]], Read from buffer: [0]
{«@timestamp»:»2020-05-07T09:19:53.630+05:30″,»@Version»:»1″,»message»:»Counting up[http-nio-9288-Acceptor] latch=2″,»logger_name»:»org.apache.tomcat.util.threads.LimitLatch»,»thread_name»:»http-nio-9288-Acceptor»,»level»:»DEBUG»,»level_value»:10000}
{«@timestamp»:»2020-05-07T09:19:53.630+05:30″,»@Version»:»1″,»message»:»Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31807916:org.apache.tomcat.util.net.NioChannel@71b7af05:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53786]], Read from buffer: [0]»,»logger_name»:»org.apache.tomcat.util.net.SocketWrapperBase»,»thread_name»:»http-nio-9288-exec-5″,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:53.630 DEBUG [,,,] 15884 — [nio-9288-exec-5] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header

java.io.EOFException: null
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1235)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1143)
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:735)
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:353)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

{«@timestamp»:»2020-05-07T09:19:53.630+05:30″,»@Version»:»1″,»message»:»Error parsing HTTP request header»,»logger_name»:»org.apache.coyote.http11.Http11Processor»,»thread_name»:»http-nio-9288-exec-5″,»level»:»DEBUG»,»level_value»:10000,»stack_trace»:»java.io.EOFException: nullrntat org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1235)rntat org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1143)rntat org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:735)rntat org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:353)rntat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260)rntat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)rntat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)rntat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)rntat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rntat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rntat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rntat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rntat java.lang.Thread.run(Thread.java:748)rn»}
2020-05-07 09:19:53.631 DEBUG [,,,] 15884 — [nio-9288-exec-2] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@5657fb55:org.apache.tomcat.util.net.NioChannel@3503ede7:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53787]], Read from buffer: [0]
{«@timestamp»:»2020-05-07T09:19:53.631+05:30″,»@Version»:»1″,»message»:»Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@5657fb55:org.apache.tomcat.util.net.NioChannel@3503ede7:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53787]], Read from buffer: [0]»,»logger_name»:»org.apache.tomcat.util.net.SocketWrapperBase»,»thread_name»:»http-nio-9288-exec-2″,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:53.631 DEBUG [,,,] 15884 — [nio-9288-exec-5] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31807916:org.apache.tomcat.util.net.NioChannel@71b7af05:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53786]], Status in: [OPEN_READ], State out: [CLOSED]
{«@timestamp»:»2020-05-07T09:19:53.631+05:30″,»@Version»:»1″,»message»:»Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31807916:org.apache.tomcat.util.net.NioChannel@71b7af05:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53786]], Status in: [OPEN_READ], State out: [CLOSED]»,»logger_name»:»org.apache.coyote.http11.Http11Processor»,»thread_name»:»http-nio-9288-exec-5″,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:53.631 DEBUG [,,,] 15884 — [nio-9288-exec-2] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@5657fb55:org.apache.tomcat.util.net.NioChannel@3503ede7:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53787]], Read direct from socket: [590]
{«@timestamp»:»2020-05-07T09:19:53.631+05:30″,»@Version»:»1″,»message»:»Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@5657fb55:org.apache.tomcat.util.net.NioChannel@3503ede7:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9288 remote=/0:0:0:0:0:0:0:1:53787]], Read direct from socket: [590]»,»logger_name»:»org.apache.tomcat.util.net.NioEndpoint»,»thread_name»:»http-nio-9288-exec-2″,»level»:»DEBUG»,»level_value»:10000}
2020-05-07 09:19:53.632 DEBUG [,,,] 15884 — [nio-9288-exec-5] o.apache.tomcat.util.threads.LimitLatch : Counting down[http-nio-9288-exec-5] latch=2
2020-05-07 09:19:53.632 DEBUG [,,,] 15884 — [nio-9288-exec-2] o.a.coyote.http11.Http11InputBuffer : Received [POST /selfie HTTP/1.1
image: image.jpg
User-Agent: PostmanRuntime/7.24.1
Accept: /
Cache-Control: no-cache
Postman-Token: ab33c360-fb87-4d3a-914b-f1cfa55d365f
Host: localhost:9288
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=—————————794444009395957859673194
Cookie: JSESSIONID=973DAABC39BC3EA594131B3B606EDE07
Content-Length: 169

—————————-794444009395957859673194
Content-Disposition: form-data; name=»image»

image.jpg

@RestController
public class SelfieUploadController {

private static final Logger LOG = LoggerFactory.getLogger(SelfieUploadController.class);

private final StorageService storageService;

@Autowired
public SelfieUploadController(StorageService storageService) {
    this.storageService = storageService;
}

@GetMapping("/")
public String listUploadedFiles(Model model) throws IOException {

    model.addAttribute("files", storageService.loadAll().map(
            path -> MvcUriComponentsBuilder.fromMethodName(SelfieUploadController.class,
                    "serveFile", path.getFileName().toString()).build().toUri().toString())
            .collect(Collectors.toList()));

    return "uploadForm";
}

@GetMapping("/files/{filename:.+}")
@ResponseBody
public ResponseEntity<Resource> serveFile(@PathVariable String filename) {

    Resource file = storageService.loadAsResource(filename);
    return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
            "attachment; filename="" + file.getFilename() + """).body(file);
}

@PostMapping("/")
public String handleFileUpload(@RequestParam("file") MultipartFile file,
        RedirectAttributes redirectAttributes) {

    storageService.store(file);
    redirectAttributes.addFlashAttribute("message",
            "You successfully uploaded " + file.getOriginalFilename() + "!");

    return "redirect:/";
}

@ExceptionHandler(StorageFileNotFoundException.class)
public ResponseEntity<?> handleStorageFileNotFound(StorageFileNotFoundException exc) {
    return ResponseEntity.notFound().build();
}


@PostMapping(value = "/selfie")
@ApiResponses({
        @ApiResponse(code = 200, message = "Success"),
        @ApiResponse(code = 400, message = "Bad request"),
        @ApiResponse(code = 415, message = "Unsupported Media Type"),
        @ApiResponse(code = 500, message = "Server Error")
})
public ResponseEntity<String> updateSelfieImage(
        @RequestParam("files") MultipartFile[] files,
        RedirectAttributes redirectAttributes, HttpSession session)
        throws IOException {
    StringJoiner sj = new StringJoiner(" , ");
    for (MultipartFile file : files) {
        if (file.isEmpty()) {
            continue; // next pls
        }
        try {

            byte[] bytes = file.getBytes();
            Properties prop = new Properties();
            String resourceName = "app.properties";
            ClassLoader loader = Thread.currentThread()
                    .getContextClassLoader();
            InputStream resourceStream = loader
                    .getResourceAsStream(resourceName);
            try {
                prop.load(resourceStream);
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            String image_path = prop.getProperty("selfieSource");
            String dest_path=prop.getProperty("selfieDest");
            Path path = Paths.get(dest_path
                    + file.getOriginalFilename());
            Files.write(path, bytes);

            sj.add(file.getOriginalFilename());

        } catch (IOException e) {
            e.printStackTrace();
        }
    }



    return new ResponseEntity<String>("Success", HttpStatus.OK);

}


@GetMapping(value="/selfieImage")
public @ResponseBody byte[] getImage() throws IOException{
    InputStream in=getClass().getResourceAsStream("/image.jpg");
    return IOUtils.toByteArray(in);

}

}
Application.yml
spring:
application:
autoconfigure:
exclude:
— org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
— org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
server:
port: 9288

logging:
level:
root: DEBUG
com.tenxbanking: DEBUG

management:
endpoints:
web:
base-path: «/»
path-mapping:

metrics:
binders:
jvm.enabled: true
logback.enabled: true
export:
prometheus:
descriptions: true
enabled: true
step: 1m
distribution:
percentiles-histogram[http.server.requests]: true
percentiles:
http.server.requests: 0.95, 0.99
sla:
http.server.requests: 10ms,100ms

selfieSource: C:/Users/sumrawal/Desktop

selfieDest: C:/Users/sumrawal/Pictures

HTTPClient throws Error parsing HTTP request header after each request, but it does not affect the data return. the internet says it is tomcat’s problem, but I can’t do it any way. I don’t know why there are brothers with the same problem and how to solve it.

Please enter the code
 2018-06-14 11:02:24.529 DEBUG 47308 --- [nio-8122-exec-8] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header
 
 java.io.EOFException: null
 at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1202)
 at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1149)
 at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:742)
 at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:404)
 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)
 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Thread.java:724)
 
 2018-06-14 11:02:24.529 DEBUG 47308 --- [nio-8122-exec-8]   o.apache.coyote.http11.Http11Processor   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@1875e8c:org.apache.tomcat.util.net.NioChan  nel@1e924f9:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8122 remote=/127.0.0.1:55761]], Status in: [OPEN_READ], State out: [CLOSED]
 2018-06-14 11:02:24.529 DEBUG 47308 --- [nio-8122-exec-8] o.apache.tomcat.util.threads.LimitLatch  : Counting down[http-nio-8122-exec-8] latch=1
 2018-06-14 11:02:40.207 DEBUG 47308 --- [8122-Acceptor-0] o.apache.tomcat.util.threads.LimitLatch  : Counting up[http-nio-8122-Acceptor-0] latch=1
 2018-06-14 11:02:40.207 DEBUG 47308 --- [nio-8122-exec-9] o.a.coyote.http11.Http11InputBuffer      : Received [POST /shs/wecahtpay/officialpay HTTP/1.1
 Content-Type: application/json
 charset: utf-8
 accept: */*
 user-agent: Mozilla/4.0 (compatible;   MSIE 6.0;   Windows NT 5.1;  SV1)
 Cache-Control: no-cache
 Pragma: no-cache
 Host:  yumao.tunnel.qydev.com
 Connection: keep-alive
 Content-Length: 130

clipboard.png

Did you use NIO? Could it be because one of nio’s tunnel does not have close

Spring boot, h2.
Дао

ProjectRepository extends JpaRepository<Project, Long>...

В контроллере

@PostMapping("/projects")
    public Project createProject(@Valid @RequestBody Project project) {
        return projectRepository.save(project);
    }

Post запрос выдаёт:

2020-07-08 11:23:25.544 DEBUG 11636 --- [nio-8080-exec-2] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header

java.io.EOFException: null
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1231) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1141) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:780) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:356) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_251]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_251]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at java.lang.Thread.run(Unknown Source) [na:1.8.0_251]
2020-07-08 11:23:25.545 DEBUG 11636 --- [nio-8080-exec-2] o.apache.coyote.http11.Http11Processor   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@27f578d4:org.apache.tomcat.util.net.NioChannel@7e6521ae:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:50099]], Status in: [OPEN_READ], State out: [CLOSED]
2020-07-08 11:23:25.546 DEBUG 11636 --- [nio-8080-exec-2] o.apache.tomcat.util.threads.LimitLatch  : Counting down[http-nio-8080-exec-2] latch=2
2020-07-08 11:23:25.546 DEBUG 11636 --- [nio-8080-exec-2] org.apache.tomcat.util.net.NioEndpoint   : Calling [org.apache.tomcat.util.net.NioEndpoint@3cee8c55].closeSocket([org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@27f578d4:org.apache.tomcat.util.net.NioChannel@7e6521ae:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:50099]])
2020-07-08 11:23:25.582 DEBUG 11636 --- [nio-8080-exec-1] org.apache.tomcat.util.http.Parameters   : Set query string encoding to UTF-8
2020-07-08 11:23:25.593 DEBUG 11636 --- [nio-8080-exec-1] o.a.c.authenticator.AuthenticatorBase    : Security checking request POST /projects/
2020-07-08 11:23:25.594 DEBUG 11636 --- [nio-8080-exec-1] org.apache.catalina.realm.RealmBase      :   No applicable constraints defined
2020-07-08 11:23:25.603 DEBUG 11636 --- [nio-8080-exec-1] o.a.c.a.jaspic.AuthConfigFactoryImpl     : Loading persistent provider registrations from [C:Userssur-pAppDataLocalTemptomcat.8000510046453634187.8080confjaspic-providers.xml]
2020-07-08 11:23:25.604 DEBUG 11636 --- [nio-8080-exec-1] o.a.c.authenticator.AuthenticatorBase    : Not subject to any constraint
2020-07-08 11:23:25.612  INFO 11636 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-07-08 11:23:25.612  INFO 11636 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-07-08 11:23:25.612 DEBUG 11636 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Detected StandardServletMultipartResolver
2020-07-08 11:23:25.626 DEBUG 11636 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data
2020-07-08 11:23:25.626  INFO 11636 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 14 ms
2020-07-08 11:23:25.647 DEBUG 11636 --- [nio-8080-exec-1] org.apache.tomcat.util.http.Parameters   : Set encoding to UTF-8
2020-07-08 11:23:25.647 DEBUG 11636 --- [nio-8080-exec-1] org.apache.tomcat.util.http.Parameters   : Start processing with input [title=second]
2020-07-08 11:23:25.648 DEBUG 11636 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : POST "/projects/", parameters={masked}
2020-07-08 11:23:25.663 DEBUG 11636 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to ru.surpavel.bugtrackingsystem.controller.ProjectController#createProject(Project)
2020-07-08 11:23:25.664 DEBUG 11636 --- [nio-8080-exec-1] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2020-07-08 11:23:25.719 DEBUG 11636 --- [nio-8080-exec-1] .w.s.m.m.a.ServletInvocableHandlerMethod : Could not resolve parameter [0] in public ru.surpavel.bugtrackingsystem.entity.Project ru.surpavel.bugtrackingsystem.controller.ProjectController.createProject(ru.surpavel.bugtrackingsystem.entity.Project): Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported


Description


Pradeep Singh



2016-11-01 14:37:00 UTC

I have upgraded from Tomcat 7 to Tomcat 8 and seeing below error every minutes almost.

Error parsing HTTP request header ERROR_DETAILS: java.io.EOFException: null	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1202)	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1149)	at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:742)	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:404)	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)	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)


Comment 1


Mark Thomas



2016-11-01 14:49:12 UTC

Bugzilla is not a support forum. This question belongs on the Apache Tomcat users mailing list.


Comment 2


Pradeep Singh



2016-11-01 15:01:22 UTC

sorry, if I posted at wrong place. what is the best place to post this query ?


Comment 3


Chuck Caldarale



2016-11-01 15:27:27 UTC

(In reply to Pradeep Singh from comment #2)
> sorry, if I posted at wrong place. what is the best place to post this query
> ?

Repeating what Mark said: "This question belongs on the Apache Tomcat users mailing list."

У меня есть базовое приложение SpringBoot 2.0.5.RELEASE. Использование Spring Initializer, JPA, встроенного Tomcat, механизма шаблонов Thymeleaf и пакета как исполняемого JAR с спокойной архитектурой

Я создал этот контроллер Rest для аутентификации:

@RestController
public class AuthenticationRestController {


    private static final Logger LOG = LoggerFactory.getLogger   (AuthenticationRestController.class);



    @Value("${jwt.header}")
    private String tokenHeader;

    @Autowired
    private AuthenticationManager authenticationManager;

    @Autowired
    private JwtTokenUtil jwtTokenUtil;

    @Autowired
    private UserSecurityService userSecurityService;

    @RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.POST)
    public ResponseEntity<?> createAuthenticationToken(@RequestBody JwtAuthenticationRequest authenticationRequest) throws AuthenticationException {

        LOG.info("authenticating [ " + authenticationRequest.getUsername() + " ]");

        authenticate(authenticationRequest.getUsername(), authenticationRequest.getPassword());

        // Reload password post-security so we can generate the token
        final UserDetails userDetails = userSecurityService.loadUserByUsername(authenticationRequest.getUsername());
        final String token = jwtTokenUtil.generateToken(userDetails);

        // Return the token
        return ResponseEntity.ok(new JwtAuthenticationResponse(token));
    }

    @RequestMapping(value = "${jwt.route.authentication.refresh}", method = RequestMethod.GET)
    public ResponseEntity<?> refreshAndGetAuthenticationToken(HttpServletRequest request) {
        String authToken = request.getHeader(tokenHeader);
        final String token = authToken.substring(7);
        String username = jwtTokenUtil.getUsernameFromToken(token);
        JwtUser user = (JwtUser) userSecurityService.loadUserByUsername(username);

        if (jwtTokenUtil.canTokenBeRefreshed(token, user.getLastPasswordResetDate())) {
            String refreshedToken = jwtTokenUtil.refreshToken(token);
            return ResponseEntity.ok(new JwtAuthenticationResponse(refreshedToken));
        } else {
            return ResponseEntity.badRequest().body(null);
        }
    }

    @ExceptionHandler({AuthenticationException.class})
    public ResponseEntity<String> handleAuthenticationException(AuthenticationException e) {
        return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(e.getMessage());
    }

    /**
     * Authenticates the user. If something is wrong, an {@link AuthenticationException} will be thrown
     */
    private void authenticate(String username, String password) {
        Objects.requireNonNull(username);
        Objects.requireNonNull(password);

        try {
            authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
        } catch (DisabledException e) {
            throw new AuthenticationException("User is disabled!", e);
        } catch (BadCredentialsException e) {
            throw new AuthenticationException("Bad credentials!", e);
        }
    }
}

И этот файл конфигурации для управления конфигурацией

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class ApiWebSecurityConfig extends WebSecurityConfigurerAdapter {

    //private static final Logger LOG = LoggerFactory.getLogger(ApiWebSecurityConfig.class);

    @Autowired
    private JwtAuthenticationEntryPoint unauthorizedHandler;

    @Autowired
    private JwtTokenUtil jwtTokenUtil;


    @Autowired
    private UserSecurityService userSecurityService;

    @Value("${jwt.header}")
    private String tokenHeader;

    @Value("${jwt.route.authentication.path}")
    private String authenticationPath;



    @Value("${server.servlet.context-path}")
    private String serverContextPath;

    /** The encryption SALT. */
    private static final String SALT = "f13333";


    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth
                .userDetailsService(userSecurityService)
                .passwordEncoder(passwordEncoder());
    }


    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder(12, new SecureRandom(SALT.getBytes()));
    }


    @Bean
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }


    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {

         httpSecurity
         // we don't need CSRF because our token is invulnerable
         .csrf().disable()

         .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()

         // don't create session
         .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
         .authorizeRequests()

         // Un-secure H2 Database
         .antMatchers("/h2-console/**/**").permitAll()
         .antMatchers("/auth/**").permitAll()
         .anyRequest().authenticated();


     // Custom JWT based security filter
         JwtAuthorizationTokenFilter authenticationTokenFilter = new JwtAuthorizationTokenFilter(userDetailsService(), jwtTokenUtil, tokenHeader);
         httpSecurity
             .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);


     // disable page caching
     httpSecurity
         .headers()
         .frameOptions().sameOrigin()  // required to set for H2 else H2 Console will be blank.
         .cacheControl();
    }


    @Override
    public void configure(WebSecurity web) throws Exception {
        // AuthenticationTokenFilter will ignore the below paths
        web
            .ignoring()

            .antMatchers(
                HttpMethod.POST,
                authenticationPath
            )
    }
}

Но когда я помещаю этот завиток в консоль своего компьютера, у меня появляется эта ошибка в консоли сервера, размещенной на сервере Ubuntu:

url -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"username":"nunet@gmail.com","password":"qwerty"}' "http://139.262.221.117:1234/calssada/api/v1/auth"

Журнал сервера:

2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.coyote.http11.Http11InputBuffer - Received [POST /calssada/api/v1/auth HTTP/1.1
Host: 139.262.221.117:1234
User-Agent: curl/7.54.0
Accept: */*
Content-Type: application/json
Cache-Control: no-cache
Content-Length: 56

{"username":"nunet@gmail.com","password":"qwerty"}]
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.c.a.AuthenticatorBase - Security checking request POST /calssada/api/v1/auth
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG org.apache.catalina.realm.RealmBase -   No applicable constraints defined
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.c.a.AuthenticatorBase -  Not subject to any constraint
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.tomcat.util.http.Parameters - Set encoding to UTF-8
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.c.c.C.[Tomcat].[localhost] - Processing ErrorPage[errorCode=0, location=/error]
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.c.c.C.[.[.[.[dispatcherServlet] -  Disabling the response for further output
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.t.util.net.SocketWrapperBase - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2fca076b:org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]], Read from buffer: [0]
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.tomcat.util.net.NioEndpoint - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2fca076b:org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]], Read direct from socket: [0]
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.coyote.http11.Http11Processor - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2fca076b:org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]], Status in: [OPEN_READ], State out: [OPEN]
2018-10-15 19:14  [http-nio-1234-exec-1] DEBUG o.a.coyote.http11.Http11NioProtocol - Pushed Processor [org.apache.coyote.http11.Http11Processor@28de9baa]
2018-10-15 19:14  [http-nio-1234-exec-2] DEBUG o.a.coyote.http11.Http11NioProtocol - Processing socket [org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]] with status [OPEN_READ]
2018-10-15 19:14  [http-nio-1234-exec-2] DEBUG o.a.coyote.http11.Http11NioProtocol - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]]
2018-10-15 19:14  [http-nio-1234-exec-2] DEBUG o.a.coyote.http11.Http11NioProtocol - Popped processor [org.apache.coyote.http11.Http11Processor@28de9baa] from cache
2018-10-15 19:14  [http-nio-1234-exec-2] DEBUG o.a.t.util.net.SocketWrapperBase - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2fca076b:org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]], Read from buffer: [0]
2018-10-15 19:14  [http-nio-1234-exec-2] DEBUG o.a.coyote.http11.Http11Processor - Error parsing HTTP request header
java.io.EOFException: null
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1289)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1223)
    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:729)
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:368)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
2018-10-15 19:14  [http-nio-1234-exec-2] DEBUG o.a.coyote.http11.Http11Processor - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2fca076b:org.apache.tomcat.util.net.NioChannel@5c80e3a0:java.nio.channels.SocketChannel[connected local=/139.262.221.117:1234 remote=/119.88.31.26:58071]], Status in: [OPEN_READ], State out: [CLOSED]

1 ответ

Лучший ответ

Может быть, вам нужно добавить -H "Connection: close" к вашей команде curl?

Обратите внимание, что в вашем журнале ошибок есть два запроса. Первый обрабатывается потоком http-nio-1234-exec-1. Интересно, означает ли «Обработка ErrorPage [errorCode = 0, location = / error]», что это привело к сбою.

Протокол HTTP / 1.1 позволяет отправлять несколько запросов по одному и тому же соединению (также известному как Keep-Alive). Поскольку заголовок «Соединение: закрыть» отсутствует, Tomcat продолжает чтение из соединения. Это выполняется потоком http-nio-1234-exec-2 и завершается ошибкой с EOF при попытке прочитать первую строку запроса (Http11InputBuffer.parseRequestLine()). Здесь ожидается EOF.


1

Konstantin Kolinko
23 Окт 2018 в 06:18

Понравилась статья? Поделить с друзьями:
  • Error parsing error unexpected token vue
  • Error parsing error missing semicolon
  • Error parsing error cannot find module babel eslint
  • Error parsing condition with key 0 modx
  • Error parsing attribute name 1c розница