Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade' - maven

Our Jenkins has a Maven/Tycho build using Java8 that worked perfectly in February, but stopped working now in April. (Since it was not run during this interval, I'm not sure when it stopped working exactly.)
The exception that gets thrown right after downloading the p2 repositories (or maybe right in the middle) is:
[WARNING] Error initializing: org.eclipse.tycho.p2.resolver.P2DependencyResolver#18bef28
java.lang.RuntimeException: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.checkStarted (DefaultEquinoxEmbedder.java:312)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:286)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:281)
at org.eclipse.tycho.p2.resolver.P2DependencyResolver.initialize (P2DependencyResolver.java:429)
Caused by: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:302)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:281)
at org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.afterFrameworkStarted (OSGiProxyConfigurator.java:41)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.doStart (DefaultEquinoxEmbedder.java:185)
...and...
[WARNING] Error injecting: org.eclipse.tycho.p2.resolver.P2DependencyResolver
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error notifying InjectionListener org.eclipse.sisu.plexus.PlexusBeanBinder#1b6fe69 of org.eclipse.tycho.p2.resolver.P2DependencyResolver.
Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
while locating org.eclipse.tycho.p2.resolver.P2DependencyResolver
1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
...and of course...
[ERROR] Internal error: java.lang.RuntimeException: Could not instantiate required component: com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR]
[ERROR] 1) Error notifying InjectionListener org.eclipse.sisu.plexus.PlexusBeanBinder#1b6fe69 of org.eclipse.tycho.p2.resolver.P2DependencyResolver.
[ERROR] Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
[ERROR] while locating org.eclipse.tycho.p2.resolver.P2DependencyResolver
[ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:1.3.0, parent: sun.misc.Launcher$AppClassLoader#647e05] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.eclipse.tycho.core.DependencyResolver annotated with #com.google.inject.name.Named(value=p2)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.eclipse.tycho.core.DependencyResolver
[ERROR] roleHint: p2
[ERROR] -> [Help 1]
My first thought was that Maven takes new releases of it's plug-ins, but there are no versions missing in the pom.xml and Maven does not warn about it either.
I tried updating from Tycho 0.22 to 0.26 to 1.3, but neither version worked.
I tried running the build with Maven 3.0 and 3.6, but neither worked.
I tried Java 8 with 32bit and 64bit, and Java 11.
Now I have no idea where to even start to search for the source of the problem. Can anyone shed some light on this?
(If you need some more information, just ask. The files are pretty long, so I'd rather not copy all of them into this question before narrowing down where the problem might be.)

It helped for me to clean local maven repository.
Normally its located in <User-home>/.m2
HTH

I think I have similar setup as yours: An Eclipse RCP project which should be build on Jenkins in a Docker container by Maven/Tycho.
The following issue gave me a hint in the right direction: https://bugs.eclipse.org/bugs/show_bug.cgi?id=552877
When I ran Maven with -X I got the following debug-output:
[DEBUG] Using local repository at ?/.m2/repository
This led me to the following question: Why does maven use "?" as my home directory
But additionally to the -s argument I also needed to set the user.home parameter explicitly. (But that is probably only needed because I have not set the local repository location in the settings.xml)
This finally results in this Maven call: mvn -B clean verify --fail-at-end -s /some/folder/settings.xml -Duser.home=/another/folder

Related

MVN build: java.lang.RuntimeException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi

I am facing issue in "mvn clean build" due to error below
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] Error initializing: org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver#5e2a3040
java.lang.RuntimeException: java.lang.RuntimeException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi.
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.checkStarted(DefaultEquinoxEmbedder.java:301)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService(DefaultEquinoxEmbedder.java:275)
I have set the Mavan, M2 and Java Paths correctly on the environment variables.
Please suggest what the cause the error.
Regards
R

Error commande mvn from console Intellij and java 11

I have a problem with command mvn
I work with Intellij and java 11
I clone a project and when i tape a command on terminal, he doesn't work.
For exemple :
mvn test -> on console : error
with maven tab : its ok
My stacktrace :
brichet#brichet-G11CD:~/IdeaProjects/cours_TDD/oc-testing-java-cours$ mvn test
[INFO] Scanning for projects...
[WARNING] Error injecting: org.apache.maven.wagon.providers.http.HttpWagon$__sisu21
java.lang.ExceptionInInitializerError
at sun.security.ssl.ProtocolVersion.<init> (ProtocolVersion.java:158)
at sun.security.ssl.ProtocolVersion.<clinit> (ProtocolVersion.java:41)
at sun.security.ssl.SSLContextImpl$AbstractTLSContext.<clinit> (SSLContextImpl.java:560)
....
Caused by: java.lang.IllegalArgumentException: Error in security property. Constraint unknown:
jdk.disabled.namedCurves
at sun.security.util.DisabledAlgorithmConstraints$Constraints.<init>
(DisabledAlgorithmConstraints.java:329)
at sun.security.util.DisabledAlgorithmConstraints.<init>
(DisabledAlgorithmConstraints.java:100)
at sun.security.ssl.SSLAlgorithmConstraints.<clinit> (SSLAlgorithmConstraints.java:45)
at sun.security.ssl.ProtocolVersion.<init> (ProtocolVersion.java:158)
at sun.security.ssl.ProtocolVersion.<clinit> (ProtocolVersion.java:41)
at sun.security.ssl.SSLContextImpl$AbstractTLSContext.<clinit> (SSLContextImpl.java:560)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName (Class.java:315)
at java.security.Provider$Service.getImplClass (Provider.java:1848)
at java.security.Provider$Service.newInstance (Provider.java:1824)
at sun.security.jca.GetInstance.getInstance (GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance (GetInstance.java:164)
at javax.net.ssl.SSLContext.getInstance (SSLContext.java:168)
at javax.net.ssl.SSLContext.getDefault (SSLContext.java:99)
at javax.net.ssl.SSLSocketFactory.getDefault (SSLSocketFactory.java:123)
at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory
(HttpsURLConnection.java:335)
at
.......
---------------------------------------------------
Caused by: java.lang.IllegalArgumentException: Error in security property. Constraint unknown:
jdk.disabled.namedCurvesat
java.base/sun.security.util.DisabledAlgorithmConstraints$Constraints.<init>(DisabledAlgorithmCo
nstraints.java:329)
at
java.base/sun.security.util.DisabledAlgorithmConstraints.<init>(DisabledAlgorithmConstraints.java
:100)
at
java.base/sun.security.ssl.SSLAlgorithmConstraints.<clinit>(SSLAlgorithmConstraints.java:45)
... 84 more
Thank you for help !
May be check maven JDK version and intellij project JDK version (on the Projet Structure / Project Settings / Projet SDK menu) , it may have a difference

Maven Test Throws Exception in Ubuntu

Since an event I do not know, calling mvn test does not work anymore in my Ubuntu 18.04. (running since April). mvn install -DskipTests=true or any other lifecycle phase I tried works well.
If I run for example mvn test in a recent version of Apache Commons IO cloned into /home/reichelt/commons-io/, if shows
[ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/reichelt/commons-io && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx25M -jar /home/reichelt/commons-io/target/surefire/surefirebooter6661636703131088733.jar /home/reichelt/commons-io/target/surefire 2018-10-31T18-30-50_926-jvmRun1 surefire4405197448341812663tmp surefire_1048154306090710821475tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:494)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:441)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:293)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:854)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/reichelt/commons-io && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx25M -jar /home/reichelt/commons-io/target/surefire/surefirebooter6661636703131088733.jar /home/reichelt/commons-io/target/surefire 2018-10-31T18-30-50_926-jvmRun1 surefire4405197448341812663tmp surefire_1048154306090710821475tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$600(ForkStarter.java:115)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:429)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:406)
[ERROR] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[ERROR] at java.lang.Thread.run(Thread.java:748)
The target/surefire-reports contains many repetitions of
# Created on 2018-10-31T18:31:48.243
Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
Any other project I tried shows similiar behaviour.
I tried downloading maven 3.5.4, unzipping it, adding it to the path by export PATH=/home/reichelt/Downloads/apache-maven-3.5.4-bin/apache-maven-3.5.4/bin:$PATH and running the newer version, but this did not change anything (while mvn -version works correctly and shows the newer version). Same happens for Maven 3.5.0.
Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher suggests that setting export M3_HOME=/usr/share/maven and export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ should help, but unfortunately, it did not.
I tried deleting ~/.m2, but unfortunately, this also did not help.
Running this in a docker container with docker run -it ubuntu and running
apt update
apt install -y openjdk-8-jdk maven git
mvn -version
git clone https://github.com/apache/commons-io.git
cd commons-io/
mvn test
yields the same behaviour, so it seems like this is not only an issue of my installation.
Running docker run -it fedora bash and
yum install java-1.8.0-openjdk.x86_64*
yum install wget
wget http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
tar -xvf apache-maven-3.5.4-bin.tar.gz
yum install git
export PATH=/apache-maven-3.5.4/bin:$PATH
mvn -version
git clone https://github.com/apache/commons-io.git
cd commons-io/
mvn test
runs the tests as expected surprisingly.
Has anybody an idea how to solve this issue / work around it?
EDIT
Like the message suggests, this seems to be a problem with the ForkedBooter which can not be found. https://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html describes that surefire can be used by an isolated classloader in a booter jar, or by an manifest-only jar. It seems like by default, I am using a manifest only jar which contains something like:
Manifest-Version: 1.0
Class-Path: file:/home/reichelt/.m2/repository/org/apache/maven/surefi
re/surefire-booter/2.21.0/surefire-booter-2.21.0.jar file:/home/reich
elt/.m2/repository/org/apache/maven/surefire/surefire-api/2.21.0/sure
fire-api-2.21.0.jar file:/home/reichelt/.m2/repository/org/apache/mav
en/surefire/surefire-logger-api/2.21.0/surefire-logger-api-2.21.0.jar
file:/home/reichelt/commons-io/target/test-classes/ file:/home/reich
elt/commons-io/target/classes/ file:/home/reichelt/.m2/repository/jun
it/junit/4.12/junit-4.12.jar file:/home/reichelt/.m2/repository/org/h
amcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar file:/home/reichelt/.
m2/repository/org/apache/maven/surefire/surefire-junit4/2.21.0/surefi
re-junit4-2.21.0.jar
Main-Class: org.apache.maven.surefire.booter.ForkedBooter
This seems fine to me: /home/reichelt/.m2/repository/org/apache/maven/surefire/surefire-booter/2.21.0/surefire-booter-2.21.0.jar is fine and contains a class file for org.apache.maven.surefire.booter.ForkedBooter.
By adding
<useSystemClassLoader>true</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
to the pom, builds run again. This seems to be a solution which makes no use of the ForkedBooter. While this is a workaround, I'd still like to understand: Can I further debug this issue, in order to find a reason while this does not work with current Ubuntu? Since it does not work with other maven versions (even in a fresh Ubuntu docker container), but does work on a Fedora container, I assume that the reason somehow is connected to the Ubuntu default configuration.
Funny story: Indeed, this was an OpenJDK update issue.
I read my last history by sudo zcat /var/log/apt/history.log.1.gz | less (depending on logrotating, it was .1, could be anything else). This showed that an update was run this morning:
Start-Date: 2018-10-31 10:38:04
Commandline: /usr/bin/unattended-upgrade
Upgrade: openjdk-8-jdk:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1), openjdk-8-jre:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1), openjdk-8-jdk-headless:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1), openjdk-8-jre-headless:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1)
End-Date: 2018-10-31 10:38:09
So for some reason, OpenJDK 8u181 seems to be incompatible with maven 3.5.2 and surefire. Since I already installed the package upgrade, I downgraded again with sudo apt install openjdk-8-jdk=8u162-b12-1 openjdk-8-jre=8u162-b12-1 openjdk-8-jdk-headless=8u162-b12-1 openjdk-8-jre-headless=8u162-b12-1. Now testing works again.
In https://www.oracle.com/technetwork/java/javase/8u-relnotes-2225394.html, there Java 8u171, 8u172 and 8u181 do not seem to contain updates which make using the maninfest-only jar of surefire impossible, but I only looked shortly above it and did not dive deeper into the bug reports.
EDIT The bug is already reported on OpenJDK: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925
EDIT 2 This bug is fixed in Java 1.8.0_191 and mvn test runs normal again.
Ran into the same problem today. Not sure of the best long-term fix, but setting the forkCount to 0 for maven-surefire-plugin seems to have fixed it for me for now. Probably makes the tests take longer, unfortunately.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>0</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
Hope it helps.

Sakai 12.1 deploy command error when connecting to MySQL through JBDC driver

I am currently trying to deploy an instance of the latest Sakai 12.1 on Tomcat, but when I run the
mvn clean install sakai:deploy -Dmaven.tomcat.home=$CATALINA_HOME -Dsakai.home=$CATALINA_HOME/sakai -Dsakai.cleanup=true -Djava.net.preferIPv4Stack=true command, if executes without errors until the "Sakai Core Kernel Implementation" modules (out of the 413), returning this:
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:30 min
[INFO] Finished at: 2018-05-17T13:33:19+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project sakai-kernel-impl: There are test failures.
[ERROR]
[ERROR] Please refer to /home/usuario/sakai/kernel/kernel-impl/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :sakai-kernel-impl
I have seen the error log and the first one is in the RoleAccessTest test.
The log info:
...
13:29:15,161 INFO PoolBase:505 - sakai - Driver does not support get/set network timeout for connections. (not supported feature)
13:29:15,168 ERROR PoolBase:441 - sakai - Failed to execute connection test query (insufficient user privileges or object not found: DUAL).
13:29:15,169 ERROR HikariPool:541 - sakai - Exception during pool initialization.
java.sql.SQLSyntaxErrorException: insufficient user privileges or object not found: DUAL
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
...
[EDIT: Looking at the preceding log, why does HSQLDB arises in the error stack? Isn't supposed to be only MySQL?]
Later, in another line:
WARN JdbcServicesImpl:195 - HHH000341: Could not obtain connection metadata
The Mysql Driver JAR is correctly copied in /opt/tomcat/lib, and the DB user and credentials correctly set in /opt/tomcat/sakai/local.properties
I do not want to deploy Sakai without running test as this is a complete fresh installation and there should not be any errors...
Any help?
Look in your sakai.properties or local.properties. It probably has the line
# validationQuery#javax.sql.BaseDataSource=select 1 from DUAL
This is the SQL query Sakai issues by default to check whether the database is reachable. It looks as though the database system you're using doesn't support that query, so you'll either need to set that property to some other query, or switch the database system you're using. MySQL supports this query, so if you have
vendor#org.sakaiproject.db.api.SqlService=mysql
I'm wrong and it must be something else.

sonar maven plugin build error, SonarQube version: null

My jenkins builds just started to fail with this message:
[INFO] --- sonar-maven-plugin:2.7:sonar (default-cli) # cividas-core-web ---
[INFO] artifact com.ontimize:ontimize-core: checking for updates from central
[INFO] artifact com.ontimize:ontimize-core: checking for updates from imatia-local
[INFO] artifact com.ontimize:ontimize-core: checking for updates from snapshots
[INFO] User cache: /var/lib/jenkins/.sonar/cache
[INFO] SonarQube version: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.773s
[INFO] Finished at: Thu Oct 22 19:49:04 CEST 2015
[INFO] Final Memory: 13M/193M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project cividas-core-web: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project cividas-core-web: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
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:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:107)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:141)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.maven.artifact.versioning.ComparableVersion.parseVersion(ComparableVersion.java:354)
at org.apache.maven.artifact.versioning.ComparableVersion.<init>(ComparableVersion.java:345)
at org.apache.maven.artifact.versioning.DefaultArtifactVersion.parseVersion(DefaultArtifactVersion.java:110)
at org.apache.maven.artifact.versioning.DefaultArtifactVersion.<init>(DefaultArtifactVersion.java:46)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.isVersionPriorTo5Dot2(RunnerBootstrapper.java:192)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:84)
... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Sonar analysis completed: FAILURE
What is this all about?
Solved by downgrading the automatically picked latest (2.7) version to an older one (2.4) by adding this code to the plugins section of my pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
For those interested in "why?", I've done some more digging and what seems to be happening is this:
RunnerBootstrapper attempts to check whether a version is 5.2+:
First, serverVersion is retrieved from a launcher created in EmbeddedRunner,
using IsolatedLauncher creating a proxy of implementation class BatchIsolatedLauncher
which attempts to read a resource file sq-version.txt containing the version.
This sq-version.txt file is located in org.codehaus.sonar:sonar-plugin-api, but this dependency is not included (even transitively) in the sonar-maven-plugin. All it references sonar-wise is org.sonarsource.sonar-runner:sonar-runner-api.
They seem to have changed the location and name of the version txt file but not updated all code. You might get away with manually adding an sq-version.txt with content 5.2 (no newline) to the plugin classpath (possibly by updating the plugin jar), or add a dependency on sonar-plugin-api, but these are hacks.
The sonar-maven-plugin 2.6 uses sonar-runner 2.4, which is very different from 2.5 that sonar-maven-plugin 2.7 uses (the groupId for sonar-runner has changed domains from org.codehaus.sonar.runner to org.sonarsource.sonar-runner), so it's best to stick to the v2.6 plugin until they have smoothed out the transition and released a few more versions.
The way SonarQube server version is passed to maven-sonar-plugin has changed in v2.7, along with other things, since it uses now sonar-runner 2.5.
There is indeed a bug when using it with SonarQube instances < 4.3, for which I opened the ticket: https://jira.sonarsource.com/browse/MSONAR-131
Note that SQs < 4.5 (current LTS) are no longer actively supported and there is no guarantee that sonar-maven-plugin won't be incompatible with them in other ways due to the new interface exposed by sonar-runner 2.5.
For these cases, it is probably best to lock the maven plugin version to 2.6, as already suggested.
We had the same problem at work today, we automatically use the latest version for maven and sonar plugins. It wasn't easy to find the problem at first.
The answer elcodedocle has given is correct, but i would like to add for those that use maven with sonar in an automated fashion that this is a solution aswell:
org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
This way it runs on the older version 2.6 and i can confirm that it works.
There is probably a bug in 2.7 and i hope it gets fixed soon. This was our error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven plugin:2.7:sonar (default-cli) on project (projectName): Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. "(projectName)" is orphan -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
EDIT:
Take a look at this post for some more information: Jenkins Sonar plugin suddenly stops working
Here is explained that the new version, 2.7, of the plugin is no longer compatible with java 6 projects. You can also find an explanation about how to fix it in Jenkins if you are not familiar with it. (my explanation was a bit short)
This is a hint:
[INFO] SonarQube version: null
Later in the code, Maven tries to parse this version number and fails. The source code is here: https://github.com/mojohaus/sonar-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/sonar/bootstrap/RunnerBootstrapper.java
From the source of the SonarQube runner, this is backed by a properties instance. So maybe the code couldn't access the server or the server isn't sending this data back. Hard to tell.
What I can see is that the code changed in 2.5. That's probably why 2.4 still works. See here how to nail down the versions: Jenkins Sonar plugin suddenly stops working
Discover the appropriate plugin version for you running sonar installation.
E.g.
mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
This plugin version will not work against the latest sonar release but will work fine against a 4.1.2.

Resources