dev@glassfish.java.net

Re: Debugging Glassfish itself

From: Stijn de Witt <StijnDeWitt_at_chello.nl>
Date: Tue, 4 May 2010 20:51:03 +0200

Ok, I found some instructions on the net ( http://forums.java.net/jive/thread.jspa?messageID=374821&#374821 ) which tell me that in Eclipse I should set host (localhost) and port (9009) and just press debug.

Now if I start Glassfish using the plugin and then try this it tells me that it can't connect: Connection refused. If I start Glassfish from the commandline with this command:

>asadmin start-domain --debug

It looks like it's working:

Waiting for DAS to start ..........
Started domain: domain1
Domain location: C:\Program Files\Glassfish\glassfish-v3-web\glassfish\domains\domain1
Log file: C:\Program Files\Glassfish\glassfish-v3-web\glassfish\domains\domain1\logs\server.log
Admin port for the domain: 4848
Debug port for the domain: 9009
Command start-domain executed successfully.

In Eclipse's Debug perspective I now see a stack-like thing that I feel must be Glassfish... So it seems I made some progress! Woohoo!

This is what I see:

[-] Glassfish [Remote Java Application]
      [-] Java Hotspot(TM) Client VM[localhost:9009]
            [-] Daemon Thread [SCR Component Actor] (running)
            [-] Daemon Thread [{felix.fileinstall.poll=5000....}] (running)
            [-] Daemon Thread [Configuration Updater] (running)
            [-] Daemon Thread [telnetconsole.listener] (running)
            [-] Daemon Thread [Glassfish Kernel Main Thread] (running)
            [-] Daemon Thread [AutoDeployer] (running)
            [-] Daemon Thread [DynamicReloader] (running)
            [-] Daemon Thread [ping] (running)
            [-] Daemon Thread [ContainerBackgroundProcessor[StandardEngine...StandardContext[/mycontext]]] (running)
            [-] Daemon Thread [p: thread-pool-1 ;w:2] (running)
            [-] Daemon Thread [p: thread-pool-1 ;w:1] (running)
            [-] Daemon Thread [ContainerBackgroundProcessor[StandardEngine]] (running)
            [-] Daemon Thread [ContainerBackgroundProcessor[StandardEngine...StandardContext[/]]] (running)
            [-] Daemon Thread [Timer-0] (running)
            [-] Daemon Thread [TransactionManager] (running)
            [-] Daemon Thread [Thread-16] (running)
            [-] Daemon Thread [Thread-14] (running)
            [-] Daemon Thread [ many threads.. skipped ] (running)
            [-] Daemon Thread [pool-2-thread-1 ] (running)
            [-] Daemon Thread [FelixPackageAdmin] (running)
            [-] Thread [FelixStartLevel] (running)
            [-] Thread [FelixDispatchQueue] (running)
            [-] Thread [DestroyJavaVM] (running)
            [-] Thread [OSGi Framework Launcher] (running)
            [-] Daemon Thread [{felix.fileinstall.poll=5000....}] (running)

I would like to start debugging at the incoming request to my secured page that will lead to the JAAS login page and eventually the JDBCLoginModule and JDBCRealm... Any idea how I can set a breakpoint and attach soure?

I can set the source on the global level and I made this point to the trunk/v3/ folder that I downloaded from SVN... but from here I am a bit lost. I tried double-clicking all the threads but nothing happens (yes, I am a Windows noob :).

Any tips where to go from here?

-Stijn

  ----- Original Message -----
  From: Sudarsan Sridhar
  To: dev_at_glassfish.dev.java.net
  Sent: Tuesday, May 04, 2010 6:31 PM
  Subject: Re: Debugging Glassfish itself


  Hi Stijn,


  You would have to start the server with --debug option and attach a debugger to the port 9009.


  What is the issue that you are seeing. We may be able to help you without the trouble of debugging the code.


  Regards,
  Sudarsan


  On 04-May-2010, at 9:56 PM, Stijn de Witt wrote:


    Hi,

    Does anyone here know how to debug Glassfish itself?

    I am having trouble setting up a JDBCRealm so I would like to attach a debugger to a running Glassfish server, tell the debugger where the source is and then set a breakpoint in the JDBCRealm and JDBCLoginModule classes so I can figure out what is happening.

    I am using Glassfish v3 and have already downloaded the source code from the SVN repository at
    https://svn.dev.java.net/svn/glassfish-svn/trunk/v3

    ..as described here:
    http://wiki.glassfish.java.net/Wiki.jsp?page=V3FullBuildInstructions

    I would prefer to debug using Eclipse, but I'm willing to switch to Netbeans or any other IDE, so if you have instructions for some other IDE no problem.

    I have already asked this question on the Users list, but nobody there seemed to know how to do it. I also couldn't find anything on the net, most people are describing how to debug apps running inside Glassfish, but not how to debug Glassfish itself.

    Thanks in advance for any help! With kind regards,

    -Stijn