Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in Integrating jmx_prometheus_javaagent with Jboss #1000

Open
hemnath83 opened this issue Sep 18, 2024 · 3 comments
Open

Issue in Integrating jmx_prometheus_javaagent with Jboss #1000

hemnath83 opened this issue Sep 18, 2024 · 3 comments

Comments

@hemnath83
Copy link

We are running on Jboss EAP 7.2.0 and Java 1.8.
When i tried to integrate jmx_prometheus_javaagent with Jboss facing in loading class file of logger.

Could not load Logmanager "org.jboss.logmanager.LogManager"
java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)

However when I comment / remove jmx_prometheus_javaagent-0.17.1.jar then jboss is starting without issue and i checked the logs the class of logmanger is getting loaded properly without jmx agent config.

"JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
"JAVA_OPTS=%JAVA_OPTS% -javaagent:C:\T24\Area\Temenos\prometheus-2.54.1.windows-amd64\jmx_prometheus_javaagent-0.17.1.jar=8080:C:\T24\Area\Temenos\prometheus-2.54.1.windows-amd64\config.yaml"

@dhoard
Copy link
Collaborator

dhoard commented Sep 20, 2024

@hemnath83 This issue is caused because a JMX exporter uses Java logging but doesn't use the application's classpath.

You will need to modify the application classpath so that the jar(s) required to use org.jboss.logmanager.LogManager are available to the Java agent classloader.

Reference: #455

@hemnath83
Copy link
Author

hemnath83 commented Oct 8, 2024

Hi @dhoard ,

Thank you for your response.
Please note i tried to add to the classpath by explicitly adding -Xbootpath in my JVM args but still it did not work.
Im still getting the same error.

Below are my complete JVM arguments in startup for your reference.

set "JAVA_OPTS=-d64 -Xms6G -Xmx8G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=1G -Xss1024m"
rem "JAVA_OPTS=%JAVA_OPTS% -verbose:class"
set "JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.5.Final-redhat-00001.jar"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseG1GC -XX:-UseGCOverheadLimit -XX:+AggressiveOpts -XX:+UseLargePages -XX:G1ReservePercent=20"
rem # set "JAVA_OPTS=-d64 -Xms16G -Xmx16G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=1024M"
rem # If required context, we can anable the context for log&como for jboss
set "JAVA_OPTS=%JAVA_OPTS% -Dtafj.home=%TAFJ_HOME% -Dfile.encoding=UTF-8 -Dtemenos.log.context=browser -Djbc.debug=9797"
set "JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
set "JAVA_OPTS=%JAVA_OPTS% -verbose:class"
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:C:\\T24\\Area\\Temenos\\prometheus-2.54.1.windows-amd64\\jmx_prometheus_javaagent-0.17.1.jar=8080:C:\\T24\\Area\\Temenos\\prometheus-2.54.1.windows-amd64\\config.yaml"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=E:\\Dumps\\Dump_KJ"
set "JAVA_OPTS=%JAVA_OPTS% -verbose:gc -Xloggc:jboss.server.log.dir.gc_%p_%t.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:NumberOfGCLogFiles=10 -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M"

Update: formatting @dhoard

@dhoard
Copy link
Collaborator

dhoard commented Oct 22, 2024

@hemnath83 per #455 is looks like there are multiple jar files required for JBoss logging. You will need to find all jars required.

Can you either define an environment variable or Java system property to capture developer debug? This may provide more information.

environment variable

JMX_PROMETHEUS_EXPORTER_DEVELOPER_DEBUG=true

Java system property

jmx.prometheus.exporter.developer.debug=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants