Add agent and custom-handler to the same Wildfly deployment - java

I'm trying to configure JMX Exporter as an agent of a Wildfly 10.1.0 box. Everything works fine with default configuration.
Now I need to add Sentry as a custom-handler which fail the Wildfly start with the following error:
java.lang.IllegalArgumentException: Failed to load module "io.sentry" for handler "SENTRY"
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:64)
...
at java.util.logging.Logger.getLogger(Logger.java:502)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.<clinit>(JmxCollector.java:38)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.NoClassDefFoundError: org/jboss/modules/ModuleLoader
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ModuleFinder.getClassLoader(AbstractPropertyConfiguration.java:463)
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:62)
... 27 more
When I add -Xbootclasspath/p:/opt/jboss/wildfly/jboss-modules.jar to JAVA_OPTS the error changes to:
java.lang.IllegalArgumentException: Failed to load module "io.sentry" for handler "SENTRY"
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:64)
...
at java.util.logging.Logger.getLogger(Logger.java:502)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.<clinit>(JmxCollector.java:38)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: org.jboss.modules.ModuleNotFoundException: io.sentry:main
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:223)
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ModuleFinder.getClassLoader(AbstractPropertyConfiguration.java:467)
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:62)
... 27 more
org.jboss.modules.ModuleNotFoundException: org.jboss.as.standalone:main
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:223)
at org.jboss.modules.Main.main(Main.java:394)
Is there a proper way to configure an agent and a custom-handler in the same Wildfly deployment?
EDIT 1:
The current JAVA_OPTS is:
-server
-Xms1024m
-Xmx1024m
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=256m
-XX:NewRatio=2
-XX:SurvivorRatio=20
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
-XX:+UseGCOverheadLimit
-XX:+ExitOnOutOfMemoryError
-Djava.net.preferIPv4Stack=true
-Djava.awt.headless=true
-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager,io.sentry
-javaagent:/opt/agent/prometheus/jmx_prometheus_javaagent.jar=1234:/opt/jboss/wildfly/bin/jmx-exporter-config.yaml
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Xbootclasspath/p:/opt/jboss/wildfly/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.0.4.Final.jar
-Xbootclasspath/p:/opt/jboss/wildfly/modules/system/layers/base/io/sentry/main/sentry-1.7.2.jar
-Xbootclasspath/p:/opt/jboss/wildfly/jboss-modules.jar
JVM version:
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (IcedTea 3.6.0) (Alpine 8.151.12-r0)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
OS version (container):
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.7.0
PRETTY_NAME="Alpine Linux v3.7"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"

Related

Exception in thread "main" java.lang.reflect.InvocationTargetException Caused by: java.lang.AbstractMethodError:

Tried exploring multiple articles for the same but didn't help !
Can someone throw some light what could be possibly wrong here ?
"C:\Program Files (x86)\Java\jdk1.8.0_241\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\lib\idea_rt.jar=56127:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\lib\idea_rt.jar" com.intellij.rt.execution.CommandLineWrapper C:\Users\x01373661\AppData\Local\Temp\1\idea_classpath132405151 com.CONFIDENTIAL.svc.event.Application
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:63)
Caused by: java.lang.AbstractMethodError: org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/Class;)Z
at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:79)
at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:289)
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:221)
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:192)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at com.barclaycardus.svc.event.Application.main(Application.java:66)
... 5 more
Process finished with exit code 1
Your classpath contains incompatible dependencies. Specifically, the version of Spring Framework's spring-context jar that you are using is not compatible with the version of Spring Boot's spring-boot jar. Using Spring Boot's dependency management and allowing it to control the versions of your application's dependencies is the recommended way to avoid this problem.

Java Schemagen on Ubuntu error: SEVERE: null

I'm using ubuntu 18.04 with java
>> java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.18.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.18.04, mixed mode, sharing)
installed by sudo apt install default-jre (but I don't think that it is the problem)
and I have installed schemagen using apt as suggested here.
The version of schemagen is 2.3.0.1.
I have launched schemagen Moon.java but I have this error:
Sep 10, 2021 5:54:25 PM com.sun.tools.jxc.SchemaGenerator run
SEVERE: null
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:166)
at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:91)
at com.sun.tools.jxc.SchemaGenerator.main(SchemaGenerator.java:82)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.sun.tools.jxc.SchemaGeneratorFacade.main(SchemaGeneratorFacade.java:60)
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: class com.sun.tools.javac.code.Attribute$UnresolvedClass cannot be cast to class com.sun.tools.javac.code.Attribute$Class (com.sun.tools.javac.code.Attribute$UnresolvedClass and com.sun.tools.javac.code.Attribute$Class are in module jdk.compiler of loader 'app')
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:163)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at com.sun.tools.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:266)
... 12 more
Caused by: java.lang.ClassCastException: class com.sun.tools.javac.code.Attribute$UnresolvedClass cannot be cast to class com.sun.tools.javac.code.Attribute$Class (com.sun.tools.javac.code.Attribute$UnresolvedClass and com.sun.tools.javac.code.Attribute$Class are in module jdk.compiler of loader 'app')
at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor.visitArray(AnnotationProxyMaker.java:192)
at jdk.compiler/com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:327)
at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor.getValue(AnnotationProxyMaker.java:167)
at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateValue(AnnotationProxyMaker.java:145)
at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.getAllReflectedValues(AnnotationProxyMaker.java:104)
at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateAnnotation(AnnotationProxyMaker.java:90)
at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateAnnotation(AnnotationProxyMaker.java:81)
at jdk.compiler/com.sun.tools.javac.code.AnnoConstruct.getAnnotation(AnnoConstruct.java:185)
at com.sun.tools.jxc.ap.InlineAnnotationReaderImpl.getClassAnnotation(InlineAnnotationReaderImpl.java:75)
at com.sun.tools.jxc.ap.InlineAnnotationReaderImpl.getClassAnnotation(InlineAnnotationReaderImpl.java:67)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:287)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:227)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:375)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:390)
at com.sun.tools.jxc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:95)
at com.sun.tools.jxc.ap.SchemaGenerator.process(SchemaGenerator.java:110)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:980)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:896)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1222)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1335)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
... 15 more
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0
See https://javaee.github.io/jaxb-v2/
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2020
I'm not able to understand the reason. Have you some ideas to fix it?

Groovy uses prohibited package name

I've installed groovy on my OS X via terminal and I can't run anything. The following exception occurs:
java.lang.SecurityException: Prohibited package name: java.lang
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:659)
at java.lang.ClassLoader.defineClass(ClassLoader.java:758)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:175)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:100)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
It seems that its developers used java.lang package name which makes the class loader angry.
If it can help I checked which tools.jar are found by startGroovy in the following lines:
208 # For Darwin, use classes.jar for TOOLS_JAR
209 TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
In my case JAVA_HOME is:
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/
More details:
$ which java
/usr/bin/java
$ which groovy
/Users/maksim/.sdkman/candidates/groovy/current/bin/groovy
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/
echo $CLASSPATH is empty.
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Java on Yosemite

My java application cannot open in Yosemite.
the error message like this :
java.lang.UnsupportedClassVersionError: .../.../view/Launcher : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.install4j.runtime.MacLauncher.main(Unknown Source)
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 apple.launcher.LaunchRunner.run(LaunchRunner.java:116)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:51)
at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)
I heard this message occur when the JRE1.7 is not installed.
So I checked the version in my console like this :
....-MacBook:~ thrisis$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.1
BuildVersion: 14B25
....-MacBook:~ thrisis$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
....-MacBook:~ thrisis$
I'm very confused and please help me.
PS, sorry for my poor english.
It may also occur is 1.8 is not installed. Make sure you are running the latest versions of Java runtime environment (and Development kit if you need it).
I had the same problem and I fixed it by setting my JAVA_HOME
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
In my .zshrc file. I use zsh shell. You can do the same in your .bashrc or .profile
You mainly see this error when your "jar" is compiled with a higher JDK and you are trying to run it with a lower version. Check out this Wikipedia entry for reference.

Unsupported Class Version during Maven build in Jenkins

I've seen a few of these questions on here, but none of the solutions/tips seem to be pointing me in the right direction. So I have 3 JDK's installed in the locations of "/opt/java/6", "/opt/java/7", and "/opt/java/8". All of these are set in the global Jenkins configuration. Jenkins itself is run using Java 8 which is the system default JRE that I set manually through alternatives (I'm using CentOS 7). I had a bunch of old projects that are built using maven and the maven compiler plugin which is set to source=1.6 target=1.6 . Every time I try to execute a build with the Java 6 JDK I get
Started by user Antony Prince
ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/BitCalculator/lastSuccessful failed
java.nio.file.DirectoryNotEmptyException: /var/lib/jenkins/jobs/BitCalculator/lastSuccessful
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at hudson.Util.createSymlinkJava7(Util.java:1194)
at hudson.Util.createSymlink(Util.java:1112)
at hudson.model.Run.createSymlink(Run.java:1851)
at hudson.model.Run.updateSymlinks(Run.java:1832)
at hudson.model.Run.execute(Run.java:1743)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
ln builds/lastStableBuild /var/lib/jenkins/jobs/BitCalculator/lastStable failed
java.nio.file.DirectoryNotEmptyException: /var/lib/jenkins/jobs/BitCalculator/lastStable
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at hudson.Util.createSymlinkJava7(Util.java:1194)
at hudson.Util.createSymlink(Util.java:1112)
at hudson.model.Run.createSymlink(Run.java:1851)
at hudson.model.Run.updateSymlinks(Run.java:1833)
at hudson.model.Run.execute(Run.java:1743)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Building in workspace /var/lib/jenkins/workspace/BitCalculator
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url /home/git/repositories/java/BitCalculator.git # timeout=10
Fetching upstream changes from /home/git/repositories/java/BitCalculator.git
> git --version # timeout=10
> git fetch --tags --progress /home/git/repositories/java/BitCalculator.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse origin/master^{commit} # timeout=10
Checking out Revision 4f119f7783cc4ff00e5bf9bb27850ae7698d4fe8 (origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 4f119f7783cc4ff00e5bf9bb27850ae7698d4fe8
> git rev-list 4f119f7783cc4ff00e5bf9bb27850ae7698d4fe8 # timeout=10
Parsing POMs
[BitCalculator] $ /opt/java/6/bin/java -Djava.awt.headless=true -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.5.jar:/usr/share/maven/boot/plexus-classworlds.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/maven /var/lib/jenkins/war/WEB-INF/lib/remoting-2.44.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.5.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 56445
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/workspace/BitCalculator/pom.xml -P sign clean deploy
java.lang.reflect.InvocationTargetException
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.launchStandard(Launcher.java:331)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
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 hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedClassVersionError: javax/inject/Provider : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:86)
... 22 more
channel stopped
[BitCalculator] $ /bin/sh -xe /tmp/hudson6524656470722686910.sh
+ rm 'target/*no_deps*'
rm: cannot remove 'target/*no_deps*': No such file or directory
Build step 'Execute shell' marked build as failure
ERROR: Failed to parse POMs
hudson.util.IOException2: java.lang.reflect.InvocationTargetException
at hudson.maven.Maven3Builder.call(Maven3Builder.java:178)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
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 hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
... 10 more
Caused by: java.lang.Exception: java.lang.reflect.InvocationTargetException
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:181)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
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.launchStandard(Launcher.java:331)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
... 15 more
Caused by: java.lang.UnsupportedClassVersionError: javax/inject/Provider : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:86)
... 22 more
Archiving artifacts
Sending e-mails to: antony#blazrsoft.com
Finished: FAILURE
This indicates that there's Java 7 interfering somewhere, but I'm not sure where.
The code is 1.6 compliant and most of the projects have no dependencies, so I'm not sure why this is happening. If I execute maven outside of Jenkins, the projects build just fine with JDK 6, so its leading me to think there's a misconfiguration in Jenkins somewhere, but I'm not sure where since everything seems to be as it should be. The paths to the JDKs are set properly in the global config and the projects themselves are set to use the specified JDK's. I apologize if its a duplicate question or something silly, but I've been trying to figure this out for days with no results. Everyone just says to check the paths and make sure there are no dependent artifacts built with a later JDK and I'm sure that this is not the problem.
$ mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-16)
Maven home: /usr/share/maven
Java version: 1.8.0_20, vendor: Oracle Corporation
Java home: /opt/java/8/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-openvz-042stab090.5-amd64", arch: "amd64", family: "unix"
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.6</source>
<target>1.6</target>
<compilerVersion>1.6</compilerVersion>
</configuration>
</plugin>
You have an old java version. For example in my case I´m compiling an old product so I have to keep the java deprecated version.
So the solution was to download a newest jdk and configure the JAVA_HOME in the slave.
http://lmarccdk12.ptx.fr.sopra:14000/computer//configure in the section Advanced/JavaPath=/root/jdk1.7.0_79/bin/java (that´s the version I chose)
You will see the following message in the slave launch log:
[SSH] Starting slave process: cd "/root" && /root/jdk1.7.0_79/bin/java -jar slave.jar
Your Jenkins job is of type "Maven project", and this job type has a limitation in that it cannot run a Maven build with a JDK version that is older than the Java version under which Jenkins is run.
Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming 2.361.1 LTS release, Jenkins requires Java 11 or newer. Therefore, you can no longer run Maven projects with JDKs 1.6, 1.7 and 1.8. The minimum version is now Java 11.
To resolve this, you may:
Create a Freestyle project and use Invoke top-level Maven targets to invoke Maven, or create a Jenkins Pipeline project. In both cases, using an older JDK will be possible.
Use JDK 11 but set source and target version to the older Java version. I haven't tried that though, and I believe this option may cause other trouble.
For further information, see also Jenkins requires Java 11 or newer and Maven Builds Fails After Upgrade

Categories

Resources