title: Resolving a JDWP Error 502
body: <p>I am working on a JDI project and connecting it to a tomcat server. If I have a bug in my code that causes my project to fail, while attached to the tomcat server, I will start to get <code>com.sun.jdi.InternalException: Unexpected JDWP Error: 502</code> when invoking. The only way I have found to resolve this is restarting my JDI project and the tomcat server. Is there another method of resolving a JDWP code 502 programmatically? Based on the info in the below article, is it possible to terminate all previously invoked methods on a virtual machine after connecting to it? </p>
  
  <p>According to this article <a href="https://docs.oracle.com/javase/7/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_Error" rel="nofollow noreferrer">JDPW Error List</a> is defined as:</p>
  
  <p><code>ALREADY_INVOKING 502 Previous invoke not complete.</code>  </p>