user2395365
user2395365

Reputation: 2149

What is error " Invalid character found in method name. HTTP method names must be tokens"

I'm getting the following error using Spring Boot. I enabled TRACE level logging but still unsure what is causing it or how to fix it.

[TRACE] 2020-01-02 12:12:23.749 [http-nio-9000-exec-1] DispatcherServlet - "ERROR" dispatch for GET "/error", paramet
ers={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
[TRACE] 2020-01-02 12:12:23.750 [http-nio-9000-exec-1] RequestMappingHandlerMapping - 2 matching mappings: [{ /error}
, { /error, produces [text/html]}]
[TRACE] 2020-01-02 12:12:23.751 [http-nio-9000-exec-1] RequestMappingHandlerMapping - Mapped to public org.springfram
ework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.w
/Exc
...skipping
[INFO ] 2020-01-02 16:29:57.815 [http-nio-9000-exec-31] Http11Processor - Error parsing HTTP request header
 Note: further occurrences of HTTP request 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.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:415) ~[tomcat-embed-cor
e-9.0.26.jar!/:9.0.26]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:292) [tomcat-embed-core-9.0.26.jar!/
:9.0.26]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.26
.jar!/:9.0.26]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) [tomcat-embed-core
-9.0.26.jar!/:9.0.26]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) [tomcat-embed-core-9.0
.26.jar!/:9.0.26]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.26.
jar!/:9.0.26]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.
26.jar!/:9.0.26]

Upvotes: 7

Views: 43037

Answers (2)

Deepak Mantry
Deepak Mantry

Reputation: 1

Make sure your server.xml has SSLEnabled="true" configured for the Connector element.

Upvotes: 0

Beppe C
Beppe C

Reputation: 13923

Executing HTTPS request from client on endpoint which isn't HTTPS enabled, see

java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

Upvotes: 7

Related Questions