fabric8:docker-maven-plugin cannot load the ffi provider when running on Centos7 in Jenkins - maven-3

After adding fabric8 to a hello world pom, when running maven "clean install" in Jenkins on CentOS7,
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.31.0</version>
<configuration>
<filter>${*}</filter>
<images>
<image>
<name>docker.io/myname/${project.artifactId}:${project.version}</name>
</image>
</images>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
I get the following error
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.31.0:build (default) on project reference-service: Execution default of goal io.fabric8:docker-maven-plugin:0.31.0:build failed: An API incompatibility was encountered while executing io.fabric8:docker-maven-plugin:0.31.0:build: java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>io.fabric8:docker-maven-plugin:0.31.0
...
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: could not get native definition for type: POINTER: java.lang.UnsatisfiedLinkError: /tmp/jffi5159674609596634370.so: /tmp/jffi5159674609596634370.so: failed to map segment from shared object: Operation not permitted
I can't find any install instructions of a .so file for CentOS7 or other instructions.
The GitHub site doesn't provide much guidance;
Docker is listening on 2375 and docker.sock. The user I'm building as is in dockerroot.
Same issue with fuse
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001:build (default) on project reference-service: Execution default of goal io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001:build failed: An API incompatibility was encountered while executing io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001:build: java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
[ERROR] realm = plugin>io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001

There are two options:
Easy one: upgrade to the last version of the plugin. The problem was resolved in release 0.38.1
https://github.com/fabric8io/docker-maven-plugin/releases/tag/v0.38.1
More complex one (If you can upgrade your plugin version): follow this tutorial m1 chip + f8-plugin problem. Is a combination of socat and DOCKER_HOST

In this case, FFI error meant that the plugin could not talk to the docker daemon. Setting DOCKER_HOST to tcp://127.0.0.1:2375 in the global jenkins config resolved my issue.

Related

cargo-maven2-plugin:start fails with "Actually there are no valid types registered for this configuration", regardless of what containerId I enter

I'm trying to run integration tests with the cargo-maven2-plugin and Tomcat 8. I want the Maven build to start the container for me, so I have configured the start and stop goals as documented here. The problem is that regardless of what I enter as containerId, the start goal always fails with a message saying that there are no registered configurations. The error messages always ends in
Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it?
I've tried various configurations, including ones that I found in various tutorials, and ones that user older Tomcat versions, but nothing helps. The error message is always the same.
Other posts here on Stack Overflow recommend to update the Cargo versions, but this doesn't apply to my problem: I already use the latest release version (1.6.5).
So, why do I keep getting this error?
For reference, here is one complete configuration that I tried out:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.5</version>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>8.5.23</version>
</artifactInstaller>
</container>
<configuration>
<type>standalone</type>
</configuration>
<deployables>
<!-- ... -->
</deployables>
</configuration>
</plugin>
The full error message for this configuration is:
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.6.5:start (start-container) on project domain.db.itest: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.6.5:start failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [tomcat8x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [Help 1]
The solution was incredibly simple: I had the offline mode enabled. Without offline mode, Cargo downloaded the cargo-core-container-tomcat artifact, and apparently this artifact contains the definition of the tomcat8x configuration. Then, the container start was successful!
I had started the Maven build from Eclipse, so I didn't notice that the offline mode was enabled. I'm aware that this situation is quite special, but maybe someone else still benefits from my insight. It took me a while to solve, so I'm sharing problem and solution here. (After all, this is encouraged :-)
I got the key hint from a mailing list post, where thecargo-core-container-tomcat artifact was not downloaded due to a Nexus repository configuration.
This error is sometimes due to the cargo plugin version. Update your cargo plugin to the higher or latest version.
In my case, I updated from cargo 1.4.8 to cargo 1.7.0.
check this link,its may help:
click here

Jenkins GMavenPlus plugin cannot import local class in groovy script

I have a Jenkins job that call a maven build file that calls a groovy script.
In Jenkins I have:
Maven version 3.0
Goals and options: -U -P hudson gplus:execute
The Groovy script is called using the GMavenPlus. In the pom.xml I have
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
<configuration>
<scripts>
<script>
file:///${project.basedir}/src/main/java/com/mycompany/testImport.groovy
</script>
</scripts>
</configuration>
</plugin>
Which is calling the testImport.groovy script:
println "Hello from testImport"
importedClass = new ImportedClass()
importedClass.hello()
This script tries to include another groovy script, ImportedClass.groovy which has a single method:
class ImportedClass {
def hello() {
println( "Hello from imported class" )
}
}
The testImport script is correctly called and I have all working, but there seems an issue while trying to use an import for the importedClass.
I have this error appearing in the Jenkins console
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.5:execute (default-cli) on project com.mycompany: Error occurred while calling a method on a Groovy class from classpath. InvocationTargetException: startup failed:
[ERROR] Script1.groovy: 3: unable to resolve class ImportedClass
[ERROR] # line 3, column 21.
[ERROR] def importedClass = new ImportedClass()
[ERROR] ^
[ERROR]
[ERROR] 1 error
[ERROR] -> [Help 1]
I tried to setup packages names and use also evaluate but always ending up with that error. Is there a way to include an external groovy file ?
I managed to have external dependencies working by using this in the pom.xml:
<dependencies>
<dependency>
<groupId>org.codehaus.groovy.modules.http-builder</groupId>
<artifactId>http-builder</artifactId>
<version>0.7</version>
</dependency>
Then I can use in the groovy code:
import groovyx.net.http.HTTPBuilder
// and create instance of the class
def httpBuilder = new HTTPBuilder("blablabla")
Followed this Issue in GitHub https://github.com/groovy/GMavenPlus/issues/53
and implemented the suggestion given to use:
def myDependentScript = new GroovyClassLoader().parseClass(new File("myScriptDependency.groovy")).newInstance()
It is not beautifully clean as using a simple import but nonetheless working

Enunciate multiple time running with maven

I'm using enunciate 1.27 and maven 3.0.4 .
My problem occurs when I run enunciate multiple times :
[INFO]
[INFO] --- maven-enunciate-plugin:1.27:assemble (number2) # yaghut-web ---
[INFO] initializing enunciate.
[INFO] [csharp] C# compilation is disabled, but the source code will still be generated.
[INFO] invoking enunciate:generate step...
An exception has occurred in apt (1.6.0_30). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitAnnotation(Apt.java:161)
at com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:1794)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:41)
at com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:266)
at com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:1816)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
at com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:60)
at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitClassDef(Apt.java:146)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:41)
at com.sun.tools.javac.tree.TreeScanner.visitTopLevel(TreeScanner.java:52)
at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitTopLevel(Apt.java:124)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:446)
at com.sun.tools.apt.comp.Apt.main(Apt.java:213)
....
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)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
I execute enunciate in this way:
<execution>
<id>number1</id>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<configFile>src/main/enunciate_number1.xml</configFile>
<compilationEncoding>UTF-8</compilationEncoding>
<generateDir>${project.build.directory}/enunciate/number1/generate</generateDir>
<compileDir>${project.build.directory}/enunciate/number1/compile</compileDir>
<buildDir>${project.build.directory}/enunciate/number1/build</buildDir>
</configuration>
</execution>
<execution>
<id>number2</id>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<configFile>${project.basedir}/src/main/enunciate_number2.xml</configFile>
<compilationEncoding>UTF-8</compilationEncoding>
<generateDir>${project.build.directory}/enunciate/number2/generate</generateDir>
<compileDir>${project.build.directory}/enunciate/number2/compile</compileDir>
<buildDir>${project.build.directory}/enunciate/number2/build</buildDir>
</configuration>
</execution>
when I executed enunciate one time (I mean omit number2) everything work correctly.
I guessed 'generateDir' in second execution was not set correctly. When I omit it, nothing was generated (message was: everythis appears up-to-date); and with current configuration, NullPointerException is thrown.
any idea?
thanks.
I don't know much about how to configure Maven to get this right, but an alternative approach might be to use the maven-antrun-plugin to invoke Enunciate twice instead of trying to get Maven to do it. The configuration would look kinda like the contents of the "getting-started-examples" target at line 199 in build-site.xml.

Jenkins fails build but on local machine everething is ok

[INFO] Fork Value is true
[java] The following errors occurred during analysis:
[java] Aug 09, 2013 3:16:04 PM edu.umd.cs.findbugs.TextUIBugReporter reportAnalysisError
[java] SEVERE: Unable to get XClass for java/lang/StringBuilder
...
After these messages Jenkins ends build with failure. On local machine i got these messages too, but nothing interrupts, and findbugs, pmd and checkstyle finish correctly.
Also on Jenkins i got
[PMD] No report found for mojo check
[FINDBUGS] No report found for mojo check
, but on local machine i don't. Seems like these two stranges are linked, how can i fix them?
I run mvn verify.
SCA included in pom.xml in build section like
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<skip>false</skip>
<failOnViolation>false</failOnViolation>
<failOnError>false</failOnError>
<xmlOutput>true</xmlOutput>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
The problem was in different jdks. On local machine i have 1.7, but on Jenkins - 1.8, so i simply changed version. And seems like roots of this bug are in jdk 1.8.
apparently, the class structure changed in Java 8. Therefore, FindBugs version 2.0.3 (latest release as of 1. Mai 2014) and earlier fail on classes compiled on JDK 1.8 (or later). They already fixed this in the FindBugs development version (not released as of 4. May 2014). The latest maven plugin (findbugs-maven-plugin:2.5.3) uses FindBugs 2.0.2.
I decided to generate the maven reports with Java 7, until the fix (and a new FindBugs maven plugin version using it) is released.
to generate the reports with Java 7 (linux):
JAVA_HOME=${HOME}/Software/jdk1.7 mvn site
related FindBugs bug reports:
http://sourceforge.net/p/findbugs/bugs/1271/
http://sourceforge.net/p/findbugs/bugs/1264/

Non-resolvable parent POM: When building Maven 3 Project Site

I am currently facing the following problem with Maven 3 when I am trying to build the site. I will appreciate you help on this.
mvn clean site
..........
[INFO] Reactor Summary:
[INFO]
[INFO] Project A ......................................... SUCCESS [15.383s]
[INFO] Project B ......................................... SUCCESS [2.232s]
[INFO] My Site ........................................... FAILURE [0.105s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.769s
[INFO] Finished at: Fri Jun 29 14:26:04 AMT 2012
[INFO] Final Memory: 18M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.1:site (default-site) on project site: SiteToolException: Unable to read local module-POM: 1 problem was encountered while building the effective model for my.com:projA:0.1-SNAPSHOT
[ERROR] [FATAL] Non-resolvable parent POM: Could not find artifact my.com:parent-pom:pom:0.1-SNAPSHOT and 'parent.relativePath' points at no local POM # line 12, column 13
[ERROR] for project my.com:projA:0.1-SNAPSHOT
.............
First here is the configuration:
Apache Maven 3.0.4 (r1232337; 2012-01-17 12:44:56+0400)
Java version: 1.7.0_04, vendor: Oracle Corporation
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
Nexus repository: 2.0.6
The parent POM:
<modelVersion>4.0.0</modelVersion>
<name>Parent POM</name>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
The aggregation project pom:
<modelVersion>4.0.0</modelVersion>
<name>My Site</name>
<groupId>my.com</groupId>
<artifactId>site</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath/>
</parent>
<modules>
<module>projA</module>
<module>projB</module>
</modules>
The pom of Project A:
<modelVersion>4.0.0</modelVersion>
<name>Project A</name>
<groupId>my.com</groupId>
<artifactId>projA</artifactId>
<version>0.1-SNAPSHOT</version>
<parent>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath/>
</parent>
The pom of Project B:
4.0.0
<name>Project B</name>
<groupId>my.com</groupId>
<artifactId>projB</artifactId>
<version>0.1-SNAPSHOT</version>
<parent>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath/>
</parent>
Here is the structure of the folder where I run "mvn clean site":
./pom.xml (aggregation project)
./projA/pom.xml (Project A)
./projB/pom.xml (Project B)
parent-pom is successfully deployed to NEXUS repository before the execution of mvn clean site with following command mvn deploy -DaltDeploymentRepository=snapshots::default::http://MyServer:8081/nexus/content/repositories/snapshots
And finally the problem itself:
When I run mvn clean site right after the deployment of parent-pom site is built successfully. If I delete the folder (with its content) "my" (it contains the parent-pom) from the local repository (~/.m2/repository) and then try to build the site with mvn clean site I am getting the error described at the beginning. Actually Maven downloads the parent-pom from the NEXUS. I have compared the downloaded files and files which have been generated after the deployment and have realized that few are missing, for instance maven-metadata-local.xml near to "0.1-SNAPSHOT" folder.
So when I am trying to run the site building job from Jenkins I am getting the error described above, because the parent-pom is not deployed from the machine where Jenkins run.
How can I come up with this problem or what I did wrong?
Thank you.
As pointed out by this answer, there is a bug in the site plugin, which only looks for dependencies in what it thinks is Maven central.
I am having the same problem in Maven 3.0.4 and site-plugin 3.3 . I also have the issue that it works in my development machine which is running Windows 7, but not in the CI-Server which is running Jenkins on Debian.
The problem is not in your pom files. When I built your aggregation-pom, Maven downloaded normally the parent-pom from the remote repo (after I deleted from my local repo).
Try this:
mvn -U clean install site dependency:purge-local-repository
Additionally, you could do some clean up:
remove <relativePath/> from all of them
remove <version>0.1-SNAPSHOT</version> and <groupId>my.com</groupId> from projA and ProjB (they are inherited from the parent)
I got the same problem... works on my developer MacBook, but fails on my Jenkins running on RHEL7 when running mvn site using maven-site-plugin:3.7. I did not test to downgrade the site plugin.
I found another solution. The problem in my case was the maven-project-info-reports-plugin especially the goal dependencies. If I skip the goal with -Dmpir.skip=true my site get's generated (without the dependencies :( report).

Resources