启动声纳时出现致命错误:
2013.02.07 09:33:08 INFO o.s.c.p.Database Create JDBC datasource for jdbc:postgresql://10.123.78.58:5432/sonar
2013.02.07 09:33:08 ERROR o.s.c.p.Database Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ERROR: parameter "standard_conforming_strings" cannot be changed)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.3.jar:1.3]
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:140) [sonar-core-3.4.1.jar:na]
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:69) [sonar-core-3.4.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) [picocontainer-2.14.1.jar:na]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) [picocontainer-2.14.1.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) [picocontainer-2.14.1.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) [picocontainer-2.14.1.jar:na]
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) [picocontainer-2.14.1.jar:na]
at org.picocontainer.behaviors.Stored.start(Stored.java:110) [picocontainer-2.14.1.jar:na]
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1009) [picocontainer-2.14.1.jar:na]
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002) [picocontainer-2.14.1.jar:na]
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:760) [picocontainer-2.14.1.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:72) [sonar-plugin-api-3.4.1.jar:na]
at org.sonar.server.platform.Platform.startDatabaseConnectors(Platform.java:186) [classes/:na]
at org.sonar.server.platform.Platform.init(Platform.java:129) [classes/:na]
at org.sonar.server.platform.PlatformLifecycleListener.contextInitialized(PlatformLifecycleListener.java:33) [classes/:na]
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jetty-util-6.1.25.jar:6.1.25]
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.jetty.Server.doStart(Server.java:224) [jetty-6.1.25.jar:6.1.25]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jetty-util-6.1.25.jar:6.1.25]
at org.sonar.application.JettyEmbedder.start(JettyEmbedder.java:74) [sonar-application-3.4.1.jar:na]
at org.sonar.application.StartServer.main(StartServer.java:49) [sonar-application-3.4.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240) [wrapper-3.2.3.jar:3.2.3]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_37]
Caused by: org.postgresql.util.PSQLException: ERROR: parameter "standard_conforming_strings" cannot be changed
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101) ~[postgresql-9.1-902.jdbc4.jar:na]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1834) ~[postgresql-9.1-902.jdbc4.jar:na]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-9.1-902.jdbc4.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510) ~[postgresql-9.1-902.jdbc4.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:372) ~[postgresql-9.1-902.jdbc4.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:364) ~[postgresql-9.1-902.jdbc4.jar:na]
at org.apache.commons.dbcp.PoolableConnectionFactory.initializeConnection(PoolableConnectionFactory.java:612) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:586) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.3.jar:1.3]
... 38 common frames omitted
环境:
声纳:3.4.1
postgreSQL:8.1.3
centOS:6.3 x86_64
sonar.properties的片段:
sonar.jdbc.username: sonar
sonar.jdbc.password: sonar
sonar.jdbc.url: jdbc:postgresql://localhost:5432/sonar
sonar.jdbc.driverClassName: org.postgresql.Driver
有什么建议吗?
答案 0 :(得分:4)
我建议用声纳项目提出这个问题。
堆栈跟踪的相关部分是:
Caused by: org.postgresql.util.PSQLException: ERROR: parameter "standard_conforming_strings" cannot be changed
postgres documentation表示版本9.1中“standard_conforming_strings”的处理已更改。因此,我怀疑问题可能是您的旧数据库版本。
SONAR-3876引入的更改可能是导致问题的根本原因:
解决方案是在JDBC连接中强制standard_conforming_strings为“on”并停止在rails中进行双反斜杠。它允许支持版本9.0和9.1。