title: Javassist java.lang.NoClassDefFoundError
body: <p>I want to instrument a library method to call one of my Class present in javassist agent.</p>
  
  <p>Lets say I have a class:</p>
  
  <pre><code>Class A {
  
      void display() {
          System.out.println("Inside A.dipslay()");
      }
  }
  </code></pre>
  
  <p>then when I invoke:</p>
  
  <pre><code>method.insertAfter("packageName.A.display()");
  </code></pre>
  
  <p>it throws the exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: packageName/A
      at java.net.HttpURLConnection.setRequestMethod(libraryClass)
      at sun.net.www.protocol.http.HttpURLConnection.setRequestMethod(libraryClass)
      at com.avekshaa.app.SecurityFilter.sendGet(Class where i call the Library Class)
      at com.avekshaa.app.SecurityFilter.main(Class where i call the Library Class)
  </code></pre>
  
  <p>And when I call it just by name:</p>
  
  <pre><code>method.insertAfter("A.display()");
  </code></pre>
  
  <p>then it gives a No such class found Exception.</p>