Debuggin SFS2x

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

Moderators: Lapo, Bax

Post Reply
joran200
Posts: 1
Joined: 17 Aug 2011, 13:22

Debuggin SFS2x

Post 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?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
rewb0rn
Posts: 177
Joined: 26 Jan 2009, 12:54
Location: Berlin, Germany

Post 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
User avatar
rewb0rn
Posts: 177
Joined: 26 Jan 2009, 12:54
Location: Berlin, Germany

Post 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.
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re:

Post by HTCraft »

This link doesn't work.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Debuggin SFS2x

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: Debuggin SFS2x

Post 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?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Debuggin SFS2x

Post by Lapo »

Does the debugger connect successfully to the remote process?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: Debuggin SFS2x

Post 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.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Debuggin SFS2x

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: Debuggin SFS2x

Post by HTCraft »

Thanks Lapo,
I've found some errors in SFS log and I'll investigate this issues... Hope it will help me :)
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: Debuggin SFS2x

Post 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";
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Debuggin SFS2x

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: Debuggin SFS2x

Post 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.
Post Reply