[1.2.4]debug in eclipse doesn't work

2,546 views
Skip to first unread message

sajan

unread,
Mar 7, 2012, 9:59:20 AM3/7/12
to play-framework
As per Guillaume's reply in this post(http://groups.google.com/group/
play-framework/browse_thread/thread/21f5beb3038037/34f88f6f49d7f889),I
tried to debug my application in eclipse.(It was imported after
running play eclipsify ).

I selected the eclipse/myapp.launch and clicked RunAs myapp.This
caused the following output as expected

Listening for transport dt_socket at address: 8000
....
20:13:14,490 WARN ~ You're running Play! in DEV mode
20:13:14,594 INFO ~ Listening for HTTP on port 9000 (Waiting a first
request to start) ...

So far so good ,I am able to access my app in the browser at
http://127.0.0.1:9000/.

Then I selected the "eclipse/Connect JPDA to myapp.launch" using
DebugAs ,and clicked 'Connect JPDA to myapp'.

The statusbar in eclipseframe shows a message 'Connect JPDA to
myapp.launch -myapp/eclipse'

Nothing else happens now.

I tried selecting the application ie myapp ,and selected DebugAs Java
Application.This brought up a list our main types,from which I
selected play.Server.

This caused the following error message in a box,
'Cannot connect to VM,Socket is closed'

and a more detailed error message in eclipse console,

ERROR: Cannot load this JVM TI agent twice, check your java command
line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp

Any idea why this happens? Am I doing the steps in the wrong order?






Pascal Voitot Dev

unread,
Mar 7, 2012, 10:08:30 AM3/7/12
to play-fr...@googlegroups.com
are you sure your eclipse remote debug uses port 8000 by default?

pascal







--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.


Bogdan Tanase

unread,
Mar 7, 2012, 10:17:01 AM3/7/12
to play-fr...@googlegroups.com
This is what works for me:

1) Start play application from eclipse, as usual using run configuration
2) Connect to JPDA by right clicking myapp.launch -> Debug As, Connect to JPDA..
3) Put your breakpoints
4) Refresh :)

Bogdan Tanase

unread,
Mar 7, 2012, 10:20:46 AM3/7/12
to play-fr...@googlegroups.com
One more thing. It's best if you connect to jpda before the first
request, otherwise the breakpoints might not work.

sajan

unread,
Mar 7, 2012, 10:40:24 AM3/7/12
to play-framework
Pascal,
Eclipse debug configs show this

under Remote java Applications:
Connect JPDA to myapp
host:localhost
port:8000

Debug config for the java Applications

myapp has the vm arguments
Dplay.debug=yes -Dplay.id= -Dapplication.path="$
{project_loc:myapp}" ..


On Mar 7, 8:08 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:

sajan

unread,
Mar 7, 2012, 10:44:42 AM3/7/12
to play-framework
Bogdan,
I tried to connect jpda using DebugAs..but nothing happens

Pascal Voitot Dev

unread,
Mar 7, 2012, 10:45:48 AM3/7/12
to play-fr...@googlegroups.com
"ERROR: Cannot load this JVM TI agent twice, check your java command
line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp"

Can you try running play outside Eclipse (which I always do) and connect in remote debug from Eclipse?

Pascal

sajan

unread,
Mar 7, 2012, 12:41:49 PM3/7/12
to play-framework
In terminal>play run
Listening for transport dt_socket at address: 8000
...
22:59:08,125 WARN ~ You're running Play! in DEV mode
22:59:08,220 INFO ~ Listening for HTTP on port 9000 (Waiting a first
request to start) ...

In Eclipse ,selecting Connect JPDA...launch with DebugAs Connect JPDA
to myapp

Nothing happens for a long time..
trying to select the above again using DebugAs causes
'Failed to connect to remote VM. Connection refused.' error.

An interesting thing, when I stopped play using Ctrl-C and restarted
it ,I got this terminal output

'JPDA port 8000 is already used. Will try to use any free port for
debugging.
Listening for transport dt_socket at address: 50660
...
23:04:37,508 WARN ~ You're running Play! in DEV mode
23:04:37,598 INFO ~ Listening for HTTP on port 9000 (Waiting a first
request to start)

So,port 8000 seems to be used by jpda..Still the debug window wouldn't
come up



Failed to connect to remote VM. Connection refused.
Connection refused

On Mar 7, 8:45 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:

Pascal Voitot Dev

unread,
Mar 7, 2012, 12:52:15 PM3/7/12
to play-fr...@googlegroups.com
On Wed, Mar 7, 2012 at 6:41 PM, sajan <sajan...@gmail.com> wrote:
In terminal>play run
Listening for transport dt_socket at address: 8000
...

this says that play listens for debug on port 8000
 
22:59:08,125 WARN  ~ You're running Play! in DEV mode
22:59:08,220 INFO  ~ Listening for HTTP on port 9000 (Waiting a first
request to start) ...


this is the classic 9000 port for web
 
In Eclipse ,selecting Connect JPDA...launch with DebugAs Connect JPDA
to myapp

Nothing happens for a long time..


what does it mean? is the debugger connected or not? When the debugger is connected, it doesn't do anything until you launch a request and you created a breakpoint
 
 
 trying to select the above again using DebugAs causes
'Failed to connect to remote VM. Connection refused.' error.

this means you have something connected on port 8000 already (certainly the previous debugger)
 

An interesting thing, when I stopped play using Ctrl-C and restarted
it ,I got this terminal output

'JPDA port 8000 is already used. Will try to use any free port for
debugging.
Listening for transport dt_socket at address: 50660
...

This certainly means, you closed your server brutally and that the client which was connected to port 8000 hasn't disconnected properly so you gat an idle connection waiting for timeout. After something like 1min or 2 min, you should be able to relaunch play on port 8000
 
23:04:37,508 WARN  ~ You're running Play! in DEV mode
23:04:37,598 INFO  ~ Listening for HTTP on port 9000 (Waiting a first
request to start)

So,port 8000 seems to be used by jpda..Still the debug window wouldn't
come up



Failed to connect to remote VM. Connection refused.
Connection refused

On Mar 7, 8:45 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:

> Can you try running play outside Eclipse (which I always do) and connect in remote debug from Eclipse?

sajan

unread,
Mar 7, 2012, 1:17:43 PM3/7/12
to play-framework
Ok..thanks Pascal, I was assuming that the debug window would come up
before I start a request in the web browser..

Now it is working without any problems..

Thanks for the help..sorry for wasting everyones' time
Reply all
Reply to author
Forward
0 new messages