2 Replies Latest reply on Feb 6, 2014 12:40 AM by Divya Ahuja

    Configuring javaagent in jboss AS 7

    Divya Ahuja Newbie

      Hi,

       

      I need to confgure a java agent(monitoring the performance using asm.jar) for my application which is deployed on jboss AS 7. I configured the java agent by doing below setting:-

      1. in the domain.conf.bat:-  set "JAVA_OPTS=%JAVA_OPTS% -javaagent:C:/app_monitor.jar=C:/app-monitor.properties"

      or

      2. in the host.xml , as part of jvm option in the 'server' section of my application running server.

      <jvm name="default">

                      <jvm-options>
                          option value="-javaagent:C:/app_monitor.jar=C:/app-monitor.properties"/>

                     </jvm-options>

      </jvm>

       

      When i start jboss using domain.bat after above configuration i am getting follwoing error:-

      Error:-

      [Server:ibpm-server] java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor

      [Server:ibpm-server]    at java.lang.Class.getDeclaredMethods0(Native Method)

      [Server:ibpm-server]    at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)

      [Server:ibpm-server]    at java.lang.Class.getDeclaredMethod(Class.java:2002)

      [Server:ibpm-server]    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)

      [Server:ibpm-server] FATAL ERROR in native method: processing of -javaagent failed

      [Server:ibpm-server]    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)

      [Server:ibpm-server] Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor

      [Server:ibpm-server]    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

      [Server:ibpm-server]    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

      [Server:ibpm-server]    at java.security.AccessController.doPrivileged(Native Method)

      [Server:ibpm-server]    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

      [Server:ibpm-server]    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

      [Server:ibpm-server]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

      [Server:ibpm-server]    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

      [Server:ibpm-server]    ... 5 more

      [Server:ibpm-server] Exception in thread "main"

       

      In Jboss AS 7 asm.jar included as a module(asm-3.3.1-redhat-4.jar). Can anyone tell me why this error occurs. I tried many option like: adding the 'asm-3.3.1-redhat-4.jar' under system classpath, as part of 'app_monitor.jar' in the MANIFEST_MF file. etc. Still the above error occurs. Only solution to this error was to endorse the ''asm-3.3.1-redhat-4.jar''(add this jar to JDK/jre/lib/ext folder).

       

      Earlier on jboss eap 5.1, 'asm-3.3.jar' file was being used. On jboss As 7 we tried to deploy the ''asm-3.3.jar'' as a modeule but still above error. Let me know why this issue occur and whats the correct way to resolve this issue(as endording the jar is not a correct approach).

       

      Second issue:-

      After endorsing the ''asm-3.3.jar'' , domain.bat sucessfully started.But i was unable to start my application.'NoClass DefFoundError' was logged in the server.log file of jboss. It seems like my application classes are not available to the java agent. Need solution to this issue too.

       

      Regards,

      Divya