Quantcast

Sonar, Maven, and MySQL

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sonar, Maven, and MySQL

Christian Soltenborn
Hi,

after successfully evaluating Sonar (and, hey, it's great! :-) ), I'm
now in the process of switching from the internal Derby db to MySQL.
However, this is more difficult than I thought...

It first took me a while to figure out that I have to configure Sonar
on the Maven side (imho, this is not documented well on
http://docs.codehaus.org/display/SONAR/Analyzing+with+Maven). So I
ended up with the following in my pom:

<profile>
        <id>sonar</id>
        <properties>
       
<sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8</sonar.jdbc.url>

                <sonar.jdbc.username>sonar</sonar.jdbc.username>
                <sonar.jdbc.password>sonar</sonar.jdbc.password>
                <sonar.host.url>http://localhost:9000</sonar.host.url>
        </properties>
</profile>

In my sonar.properties file, I commented out the Derby stuff and
commented in the line

sonar.jdbc.url:
jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

I also configured the db credentials:

sonar.jdbc.username: sonar
sonar.jdbc.password: sonar

Finally, maven is called like this:

mvn -f "C:\Program Files (x86)\Jenkins\workspace\DMM-Tooling/pom.xml"
-Dproject.build.sourceEncoding=UTF-8 clean verify sonar:sonar
--activate-profiles coverage,sonar --fail-at-end -e

Well, it appears that Sonar can't connect to the db - I attached the
exception at the end of the mail. Any idea what I'm doing wrong here?

Thanks in advance,
Christian


The exception:

[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on
project DMM-Tooling: Can not execute Sonar: PicoLifecycleException:
method 'public void
org.sonar.batch.config.BatchSettingsEnhancer.start()', instance
'org.sonar.batch.config.BatchSettingsEnhancer@1f55ffca,
java.lang.RuntimeException: wrapper: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar
(default-cli) on project DMM-Tooling: Can not execute Sonar
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not
execute Sonar
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
        at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: org.picocontainer.PicoLifecycleException:
PicoLifecycleException: method 'public void
org.sonar.batch.config.BatchSettingsEnhancer.start()', instance
'org.sonar.batch.config.BatchSettingsEnhancer@1f55ffca,
java.lang.RuntimeException: wrapper
        at
org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFailed(NullComponentMonitor.java:77)
        at
org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:132)
        at
org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:115)
        at
org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
        at
org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
        at
org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
        at
org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
        at org.picocontainer.behaviors.Stored.start(Stored.java:110)
        at
org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:996)
        at
org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:989)
        at
org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:746)
        at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:70)
        at org.sonar.batch.bootstrap.Module.start(Module.java:82)
        at org.sonar.batch.Batch.execute(Batch.java:100)
        at org.sonar.maven3.SonarMojo.executeBatch(SonarMojo.java:146)
        at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:136)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
        ... 23 more
Caused by: java.lang.RuntimeException: wrapper
        at
org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
        ... 38 more
Caused by: java.lang.NullPointerException
        at
org.sonar.jpa.session.AbstractDatabaseConnector.createEntityManager(AbstractDatabaseConnector.java:117)
        at
org.sonar.jpa.session.JpaDatabaseSession.start(JpaDatabaseSession.java:53)
        at
org.sonar.jpa.session.ThreadLocalDatabaseSessionFactory.getSession(ThreadLocalDatabaseSessionFactory.java:37)
        at
org.sonar.core.config.ConfigurationUtils.prepareDbSession(ConfigurationUtils.java:109)
        at
org.sonar.core.config.ConfigurationUtils.getProjectProperties(ConfigurationUtils.java:88)
        at
org.sonar.batch.config.BatchSettingsEnhancer.start(BatchSettingsEnhancer.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
        ... 37 more




--
Cato the Elder: "After I'm dead I'd rather have people ask why I have
no monument than why I have one."

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...