sonarQube with Cloud9

apache

#1

Hi everyone !
I try to use https://www.sonarqube.org/ on a php workspace.
I looked at the required environment and integrate :

  • new jdk
    java version "1.8.0_131"
    Java™ SE Runtime Environment (build 1.8.0_131-b11)
    Java HotSpot™ 64-Bit Server VM (build 25.131-b11, mixed mode)
  • new MySQL
    5.6.33-0ubuntu0.14.04.1
    and create a database (configured utf8 and utf8_bin) and a specific user in MySQL (I grant it all privileges on this database).

I installed sonarqube-6.4.zip and sonar-scanner-cli-3.0.3.778-linux.zip on /etc/

But it is the first time i have to configure an apache server and i probably do something wrong on it :

  1. I made a file into the workspace named sonar-project.properties
sonar.projectKey=my:webSite
sonar.projectName=Web Site
sonar.projectVersion=1.0
sonar.sources=.
#my phpunit tests are here
tests=./tests 
sonar.language=php
  1. I create a file named /etc/apache2/sites-available/002-sonar.conf
<VirtualHost *:8081>
    DocumentRoot /etc/sonarqube/web
    ServerName https://${C9_HOSTNAME}:8081
    LogLevel info
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /etc/sonarqube/web>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

and a symbolic link to it, named /etc/apache2/sites-enabled/002-sonar.conf@

  1. on /etc/sonarqube/conf/, i didn’t change wrapper.conf but sonar.properties have now:
sonar.jdbc.username=sonarUSR (the user created earlier on MySQL)
sonar.jdbc.password=sonarUSR (it password)
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.web.host=${C9_IP}
sonar.web.port=8081
  1. on /etc/hosts, I add :

${C9_HOSTNAME} sonar

  1. on /etc/sonar-scanner/conf/sonar-scanner.properties

sonar.host.url=http://${C9_IP}:8081


After all that, I tried :
sudo /etc/init.d/mysql restart** -> it said it's [ OK ] ** sudo service apache2 restart -> [ OK ] too and i looked at the logs at /var/log/apache2/, it’s empty
$ sudo /etc/sonarqube/bin/linux-x86-64/sonar.sh start return

Starting SonarQube…
Started SonarQube.

but it stop quickly by itself.
I looked at the logs (/etc/sonarqube/logs) (access.log es.log sonar.log web.log) but there is lot of messages ^^’ i found the error on web.log

[details=Summary]2017.06.29 14:46:11 INFO web[][o.s.p.ProcessEntryPoint] Starting web
2017.06.29 14:46:12 ERROR web[][o.a.c.h.Http11NioProtocol] Failed to initialize end point associated with ProtocolHandler [“http-nio-8081”]
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:972)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:237)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:558)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:65)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:968)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:875)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:343)
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:61)
at org.sonar.server.app.WebServer.start(WebServer.java:51)
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:111)
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:98)
at org.sonar.server.app.WebServer.main(WebServer.java:91)
2017.06.29 14:46:12 WARN web[][o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
at com.google.common.base.Throwables.propagate(Throwables.java:160)
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:64)
at org.sonar.server.app.WebServer.start(WebServer.java:51)
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:111)
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:98)
at org.sonar.server.app.WebServer.main(WebServer.java:91)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:343)
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:61)
… 4 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:875)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
… 7 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-8081]]
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:556)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
… 9 common frames omitted[/details]

So I tried to see which process used these port :
$ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN 36531/apache2
tcp6 0 0 :::8081 ::: LISTEN 36531/apache2*
tcp6 0 0 :::22 :::* LISTEN 7/micro-inetd

it seems to be my apache configuration use these port ==’…

This is a long message, and i’m sorry about my english (not my native language ^^’), but i need help.
I didn’t find what i am doing wrong, and i have no more ideas (in fact, i thinked a time it was elasticSearch which use the same port but all a tried to resolve it was wrong…)

Please, can you help me?

Sincerely,


#2

hi,

no one have an idea ?
am I doing something wrong in my message?


#3

Hi
sorry for the lack of response.
You are not doing anything wrong, but probably not many people who frequently visit this forum are familiar with sonarqube, and the question is not about cloud9.

One possible issue is that you are running out of RAM, and the process is being killed.
If that’s not the cause, try asking on forums related to sonarqube,
otherwise you can try upgrading to a larger workspace, but note, that if you are planning to use cloud9 workspace as a ci server instead of development, it won’t work well.


#4

Hi,
thank you !
All right, I gonna try to enlarge the RAM access to sonarqube, and if it don’t solve, I will ask directly on sonarqube forum.
My project is just to learn how to develop well ^^ I will not use it as real server.
I understand that cloud9 have to limit our material access to allow it at all user.

Again, thank you for answering and thinking on my problem,

Sincerely,