1

我在运行声纳服务器(在远程开发机器上)abd 时遇到了一些问题,然后尝试在我的机器上的一个简单项目上运行声纳运行器。

我不明白错误消息,当然我可以看到它无法连接到数据库,但我不完全理解为什么它试图创建一个文件或者为什么它会是一个空文件路径或者什么不是

请有人帮我理解这个错误信息吗?

 > Sonar Runner 2.2 Java 1.7.0_15 Oracle Corporation (32-bit) Windows 7
    > 6.1 x86 INFO: Runner configuration file: C:\Users\...\workspace\java-sonar-runner-si
    > mple\sonar-runner-2.2\bin\..\conf\sonar-runner.properties INFO:
    > Project configuration file:
    > C:\Users\...\workspace\java-sonar-runner-s
    > imple\sonar-runner-2.2\bin\sonar-project.properties INFO: Default
    > locale: "en_GB", source code encoding: "UTF-8" INFO: Work directory:
    > C:\Users\...\workspace\java-sonar-runner-simple\sonar-
    > runner-2.2\bin\.sonar INFO: Sonar Server 3.2 10:59:08.438 WARN  - H2
    > database should be used for evaluation purpose only 10:59:08.441 INFO 
    > - Create JDBC datasource to url jdbc:h2://169.168.66.20:9092/ sonar INFO:
    > ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO:
    > ------------------------------------------------------------------------ Total time: 12.333s Final Memory: 2M/15M INFO:
    > ------------------------------------------------------------------------ ERROR: Error during Sonar runner execution ERROR: Unable to execute
    > Sonar ERROR: Caused by: Fail to connect to database ERROR: Caused by:
    > Cannot create PoolableConnectionFactory (Error while creating file
    > "//" [90062-167]) ERROR: Caused by: Error while creating file "//"
    > [90062-167] ERROR: ERROR: To see the full stack trace of the errors,
    > re-run Sonar Runner with the - e switch. ERROR: Re-run Sonar Runner
    > using the -X switch to enable full debug logging.

声纳属性文件

#--------------------------------------------------------
# This file must contain only ISO 8859-1 characters
# see http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
#
# 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
#---------------------------------------------------------


#---------------------------------------------------------
# WEB SETTINGS - STANDALONE MODE ONLY
# 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 0.0.0.0:9000/.
#sonar.web.host:                           0.0.0.0
#sonar.web.port:                           9000
#sonar.web.context:                        /

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

#-----------------------------------------------------------------------
# DATABASE
#
# IMPORTANT : the embedded database H2 is used by default. 
# It is recommended for tests only. Please use an external 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 H2
# Note : it does not accept connections from remote hosts, so the
# sonar server and the maven plugin must be executed on the same host.

# Comment the following line to deactivate the default embedded database.
sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar
sonar.jdbc.driverClassName:                org.h2.Driver

# directory containing H2 database files. By default it's the /data directory in the sonar installation.
#sonar.embeddedDatabase.dataDir:
# H2 embedded database server listening port, defaults to 9092
sonar.embeddedDatabase.port:               9092


#----- MySQL 5.x/6.x
# Comment the embedded database and uncomment the following line to use MySQL
#sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true

# Optional properties
#sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver


#----- Oracle 10g/11g
# To connect to Oracle database :
#
# - It's recommended to use the latest version of the JDBC driver (either ojdbc6.jar for Java 6 or ojdbc5.jar for Java 5).
#   Download it in http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html
# - Copy the driver to the directory extensions/jdbc-driver/oracle/
# - Comment the embedded database and uncomment the following line :
#sonar.jdbc.url:                            jdbc:oracle:thin:@localhost/XE

# Optional properties
#sonar.jdbc.driverClassName:                oracle.jdbc.OracleDriver

# Uncomment the following property if the Oracle account has permissions to access multiple schemas,
# for example sonar schemas with different versions. In that case, use the same property during project analysis
# (-Dsonar.jdbc.schema=<schema>)
#sonar.jdbc.schema:                         sonar


#----- PostgreSQL 8.x/9.x
# Comment the embedded database and uncomment the following property to use PostgreSQL
#sonar.jdbc.url:                            jdbc:postgresql://localhost/sonar

# Optional properties
#sonar.jdbc.driverClassName:                org.postgresql.Driver

# Uncomment the following property if the PostgreSQL account has permissions to access multiple schemas,
# for example sonar schemas with different versions. In that case, use the same property during project analysis
# (-Dsonar.jdbc.schema=<schema>)
#sonar.jdbc.schema:                         public


#----- Microsoft SQLServer
# The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on http://jtds.sourceforge.net
#sonar.jdbc.url:                            jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor

# Optional properties
#sonar.jdbc.driverClassName:                net.sourceforge.jtds.jdbc.Driver


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

# The Update Center requires an internet connection to request http://update.sonarsource.org
# It is activated by default:
#sonar.updatecenter.activate=true

# HTTP proxy (default none)
#http.proxyHost=
#http.proxyPort=

# NT domain name if NTLM proxy is used
#http.auth.ntlm.domain=

# SOCKS proxy (default none)
#socksProxyHost=
#socksProxyPort=

# proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies.
#http.proxyUser=
#http.proxyPassword=

#---------------------------------------------------------
# NOTIFICATIONS
#---------------------------------------------------------

# Delay (in seconds) between processing of notification queue
sonar.notifications.delay=60

完整的错误日志

> 
> INFO:
> ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO:
> ------------------------------------------------------------------------ Total time: 6.372s Final Memory: 2M/15M INFO:
> ------------------------------------------------------------------------ ERROR: Error during Sonar runner execution
> org.sonar.runner.impl.RunnerException: Unable to execute Sonar
>         at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
> .java:79)
>         at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:63)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:57)
>         at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
>         at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:71)
> 
>         at org.sonar.runner.api.Runner.execute(Runner.java:89)
>         at org.sonar.runner.Main.executeTask(Main.java:70)
>         at org.sonar.runner.Main.execute(Main.java:59)
>         at org.sonar.runner.Main.main(Main.java:41) Caused by: java.lang.IllegalStateException: Fail to connect to database
>         at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java
> :72)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(
> ReflectionLifecycleStrategy.java:110)
>         at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(Reflect
> ionLifecycleStrategy.java:89)
>         at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter
> .start(AbstractInjectionFactory.java:84)
>         at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.j
> ava:169)
>         at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Store
> d.java:132)
>         at org.picocontainer.behaviors.Stored.start(Stored.java:110)
>         at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(Defaul
> tPicoContainer.java:1009)
>         at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoConta
> iner.java:1002)
>         at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.jav
> a:760)
>         at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
> ntainer.java:70)
>         at org.sonar.batch.bootstrap.Module.start(Module.java:82)
>         at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:73)
>         at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
>         at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java
> :45)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
> .java:75)
>         ... 9 more Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableCon
> nectionFactory (Error while creating file "//" [90062-167])
>         at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFacto
> ry(BasicDataSource.java:1549)
>         at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
> rce.java:1388)
>         at org.apache.commons.dbcp.BasicDataSource.getLogWriter(BasicDataSource.
> java:1098)
>         at org.apache.commons.dbcp.BasicDataSourceFactory.createDataSource(Basic
> DataSourceFactory.java:350)
>         at org.sonar.core.persistence.DefaultDatabase.initDatasource(DefaultData
> base.java:122)
>         at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java
> :67)
>         ... 32 more Caused by: org.h2.jdbc.JdbcSQLException: Error while creating file "//" [90062-1 67]
>         at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>         at org.h2.message.DbException.get(DbException.java:169)
>         at org.h2.message.DbException.get(DbException.java:146)
>         at org.h2.store.fs.FilePathDisk.createDirectory(FilePathDisk.java:247)
>         at org.h2.store.fs.FileUtils.createDirectory(FileUtils.java:46)
>         at org.h2.store.fs.FileUtils.createDirectories(FileUtils.java:300)
>         at org.h2.store.fs.FileUtils.createDirectories(FileUtils.java:299)
>         at org.h2.store.FileLock.lockFile(FileLock.java:326)
>         at org.h2.store.FileLock.lock(FileLock.java:128)
>         at org.h2.engine.Database.open(Database.java:542)
>         at org.h2.engine.Database.openDatabase(Database.java:222)
>         at org.h2.engine.Database.<init>(Database.java:217)
>         at org.h2.engine.Engine.openSession(Engine.java:56)
>         at org.h2.engine.Engine.openSession(Engine.java:159)
>         at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
>         at org.h2.engine.Engine.createSession(Engine.java:121)
>         at org.h2.engine.Engine.createSession(Engine.java:28)
>         at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.jav
> a:305)
>         at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
>         at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
>         at org.h2.Driver.connect(Driver.java:72)
>         at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(Driv
> erConnectionFactory.java:38)
>         at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolable
> ConnectionFactory.java:582)
>         at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(Bas
> icDataSource.java:1556)
>         at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFacto
> ry(BasicDataSource.java:1545)
>         ... 37 more
4

1 回答 1

1

您是否有权访问 sonar.config 文件,因为我有兴趣查看您的 h2 数据库设置。H2 将创建文件作为其初始化的一部分,因此配置路径可能存在文件写入权限问题。

我建议编辑

 sonar.embeddedDatabase.dataDir

值并将其指向您知道可写的文件夹位置。你的声纳包安装在哪里?

于 2013-05-09T10:08:50.493 回答