This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Starting Sonar at 9000 port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Starting Sonar at 9000 port" Watch "Starting Sonar at 9000 port" New topic

Starting Sonar at 9000 port

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103


I have downloaded sonar 2.10 unzipped it.I am using MySQL.So in the SONAR_HOME\conf directory I have made configuration changes like dburl,jdbc driver etc.I have created a user named sonar and grant him all accesses to sonardb.After this I started StartSonar.bat in my case it is winx86-32 no log is being displayed.In my browser I typed http://localhost:9000/ but it is saying unable to connect.After a while when I again typed the same url it is redirecting me to http://localhost:9000/maintainance where it is displayed that "Sonar is undermaintainance Upgrade sonar.........".What may be the possible reason ?

Suhas Saheer

Joined: Mar 23, 2009
Posts: 17

Hi Arka,

Did you check the logs folder in the installation directory of Sonar?
If any error is encountered while starting the Sonar Server, then it will be displayed here.

Normally when you run startSonar.bat from command propmt, the console doesn't show anything.
It just remains blank. One have to check the sonar.log under the logs folder


Do you have the following entry in you <sonar installation directory>/conf/ ?

sonar.jdbc.username: root
sonar.jdbc.password: <your mysql password>

sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName: com.mysql.jdbc.Driver
sonar.jdbc.validationQuery: select count(*) from testTable;

and remember to comment any other JDBC properties apart from this using #

Hope this helps.

Thanks and Regards,
Suhas Saheer
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
I have seen the logs.It is creating some tables.No error messages are there.In MySQL sonardb there are some tables have ben created.Most of them conatins no records.Except "user" contain one and schema_migration contains 41.
Suhas Saheer

Joined: Mar 23, 2009
Posts: 17

Can you post your file?
Suhas Saheer

Joined: Mar 23, 2009
Posts: 17

and if possible, the log file as well.
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
Here are the properties and log files

# To use an environment variable, use the following syntax : ${env:NAME_OF_ENV_VARIABLE}
# For example :
# sonar.jdbc.url: ${env:SONAR_JDBC_URL}
# See also the file conf/wrapper.conf for JVM advanced settings

# These settings are ignored when the war file is deployed to a JEE server.
# Listen host/port and context path (for example / or /sonar). Default values are
sonar.web.port: 9000
sonar.web.context: /

# Log HTTP requests. Deactivated by default.
#sonar.web.jettyRequestLogs: ../../logs/jetty-yyyy_mm_dd.request.log

# Apache mod_jk connector. Supported only in standalone mode.
# Uncomment to activate AJP13 connector.
#sonar.ajp13.port: 8009

# IMPORTANT : the embedded database Derby is used by default.
# It is recommended for tests only. Please use an other database
# for production environment (MySQL, Oracle, Postgresql,
# SQLServer)

#----- Credentials
# Permissions to create tables and indexes must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username: sonar
sonar.jdbc.password: sonar

#----- Embedded database Derby
# Note : it does accept connections from remote hosts, so the
# sonar server and the maven plugin must be executed on the same host.

# Comment the following lines to deactivate the default embedded database.
#sonar.jdbc.url: jdbc:derby://localhost:1527/sonar;create=true
#sonar.jdbc.driverClassName: org.apache.derby.jdbc.ClientDriver
#sonar.jdbc.validationQuery: values(1)

# directory containing Derby database files. By default it's the /data directory in the sonar installation.
# derby embedded database server listening port, defaults to 1527
#sonar.derby.drda.portNumber: 1527

# uncomment to accept connections from remote hosts. Ba default it only accepts localhost connections.

#----- MySQL 5.x/6.x
# Comment the embedded database and uncomment the following properties to use MySQL. The validation query is optional.
sonar.jdbc.url: jdbc:mysql://localhost:3306/sonardb?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName: com.mysql.jdbc.Driver
sonar.jdbc.validationQuery: select 1

#----- Oracle 10g/11g
# To use Oracle database :
# - Copy the JDBC driver to extensions/jdbc-driver/oracle.
# - Comment the embedded database and uncomment the following properties. The validation query is optional.
#sonar.jdbc.url: jdbcracle:thin:@localhost/XE
#sonar.jdbc.driverClassName: oracle.jdbc.driver.OracleDriver
#sonar.jdbc.validationQuery: select 1 from dual

# Activate if more than one Sonar Oracle schemas on the data server (for example different versions installed).
# In that case, use the same property during maven analysis (-Dsonar.hibernate.default_schema=xxx)
#sonar.hibernate.default_schema: sonar

#----- PostgreSQL 8.x, 9.x
# Uncomment the following properties to use PostgreSQL. The validation query is optional.
#sonar.jdbc.url: jdbc:postgresql://localhost/sonar
#sonar.jdbc.driverClassName: org.postgresql.Driver
#sonar.jdbc.validationQuery: select 1

#----- Microsoft SQLServer
# The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on
# The validation query is optional.
#sonar.jdbc.url: jdbc:jtds:sqlserver://localhost;databaseName=SONAR;SelectMethod=Cursor
#sonar.jdbc.driverClassName: net.sourceforge.jtds.jdbc.Driver
#sonar.jdbc.validationQuery: select 1

#----- Connection pool settings
sonar.jdbc.maxActive: 10
sonar.jdbc.maxIdle: 5
sonar.jdbc.minIdle: 2
sonar.jdbc.maxWait: 5000
sonar.jdbc.minEvictableIdleTimeMillis: 600000
sonar.jdbc.timeBetweenEvictionRunsMillis: 30000

#----- JDBC Datasource bounded to JNDI
# When sonar webapp is deployed into a JEE server, the JDBC datasource can be configured into the JEE server and registered into JNDI.
# In such a case Sonar uses this datasource to connect to database.
# If you activate this feature, then the properties starting with "sonar.jdbc." can be commented, except "sonar.jdbc.dialect".
# The JDBC driver must still be deployed into the directory /extensions/jdbc-driver.
#sonar.jdbc.jndiName: jdbc/sonar

# Values are : mysql, mssql, derby, oracle, postgresql


# The Update Center requires an internet connection to request
# It is activated by default:

# HTTP proxy (default none)

# NT domain name if NTLM proxy is used

# SOCKS proxy (default none)

# proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies.


# Delay (in seconds) between processing of notification queue


STATUS | wrapper | 2011/09/15 14:16:01 | --> Wrapper Started as Console
STATUS | wrapper | 2011/09/15 14:16:02 | Launching a JVM...
INFO | jvm 1 | 2011/09/15 14:16:02 | Wrapper (Version 3.2.3)
INFO | jvm 1 | 2011/09/15 14:16:02 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO | jvm 1 | 2011/09/15 14:16:02 |
2011.09.15 14:16:04 INFO org.sonar.INFO Creating JDBC datasource
2011.09.15 14:16:04 INFO org.sonar.INFO Database dialect class org.sonar.jpa.dialect.MySql
INFO | jvm 1 | 2011/09/15 14:16:13 | JRuby limited openssl loaded.
INFO | jvm 1 | 2011/09/15 14:16:13 | gem install jruby-openssl for full support.
2011.09.15 14:16:22 INFO org.sonar.INFO Sonar started:

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103

Same steps I'm following in another machine with sonar-2.10 and MySQL 5.5 it is opening up the home page for sonar but in my case it is opening the maintainance page.
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103

It is solved.The database was not created properly.I took the SQL dump from the machine where it was working and created the database from that SQL dump.And started sonar and it worked.

Thanks for your reply.
I agree. Here's the link:
subject: Starting Sonar at 9000 port
It's not a secret anymore!