jboss hello world fails to start
FROM registry.access.redhat.com/jboss-eap-7/eap71-openshift
COPY HelloWorld.war $JBOSS_HOME/standalone/deployments/
USER root
RUN chown jboss:jboss $JBOSS_HOME/standalone/deployments/HelloWorld.war
RUN mkdir -p /app/grafana-alloy/ && \
curl -L -o /app/grafana-alloy/pyroscope.jar \
https://github.com/grafana/pyroscope-java/releases/download/v0.14.0/pyroscope.jar
RUN chown -R jboss:jboss /app/grafana-alloy/
USER jboss
ENV JAVA_OPTS="-javaagent:/app/grafana-alloy/pyroscope.jar -Dpyroscope.application.name=test"
With the following error
➜ jboss docker run --rm -ti -p 8080:8080 -p 9990:9990 hui
WARN No password defined for JGroups cluster. AUTH protocol will be disabled. Please define JGROUPS_CLUSTER_PASSWORD.
WARN Environment variable OPENSHIFT_KUBE_PING_NAMESPACE undefined. Clustering will be unavailable. Please refer to the documentation for configuration.
INFO Configuring JGroups discovery protocol to openshift.KUBE_PING
INFO Configuring JGroups cluster traffic encryption protocol to SYM_ENCRYPT.
WARN Detected missing JGroups encryption configuration, the communication within the cluster WILL NOT be encrypted.
Using PicketBox SSL configuration.
WARN Missing SSO_URL. Unable to properly configure SSO-enabled applications
INFO Access log is disabled, ignoring configuration.
INFO Running jboss-eap-7/eap71-openshift image, version 1.4
JAVA_OPTS already set in environment; overriding default settings with values: -javaagent:/app/grafana-alloy/pyroscope.jar -Dpyroscope.application.name=test
-XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/eap
JAVA: /usr/lib/jvm/java-1.8.0/bin/java
JAVA_OPTS: -server -verbose:gc -Xloggc:"/opt/eap/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -javaagent:/app/grafana-alloy/pyroscope.jar -Dpyroscope.application.name=test -javaagent:/opt/jboss/container/jolokia/jolokia.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -Xbootclasspath/p:/opt/eap/jboss-modules.jar:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.1.6.CP/org/jboss/logmanager/main/jboss-logmanager-2.0.11.Final-redhat-00001.jar:/opt/eap/modules/system/layers/base/org/jboss/logmanager/ext/main/javax.json-1.0.4.jar:/opt/eap/modules/system/layers/base/org/jboss/logmanager/ext/main/jboss-logmanager-ext-1.0.0.Alpha5-redhat-1.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=256m -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom
=========================================================================
2024-08-15 16:29:35.653 [WARN] PYROSCOPE_SERVER_ADDRESS is not defined, using http://localhost:4040
2024-08-15 16:29:35.735 [DEBUG] Config: Config{agentEnabled=true, applicationName='test', profilingInterval=PT0.01S, profilingEvent=ITIMER, profilingAlloc='', profilingLock='', samplingEventOrder='null', uploadInterval=PT10S, javaStackDepthMax=2048, logLevel=INFO, serverAddress='http://localhost:4040', authToken='null', timeseriesName='test', timeseries=test, format=JFR, pushQueueCapacity=8, labels={}, ingestMaxTries=8, compressionLevelJFR=1, compressionLevelLabels=1, allocLive=false, httpHeaders={}, samplingDuration=null, tenantID=null}
[WARN] Install JVM debug symbols to improve profile accuracy
2024-08-15 16:29:36.116 [INFO] Profiling started
I> No access restrictor found, access to any MBean is allowed
Jolokia: Agent started with URL https://172.17.0.2:8778/jolokia/
16:29:36,362 INFO [org.jboss.modules] (main) JBoss Modules version 1.6.7.Final-redhat-00001
java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
at org.jboss.as.server.Main.main(Main.java:88)
at org.jboss.modules.Module.run(Module.java:341)
at org.jboss.modules.Main.main(Main.java:525)
16:29:36,513 FATAL [org.jboss.as.server] (main) WFLYSRV0239: Aborting with exit code 1
I solved this by moving the javaagent parameter from JAVA_OPTS (or in my case: JAVA_TOOL_OPTIONS) to MODULE_OPTS:
ENV PYROSCOPE_APPLICATION_NAME="test"
ENV MODULE_OPTS="-javaagent:/app/grafana-alloy/pyroscope.jar"
see also https://www.wildfly.org/news/2020/10/13/WildFly21-Final-Released/ and https://docs.wildfly.org/wildfly-proposals/core/WFCORE-4748-expose-module-options.html
Hello, I have a similar issue but I still can't solve it.
I have another instance running Pyroscope and I want to send the Wildfly info into this server. I added the following configuration to my standalone.conf:
MODULE_OPTS="-javaagent:/opt/wildfly/standalone/deployments/ERPWeb.war/WEB-INF/lib/pyroscope.jar=serverAddress=http://${privatePyroscopeIP}:4040,applicationName=wildfly"
But when I start my Wildfly service, Pyroscope still tries to send the profiling info into localhost, meaning that it hasn't correctly registered the serverAddress variable.
Can anyone help me with this? It's the last step that I need to autoinstrument my Java app.
Thanks!