How to debug server side java extension by using Eclipse

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

gopala.susurla
Posts: 31
Joined: 15 May 2011, 16:09
Contact:

How to debug server side java extension by using Eclipse

Postby gopala.susurla » 07 Jun 2011, 05:38

Hi All,

I have tried to debugging with help of view topics,but I noticed that there is SFSPro we can use bebugging but we can not use SFS2x.So please help me out of this.I need to debug my sever side code i.e java through the eclipse by using Smartfoxserver2x version not SmartfoxserverPro.

Regards,
Gopala Susurla
GopalaSusurla
mka
Posts: 15
Joined: 31 Jan 2011, 02:43

Postby mka » 07 Jun 2011, 23:18

Checkout http://docs2x.smartfoxserver.com/GettingStarted/howtos#item6.

In eclipse simply use "Remote Java Application" in the "Debug Configurations" dialog and setup your remote app to use the port you have configured in the extra debug parameters in your sfs2x.bat.
gopala.susurla
Posts: 31
Joined: 15 May 2011, 16:09
Contact:

HI Mka

Postby gopala.susurla » 08 Jun 2011, 05:39

Hi Mka,

Thanks for given support.But I need to debugging through my Eclipse.Is there any chance to debugging while application running.Please help me this.

Regards,
Gopala
GopalaSusurla
mka
Posts: 15
Joined: 31 Jan 2011, 02:43

Postby mka » 08 Jun 2011, 05:46

What I have described does exactly what you want. You start smartfox with the extra debug parameters, then register it in eclipse as remote java app. Then you can put breakpoints into your code within eclipse and see what happens.
You might also need to go into the Source tab in the remote app debug config and add your projects.

I've been doing it and it worked for me :-)
gopala.susurla
Posts: 31
Joined: 15 May 2011, 16:09
Contact:

Connection problem

Postby gopala.susurla » 08 Jun 2011, 09:36

Hi MKA,

When I connected my java extension code into debugging I got "Failed to connect to remote VM. Connection timed out.org.eclipse.jdi.TimeoutException" this exception.Please let me know step by step what u did.
GopalaSusurla
mka
Posts: 15
Joined: 31 Jan 2011, 02:43

Postby mka » 08 Jun 2011, 20:59

Make sure the port you configure as debug parameter on smartfox matches the port you configure in your remote app in eclipse.

Eclipse uses port 8000 as default. The example uses 8787. So you either have to set eclipse to 8787 or smartfox to 8000. Also the host in eclipse needs to match the host you are running smartfox on.
gopala.susurla
Posts: 31
Joined: 15 May 2011, 16:09
Contact:

Problem when I run debug mode

Postby gopala.susurla » 15 Jun 2011, 02:32

Hi MKA,

Again I faced problem when I run my remote apps through debug mode.
"Failed to connect to remote VM
com.sun.jdi.connect.spi.ClosedConnectionException".

Please make me help for this

Regards,
Gopala
GopalaSusurla
gabrielt
Posts: 2
Joined: 25 May 2011, 19:26

Postby gabrielt » 23 Jun 2011, 16:18

Hi Gopala,

I just encountered same issue but I fixed it thanks to MKA.

So, just try to create another ".bat" script (for example: sfs2x-debug.bat) where you can have the following:

@java -cp "./;lib/*;lib/Jetty/*;extensions/__lib__/*" -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main $1 $2 $3

Then, run "sfs2x-debug.bat" instead of SFS running standalone or "by service".

In the end, simply setting on Eclipse -> Debug Configurations -> Remote Java Application of: Project (the one you are working), SFS IP machine (as host) and 8787 (as port) should be fixing that.
gopala.susurla
Posts: 31
Joined: 15 May 2011, 16:09
Contact:

Thanks for supporting

Postby gopala.susurla » 24 Jun 2011, 02:24

Hi All,

Thanks a lot MKA & Gabrielt


Regards.
Gopala
GopalaSusurla
Angélique
Posts: 10
Joined: 11 Jul 2011, 20:58

Postby Angélique » 13 Jan 2012, 23:14

Hi, I use server version 2.0.0-RC1 and there's no JVM settings tab in the Server Configurator module of the admin...

Do you think you could help me set up the remote debug ?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 14 Jan 2012, 13:42

Hi. Please update to SFS2x RC3, that's the latest one
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Alexwek and 59 guests