java.lang.IllegalStateException reported by sonarscanner in jenkins

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

SonarQube version: 7.6
Sonarscanner is reporting error java.lang.IllegalStateException while posting the code quality details to sonarqube server
source server: RHEL 7.3
Java Version: 1.8.261

Hi All

We are facing issue with Sonarscanner running on a jenkins agent. The sonar scanner reports java.lang.IllegalStateException while connecting to sonarqube and posting the results.

The sonarqube server has apache2 which redirects connection to sonarqube at port 9000.The sonarqube server does not report any error for connection. I am wondering if anyone can help understanding the issue with sonarqube.

The following error was reported on SonarQube Web logs -

2020.09.20 05:50:45 INFO web[o.a.c.h.Http11Processor] 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.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:426)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

Hi,

Welcome to the community!

First, 7.6 is past EOL. You should upgrade at your earliest convenience:

7.6 -> 7.9.4 (current LTS) -> 8.4.2 (latest version. this step is optional)

Second, that error is going to be caused by something on your network between the scanner and the SonarQube server. You should talk to your network folks.

 
HTH,
Ann

Thanks Ann !

I found that the issue was related with certificate after upgrading Java on the CI server. We’ve added the certificate store in cacerts in order to resolve the issue.