啟動springboot項目后绒尊,輸入https://127.0.0.1:9910/nameList
報錯初斑,錯誤信息:
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:428) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.31.jar:8.5.31]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.31.jar:8.5.31]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
查閱資料后睬棚,發(fā)現(xiàn)把https://127.0.0.1:9910/nameList的https改為http抠忘,即可解決問題蔫耽。
問題原因是 本來是http的請求结耀,錯誤使用https方式請求,所以報該錯誤匙铡。
詳細的關于http和https的區(qū)別图甜,請看以下文章
https://blog.csdn.net/LVXIANGAN/article/details/73187726
個人理解是,未經(jīng)由證書認證的該網(wǎng)站鳖眼,申請了證書認證的https頭黑毅,這樣會導致無法解析,所以換成http就可以無限制了钦讳。