Jenkins fails during parsing poms - maven

I have problems with one job on my Jenkins server.
It fails during pom parse with this message:
Parsing POMs
Modules changed, recalculating dependency graph
[workspace] $ java -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true -cp /opt/edb/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/opt/apache/maven3/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/apache/maven3 /var/lib/tomcat6/webapps/jenkins/WEB-INF/lib/remoting-2.17.jar /opt/edb/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 55430
<===[JENKINS REMOTING CAPACITY]===>channel started
ERROR: Failed to parse POMs
java.io.IOException: Remote call on Channel to Maven [java, -Xmx512m, -XX:MaxPermSize=256m, -Djava.awt.headless=true, -cp, /opt/edb/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/opt/apache/maven3/boot/plexus-classworlds-2.4.jar, org.jvnet.hudson.maven3.agent.Maven3Main, /opt/apache/maven3, /var/lib/tomcat6/webapps/jenkins/WEB-INF/lib/remoting-2.17.jar, /opt/edb/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar, 55430] failed
at hudson.remoting.Channel.call(Channel.java:673)
at hudson.maven.ProcessCache$MavenProcess.<init>(ProcessCache.java:112)
at hudson.maven.ProcessCache.get(ProcessCache.java:231)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:704)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1516)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: java.lang.Error: Failed to deserialize the Callable object.
Caused by: java.lang.IndexOutOfBoundsException: Index: 1997078527, Size: 0
I have tried creating a new build, no luck
Building locally works fine
All other similar jobs work fine
I'm running letest jenkins (1.489)
Any ideas?

Hard disk is full.
Try to restart.

Maybe the workspace is corrupted and on your pom.xml is not readable. Have to try to clean the workspace for this specific job ?

This issue was fixed for me by setting the correct version Java version in the PATH (as required in the pom.xml) - See https://issues.jenkins-ci.org/browse/JENKINS-5519

Related

gradle dependency fails but it's there

I have the following error (PLEASE NOTE the jar it says it could not find is different from the location jar name in this error...weird)...
* What went wrong:
A problem occurred evaluating project ':webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME'.
> Could not resolve all files for configuration ':webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:runtime'.
> Could not find micrometer-core.jar (io.micrometer:micrometer-core:1.4.0-SNAPSHOT:20200320.152130-173).
Searched in the following locations:
https://repo.spring.io/libs-snapshot/io/micrometer/micrometer-core/1.4.0-SNAPSHOT/micrometer-core-1.4.0-20200319.235509-170.jar
A snapshot of the current contents of directory(in case this post last to tomorrow and a new snapshot is there) is the following...
I have no idea why it can't find 1.4.0-SNAPSHOT since my gradle file is simple and the dependency is simply
'io.micrometer:micrometer-core:1.4.0-SNAPSHOT'
I think it's a gradle daemon bug or something. I did rm -rf ./gradle/cache and then it broke with an exception
Caused by: java.lang.NoClassDefFoundError: build_a6ssp86bmi79bk936w466ea1t$_run_closure5$_closure11
at build_a6ssp86bmi79bk936w466ea1t$_run_closure5.doCall(/Users/dean/workspace/orderly/dataapi-all/dataapi/build.gradle:111)
at org.gradle.util.ClosureBackedAction.execute(ClosureBackedAction.java:71)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:154)
at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:130)
at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:587)
at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:91)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:103)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection$ContainerElementsDynamicObject.tryInvokeMethod(DefaultNamedDomainObjectCollection.java:541)
at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)
So then I killed the gradle daemons and voila, it's working again.

Gradle build failing after update

Getting exception while gradle/gradlew build. Build without test cases is successful. This happening when I updated the gradle to 6.0.1
Works fine for gradle 5.6/6.2 version.
Could not write standard input to Gradle Test Executor 2.
java.io.IOException: The pipe is being closed
at java.base/java.io.FileOutputStream.writeBytes(Native Method)
at java.base/java.io.FileOutputStream.write(FileOutputStream.java:348)
at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:835)
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain
FAILURE: Build failed with an exception.
I just had this happen, and found that stopping the gradle daemon resolved it for me:
gradle --stop
or
./gradlew --stop
depending on your setup (the daemon is relaunched when you attempt to build again).
I encountered this error and the one method I found was dump the whole $HOME/.gradle cache and then rebuild the project.
Starting/Stopping IntellijIDEA and/or rebuilding did not help.
You know you have jumped the complexity shark somewhere when running lowly test cases starts to fail for obscure reasons.
Granted, this happened after a machine crash. But still..
If its a windows system, then try deleting the .gradle folder from the user directory and try to build the gradle. This should solve the issue

Jenkins cannot build maven and gradle projects

I have configured jenkins on kubernetes cluster as a pod with NFS volume mount. when i try to build code, using maven and gradle , i'm getting these error.
Exception in thread "main" java.io.IOException: No locks available
at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:94)
at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1114)
at java.nio.channels.FileChannel.tryLock(FileChannel.java:1155)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:55)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
I fixed the issue. I had to update volume claim yaml. accessModes to ReadWriteOnce, previous it was ReadWriteMany.

JenkinsX - Build fail due to Java Heap space

I am working on creating CI/CD pipeline for Spring Boot application on GKE using JenkinsX. As soon as I push the code to the master branch, build gets triggered but the build fails due to insufficient Java heap space.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.2.2:war (default-war) on project location-finder-api: Error assembling WAR: Problem creating war: Execution exception: Java heap space -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.2.2:war (default-war) on project location-finder-api: Error assembling WAR: Problem creating war: Execution exception
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.codehaus.plexus.archiver.zip.ByteArrayOutputStream.needNewBuffer (ByteArrayOutputStream.java:153)
at org.codehaus.plexus.archiver.zip.ByteArrayOutputStream.write (ByteArrayOutputStream.java:192)
To resolve I tried to set the JVM argument in the Docekrfile as
CMD ["java", "-Xmx1024m","-jar", "app.jar"]
But it did not work. This is what I see when the build starts
+ mvn -e clean deploy -Pprod
Picked up _JAVA_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true -XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Xms10m -Xmx192m
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Is there any way that I can set this heap option on my own?
it looks like maven is running out of memory so you need more memory in your build pod (not the Dockerfile for your app).
as a quick test you can edit the pod template inside the Jenkins UI: jx console then Manage Jenkins -> Configure System then find the jenkins-maven pod template in the UI and edit the _JAVA_OPTIONS environment variable from this value: https://github.com/jenkins-x/jenkins-x-platform/blob/master/jenkins-x-platform/values.yaml#L907 - try change -Xmx512m to something bigger like -Xmx912m
Once you've found a value that works for your projects you can make the change permanent of restarts of Jenkins by adding this to your myvalues.yaml - something like this...
# myvalues.yaml
jenkins:
Agent:
PodTemplates:
Maven:
Name: maven
Label: jenkins-maven
EnvVars:
_JAVA_OPTIONS: '-XX:+UnlockExperimentalVMOptions -Dsun.zip.disableMemoryMapping=true -XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Xms10m -Xmx912m'
see the docs on creating/configuring builders

Trouble installing Kyoto Tycoon - Java. Maven failing

I've downloaded Kyoto Tycoon via:
hxxps://bitbucket.org/EP/kyototycoon-java
When running mvn install I get plenty of warnings telling me it couldn't find several files:
http://pastebin.com/znpJ3d5n
When I first started running the install I was getting a lot of failures and no errors. After blindly going around and trying to install things separately, the output now looks like this. I have no experience with Maven so editing the pom.xml file is out of the question. I've tried using the ignore tests and compiling, and I get few jar files. This allows me to compile "Example.java" using:
javac -cp .:target/kyototycoon-0.2-SNAPSHOT.jar Example.java
I then try to run the code using:
java -cp .:target/kyototycoon-0.2-SNAPSHOT.jar Example
but I get an runtime error:
Exception in thread "main" java.lang.NoClassDefFoundError: Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/finagle/Codec
at kyototycoon.SimpleKyotoTycoonClient.<init>(SimpleKyotoTycoonClient.java:16)
at Example.main(Example.java:11)
Caused by: java.lang.ClassNotFoundException: com.twitter.finagle.Codec
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 2 more
I'm assuming this all comes back the the maven install failing, but I'm not sure how to fix it.
Any direction is appreciated. There doesn't seem to be a large support group for Kyoto.
For anyone experiencing this same issue, I found that JAR files I needed were being created. They were being stored in ~/.m2/repository/kyototycoon/kytotycoon/. I created a disgusting looking classpath that included all of these JAR files and this allowed me to compile AND run the Example.java file.
If "editing the pom file is out of the question" I'd strongly recommend steering clear of Maven.
In any case, you can install local jars to your repository if the artifact isn't available from any repository.

Resources