title: Profiling a webapp on JBoss 7 with JVisualVM
body: <p>I would like to profile my webapp with JVisualVM on JBoss 7.</p>
  
  <p>So I launch that tool, and open the JVM running JBoss.</p>
  
  <p>I click on "Profiler", "Settings" and in "CPU settings" I put that :</p>
  
  <ul>
  <li><p>"Start profiling from classes:" : com.mycompany.myapp.action.**</p></li>
  <li><p>Profile new Runnables</p></li>
  <li><p>"Profile only classes:" : com.mycompany.*</p></li>
  </ul>
  
  <p>And when I click on "CPU" (to profile CPU), in JBoss I've got :</p>
  
  <pre><code>Profiler Agent: 250 classes cached.
  Profiler Agent: Redefining 100 classes at idx 0, out of total 188 
  Profiler Agent: Redefining 88 classes at idx 100, out of total 188 
  10:26:05,720 ERROR [stderr] (server-timer1) Exception in thread "server-timer1" java.lang.NoClassDefFoundError: org/netbeans/lib/profiler/server/ProfilerRuntimeCPUFullInstr
  10:26:05,721 ERROR [stderr] (server-timer1)     at org.jboss.sun.net.httpserver.ServerImpl$ServerTimerTask1.run(ServerImpl.java:895)
  10:26:05,722 ERROR [stderr] (server-timer1)     at java.util.TimerThread.mainLoop(Timer.java:534)
  10:26:05,722 ERROR [stderr] (server-timer1)     at java.util.TimerThread.run(Timer.java:484)
  </code></pre>
  
  <p>By googling, it seems I must <a href="http://i-proving.com/2011/07/07/how-to-get-visualvm-to-profile-jboss-without-crashing/" rel="noreferrer">add <code>jfluid-server.jar</code></a> in the JBoss classpath but when I do that with Eclipse, the jar disappears before I re-launch the server...</p>
  
  <p>Others advice to <a href="https://community.jboss.org/message/766276" rel="noreferrer">launch VisualVM with a classpath containing JBoss modules' jar</a>, but I still have the errors in the JBoss AS.</p>
  
  <p>Is there a configuration in <code>standalone.xml</code> in order to add that jar to JBoss 7 classpath ?</p>
  
  <p>Thanks !</p>