What is the correct way to use JFR API in my application running on Wildfly ?

74 views
Skip to first unread message

Olivier Masseau

unread,
Jun 14, 2023, 12:51:55 PM6/14/23
to WildFly
Hello,

I'm running a web app on Wildfly 23 (using Java 11).

I need to use the JFR API to be able to start and stop JFR recordings directly from my application.
The problem is that I get ClassNotFoundExceptions when starting my app as JFR API classes cannot be found.

Searching around I've found multiple solutions but I don't know which one is the right one.

I've seen people saying to add this in the <dependencies> of jboss-deployment-structure.xml :
<system export="true">
<paths>
<path name="com/sun/management"/>
<path name="jdk/jfr"/>
<path name="jdk/management/jfr"/>
</paths>
</system>

Others saying to add this :
                        <module name="jdk.jfr"/>

Which way is the recommended one ?

What is the difference between Wildfly "jdk.jfr" module and system modules "jdk/jfr", "jdk/management/jfr", ... provided by the Java runtime ?

Why does Wildfy has a "jdk.jfr" module if the "jdk.jfr" module is already provided by Java runtime ?

Which one should I use ?



Richard Opalka

unread,
Jun 15, 2023, 4:10:05 AM6/15/23
to Olivier Masseau, WildFly
Hello Olivier,

   The correct approach is to reference it via <module name="jdk.jfr"/>
That is because JBoss Modules 1.11.0.Final version already contains integration with the Java JPMS system.

Richard

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/ac7bc357-c0ec-43cf-b5bf-72f71b64e78fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages