new to remote debugging (JPDA) and need help

Hi,

I am trying to set up remote debugging on the system I am developing. I am using JBuilder9, Swing as client, EJBs on back end, and Sun One Application Server.

I have installed the JPDA remote debugger on the server. remotedebugger.bat and remotedebugger.jar are both in the directory c:\JBuilder_JPDA and I have started up the debugger. When I set up the debug configuration in JBuilder I add

c:\JBuilder_JPDA ....in the remote directory

c:\Sun\AppServer7\domains\domain1\experimental\applications\j2ee-modules\BEAKER_1.... in the remote classpath

(as explained in the JBuilder help)

Running the debug task, it has no problem finding the debugger (c:\JBuilder_JPDA) but has problems (I think) with the remote classpath given throwing this classNotFoundException :

c:\jdk1.3.1_01\bin\java -classpath "c:\Sun\AppServer7\domains\domain1\experimental\applications\j2ee-modules\BEAKER_1;c:\JBuilder_JPDA\debugserver.jar" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=2181,server=y,suspend=y com.standardandpoors.beaker.client.Application

Hit uncaught exception java.lang.ClassNotFoundException

My application is called BEAKER, and BEAKER_1 is where I have my j2ee module. That is, after this directory my packages start - ..\BEAKER_1\com\mycompany\ etc....

Is this the correct way to do this?

According to JBuilder help the remote classpath is where...

"The classpath where the compiled .class files for the application that you are remotely debugging can be found. This field works like other classpath fields齣f the classes are in a package, specify the root of the package and not the directory containing the classes."

I think I just need to specify the remote classpath correctly and I should be right. But what am I doing wrong?

Olly

[1861 byte] By [oliver_watkinsa] at [2007-9-30 1:53:41]
# 1

> Hi,

Hello

You wrote:

> Running the debug task, it has no problem finding the

> debugger (c:\JBuilder_JPDA) but has problems (I think)

> with the remote classpath given throwing this

> classNotFoundException :

>

> c:\jdk1.3.1_01\bin\java -classpath

> "c:\Sun\AppServer7\domains\domain1\experimental\applica

> ions\j2ee-modules\BEAKER_1;c:\JBuilder_JPDA\debugserver

> jar" -Xdebug -Xnoagent -Djava.compiler=NONE

> -Xrunjdwp:transport=dt_socket,address=2181,server=y,sus

> end=y com.standardandpoors.beaker.client.Application

> Hit uncaught exception

> java.lang.ClassNotFoundException

Does this work for you if you try running without the debug

parameters "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:..."

Get the command working in normal mode (without the debug

flags) first, then try adding in the debug flags.

Hope this helps.

debugging_teama at 2007-7-16 13:04:13 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2

Hi debug team,

>Does this work for you if you try running without the debug

>parameters "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:..."

>Get the command working in normal mode (without the debug

>flags) first, then try adding in the debug flags.

I am trying to run from the CMD line.

(1) without parameters

java -classpath "c:\Sun\AppServer7\domains\domain1\experimental\applicaions\j2ee-modules\BEAKER_1;c:\JBuilder_JPDA\debugserver.jar"

this does nothing. Says it is an incorrect java cmd ... "Usage: java [-options] class.... etc"

(2) with parameters

java -classpath "c:\Sun\AppServer7\domains\domain1\experimental\applicaions\j2ee-modules\BEAKER_1;c:\JBuilder_JPDA\debugserver.jar" -Xdebug -Xnoagent -Djava.compiler=NONE

-Xrunjdwp:transport=dt_socket,address=2181,server=y,suspend=y com.standardandpoors.beaker.client.Application

just hangs on the cmd line.

... not sure ...

Olly

Hope this helps

oliver_watkinsa at 2007-7-16 13:04:13 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 3

For option 1), you need to add the name of the main class you want to run at the end

of the command line.

For option 2), you specified 'server=y,suspend=y' This means the debugee VM is

expecting a debugger to attach to it (server=y) and that you want the debugee

VM to pause at start up,before entering the main class (suspend=y).

In this case, you should be able to attach a debugger to socket 2181 and start

debugging. Using jdb as an example, the command line would look like this:

jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=2181

Once jdb is connected, you will be able to (for example) list threads, set

breakpoints, etc..., and then enter 'resume' to have the debugee continue to

start up and run.

debugging_teama at 2007-7-16 13:04:13 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 4

OK I think I understand a bit better what the problem is.

ok, it can't find the Application.java file which I specified in the Run | Runtime Configurations Properties.

Exception in thread "main" java.lang.NoClassDefFoundError: com/standardandpoors/

beaker/client/Application

Now the problem is that this class exists on the client, but does not exist on the server.

What should I have in the RUN tab so that it understands what I should run on the client? And if the class referred to in the RUN tab should be a class on the server.... what class should be referred?

I just can't seem to get my head around how the debugger can somehow work out what's going on when you are dealing with EJBs....

thanks for your help...

Oliver

> For option 1), you need to add the name of the main

> class you want to run at the end

> of the command line.

>

> For option 2), you specified 'server=y,suspend=y'

> This means the debugee VM is

> expecting a debugger to attach to it (server=y) and

> that you want the debugee

> VM to pause at start up,before entering the main class

> (suspend=y).

>

> In this case, you should be able to attach a debugger

> to socket 2181 and start

> debugging. Using jdb as an example, the command line

> would look like this:

>

> jdb -connect

> com.sun.jdi.SocketAttach:hostname=localhost,port=2181[/

> ]

>

> Once jdb is connected, you will be able to (for

> example) list threads, set

> breakpoints, etc..., and then enter 'resume' to have

> the debugee continue to

> start up and run.

oliver_watkinsa at 2007-7-16 13:04:13 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 5

I would recommend using the "attach" style of remote debugging with JBuilder and App Server 7.

You will need to start your app server instance in debug mode. You can read about that at:

http://docs.sun.com/source/816-7156-10/agsvrprf.html#1022517

and

http://docs.sun.com/source/816-7149-10/dgdebug.html#25712

You can read about attaching with JBuilder at

http://info.borland.com/techpubs/jbuilder/jbuilder9/bajb/distdebugging.html#attach_to_running_program

Note: although these docs are for JBuilder 9, this JBuilder feature has been implemented about this way for a while. I think I read content similar all the way back in JBuilder 5 timeframe.

You will need to create a project that holds your EJBs code.

vbk

vkraemera at 2007-7-16 13:04:13 > top of Java-index,Archived Forums,Debugging Tools and Techniques...