Wildfly (formerly JBoss AS) will not start with Agent configured - Exception in thread "main" java.lang.NoClassDefFoundError: com/wily/introscope/agent/AgentShim

book

Article ID: 37730

calendar_today

Updated On:

Products

APP PERF MANAGEMENT CA Application Performance Management Agent (APM / Wily / Introscope) CUSTOMER EXPERIENCE MANAGER INTROSCOPE

Issue/Introduction

Problem: 

When starting Wildfly (formerly JBoss AS) with the APM agent configured the system fails to start correctly and the following error is thrown:

Exception in thread "main" java.lang.NoClassDefFoundError: com/wily/introscope/agent/AgentShim
at org.jboss.as.server.Main.main(Main.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 

Environment:  

APM 9.7 on Linux – but would affect other environments where Wildfly is supported

 

Cause: 

The APM classes are not being locatable by the classloader as by default the the Java property jboss.modules.system.pkgs is set to org.jboss.byteman

 

Resolution:

It is necessary to set the Java property jboss.modules.system.pkgs in the system start up settings to point to the agent class locations. This setting defines the classes which can be located by any classloader in the JVM.

If using the Domain version of the app server you can make this configuration change in the domain.xml by setting the agent startup settings in the main-server-group system-properties definitions i.e.

<server-groups>

        <server-group name="main-server-group" profile="full">

            <jvm name="default">

                <heap size="64m" max-size="512m"/>

            </jvm>

            <socket-binding-group ref="full-sockets"/>

            <deployments>

                <deployment name="QATestApp.ear" runtime-name="QATestApp.ear"/>

            </deployments>

            <system-properties>

                <property name="-Dcom.wily.introscope.agentProfile" value="/root/sw/wildfly-8.0.0.Final/wily/core/config/IntroscopeAgent.profile" boot-time="true"/>

                <property name="-Djboss.modules.system.pkgs" value="com.wily,com.wily.* ,org.jboss.byteman " boot-time="true"/>

                <property name="-javaagent" value="/root/sw/wildfly-8.0.0.Final/wily/Agent.jar" boot-time="true"/>

            </system-properties>

        </server-group>

        <server-group name="other-server-group" profile="full-ha">

            <jvm name="default">

                <heap size="64m" max-size="512m"/>

            </jvm>

            <socket-binding-group ref="full-ha-sockets"/>

        </server-group>

    </server-groups>

 

If using the standalone version of the application  server then this change must be made in the standalone.sh script – standalone.xml cannot be used as no child Java processes are spawned from the settings in that file.

Locate the section where the environment settings are displayed (# Display our environment )in the script and then insert the Agent configuration settings like in the following example

# for APM
JAVA_OPT1="-javaagent:/root/sw/wildfly-8.0.0.Final/wily/Agent.jar"
JAVA_OPT2="-Dcom.wily.introscope.agentProfile=/root/sw/wildfly-8.0.0.Final/wily/core/config/IntroscopeAgent.profile"
JAVA_OPT3="-Djboss.modules.system.pkgs=com.wily,com.wily.*
,org.jboss.byteman "
JAVA_OPTS="$JAVA_OPTS $JAVA_OPT1 $JAVA_OPT2 $JAVA_OPT3"

# Display our environment

echo "========================================================================="

 

Environment

Release: CEMUGD00200-9.7-Introscope to CA Application-Performance Management-Upgrade Main
Component: