Page 1 of 1
Debuggin SFS2x
Posted: 17 Aug 2011, 13:31
by joran200
I'm not getting how te debug a java extension, you need to create a .bat or smt, but this closes immediality.
i'm using netbeans ide 7.0.1
Any help with screenshots possible?
Posted: 17 Aug 2011, 13:34
by Lapo
Posted: 19 Sep 2011, 11:12
by rewb0rn
Hi,
I followed the instructions, I added the commands to my batch script and changed susped to "y". The server waits for the debugger (I use eclipse -> Remote Java Application on port 8787), and when I start the debugger via eclipse, the server continues booting.
Still the debugging does not work, breakpoints are ignored, etc. Any idea what I could be doing wrong?
Thanks
Posted: 19 Sep 2011, 11:32
by rewb0rn
My bad, there was a "hidden" instance of sfs running, after I restarted the sfs via the admin tool. The console was closed but the server still running in the background. Closing that instance the debugging works.
Re:
Posted: 30 Nov 2019, 18:40
by HTCraft
Re: Debuggin SFS2x
Posted: 02 Dec 2019, 11:08
by Lapo
This is a very old thread, created in 2011.
Since then we have reorganized the docs in several iterations. What you're looking for is here:
https://smartfoxserver.com/blog/how-to- ... xtensions/
Hope it helps
Re: Debuggin SFS2x
Posted: 11 Dec 2019, 08:33
by HTCraft
Have done all as described (
https://smartfoxserver.com/blog/how-to- ... xtensions/).
Unfortunately I cannot catch the breakpoints

They are skipped.
What I'm doing wrong?
Debug in Netbeans runs well (not stops), Unity runs well (all fuctions work), breakpoints in Visual Studio work, but breakpoints in Netbeans are ignored.
What ideas?
Re: Debuggin SFS2x
Posted: 11 Dec 2019, 09:41
by Lapo
Does the debugger connect successfully to the remote process?
Thanks
Re: Debuggin SFS2x
Posted: 11 Dec 2019, 11:47
by HTCraft
Lapo wrote:Does the debugger connect successfully to the remote process?
1. Stop SFS service and start sfs2x.bat
Netbeans:
2. Click "Debug / Attach debugger..."
3. Choose "Java Debugger (JPDA)" and "Ok". Tried all options - no effect.
4. Debug still running.
5. Breakpoints don't work.
Re: Debuggin SFS2x
Posted: 11 Dec 2019, 17:48
by Lapo
Ok, but I am still not sure whether or not your Netbeans is actually connected to the server.
If you switch to the debug view, can you see the active threads, for example? If so the debug session is active which is a good sign. Also there should be a window showing the active breakpoints.
Unfortunately I am not a NetBeans expert as I've used Eclipse for most of the SFS2X work, but they should work very similarly.
Thanks
Re: Debuggin SFS2x
Posted: 11 Dec 2019, 18:07
by HTCraft
Thanks Lapo,
I've found some errors in SFS log and I'll investigate this issues... Hope it will help me

Re: Debuggin SFS2x
Posted: 11 Dec 2019, 18:34
by HTCraft
Do I understand correct that method
init() starts first when extension runs?
Will be catched breakpoint at
lac = new LoginAssistantComponent(this);
?
Code: Select all
public class LoginController extends SFSExtension{
private LoginAssistantComponent lac;
private final Logger log = LoggerFactory.getLogger(LoginController.class);
@Override
public void init() {
if (log.isDebugEnabled())
log.debug("This message will show only if in DEBUG mode.");
lac = new LoginAssistantComponent(this);
lac.getConfig().loginTable = "users";
lac.getConfig().passwordField = "pword";
lac.getConfig().userNameField = "login";
Re: Debuggin SFS2x
Posted: 12 Dec 2019, 08:27
by Lapo
The init() method is called when the Extension is started.
If the Ext. is attached to a Zone it will be called when the server is booting up, as each Zone and relative Extension is loaded.
If it's a Room Ext it will be called when the Room is created.
Hope it helps
Re: Debuggin SFS2x
Posted: 13 Dec 2019, 08:48
by HTCraft
Code in Ext called successfuly (user is created, e-mail is sent e.t.c.) but I cannot catch process at breakpoints.
In the Netbeans I see the running threads.
Thanks for help.
Will think again.