1. ホーム
  2. tomcat

メソッド名に無効な文字が見つかりました。HTTPメソッド名はトークンでなければなりません

2022-02-16 17:48:24
<パス
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.
August 15, 2017 10:21:08 AM org.apache.coyote.AbstractProtocol start
Info: Starting ProtocolHandler ["http-nio-8080"]
August 15, 2017 10:21:08 AM org.apache.coyote.AbstractProtocol start
Message: Starting ProtocolHandler ["ajp-nio-8009"]
August 15, 2017 10:21:08 AM org.apache.catalina.startup.Catalina start
Message: Server startup in 24549 ms
August 15, 2017 10:21:44 AM org.apache.coyote.http11.AbstractHttp11Processor process
Message: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
	at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:232)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1013)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	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:745)


server.xmlにmaxHttpHeaderSizeフィールドを追加するだけです。

<Connector URIEncoding="UTF-8" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
    useBodyEncodingForURI="false"
    enableLookups="false"
               connectionTimeout="20000"
               redirectPort="8443" maxHttpHeaderSize="the size you want"/>

 <Connector port="8080" executor="tomcatThreadPool"
     protocol="HTTP/1.1"
     maxThreads="1000"
     maxHttpHeaderSize="8192"
     minSpareThreads="100"
     maxSpareThreads="200"
     acceptCount="1000"
     maxConnections="1000"
     connectionTimeout="30000"
     keepAliveTimeout="15000"
     maxKeepAliveRequests="1"
      tcpNoDelay="true"
     redirectPort="8443"
     enableLookups="false"
     URIEncoding="UTF-8"/>


 <Connector port="8080" executor="tomcatThreadPool"
     protocol="HTTP/1.1"
     maxThreads="1000"
     maxHttpHeaderSize="8192"
     minSpareThreads="100"
     maxSpareThreads="200"
     acceptCount="1000"
     maxConnections="1000"
     connectionTimeout="30000"
     keepAliveTimeout="15000"
     maxKeepAliveRequests="1"
      tcpNoDelay="true"
     redirectPort="8443"
     enableLookups="false"
     URIEncoding="UTF-8"/>