5 Replies Latest reply on May 1, 2006 4:29 PM by rsood72

    debugging using Jboss eclipse ide

    rsood72

      I have jboss application server running on my machine which deploys an .ear file. My clien is another java application that talks to this server.
      As a developer I needed to figure out how to be able to debug the deployed .ear from within eclipse so that I could see the values of member and local variables of ejbs, just as I am able to see the values of member and local variables of the client. I figured this out by implementing the following directions

      Sometimes you need to debug something running on another machine or outside of eclipse but you still want the handy debugging facilities of the IDE. This is very simple to do and requires only one small alteration to the jboss startup script.


      Edit the run.bat/run.sh file and uncomment the line "rem set JAVA_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%".
      Start Eclipse (I'm using ver 3.1 with JBoss IDE 1.5 M2) and open your workspace.
      Click on the Run--->Debug... menu.
      Select "Remote Java Application" in the left pane and then click new.
      Name the configuration, fill in the IP address and the port number (this must be the same as the one defined on the server, e.g. 8787 by default).
      Click apply but keep the window open.
      Start the JBoss Server (or restart it if it's already running). The server will block waiting for the connection from the remote client.
      Go back to the dialog box in eclipse and click Debug.
      and that's it!


      So basically I am having a remote connection to the server running on my machine and thus the server and client are using the same jvm. During debugging I noticed that I could easily see the values of variables that were the member varialbes of an ejb, but if any local variable was created like in a method ( on the stack ), I could not decipher its value or it was not resolvable. eg.
      Vector queryvalues = new Vector();

      if (userid != null)
      {
      if (!userid.equals(""))
      {
      queryvalues.addElement(new QueryValue("getSuserid", userid, "=="));
      }
      }
      In the above code I could see what userid contains since that is the member variable of the class from which the code was taken but I would not be able to inspect queryvalues since it was created locally.
      could anyone tell me how I would be able to inspect local variables when remote debugging a jboss server deployed ear.
      thank you