DIF Tutorial - Debuging the aplication

Back to Deploying the application

Sometimes things go rough and you need to debug your application. Fear no more, as I'm going to show you how to set things up for debugging your web app on Eclipse.

Application set up

The first thing to do is to set the application up for debugging. As you need a fresh installation, you must deploy it to server. By now you should already know how to do it. I'm foolishly assuming you read the preceding tutorial step...but just in case you belong to the "start-coding-immediately" kind, skipped the whole thing and came here looking for help because suddenly you found a bug, I will show you how to do it.

Run the following Maven command on your app folder:

 mvn clean package cargo:deploy

Can it get easier?

Eclipse IDE set up

To set the IDE for debugging mode we need to create and configure a new server to run our web app. I will assume that you don't know how to do it and that your Eclipse doesn't have any server configured yet.

Note: We advise you use the IDE we supply here: TODO: Add link Digitalis Repository

Please do the following steps:

  • Open the "Servers" view on Eclipse.

    Go to the "Window" menu and choose the "Show View" option. Then pick the "Other..." option. You can also get there by using the following keyboard shortcut: Alt + Shift + Q, and then pressing the Q key again. That is: Alt + Shift + Q, Q.

    Pick the "Server" folder and then the "Servers" option. You can use the filter on the top of the "Show View" window to navigate straight through to the "Servers". To do so simply start to write the word 'servers' on the filter's text box.

  • Create the server

    On the new view (that's the "Servers" view) click with the mouse's right button to make the menu pop. Then choose the "New" option, and then the "Server" option.

    On the "New Server" window leave the server's name as "localhost" and set it's type to JBoss v4.0. Advance to the next configuration step (yes, you must use the "Next" button on the window).

    On the next step set the "Application Server Directory" to the folder where you have you JBoss Eclipse. Hit "Next" once again.

    You shouldn't need to change anything on the next window but I will leave you the configurations here, in case something goes wrong:

    Address: 127.0.0.1
    Port: 8080
    JNDI Port: 1099
    Server configuration: default

    Hit "Finish" and you're done with the server creation.

  • Start the server

    On the "Servers" view click with the mouse's right button to make the menu pop once again. Then choose the "Debug" option to start the server in debug mode.

    The server should then start. Please note that choosing "Debug" mode for the server makes it start and run slower than just starting for normal service.

Debug

The debugging process is pretty much the same as it is with a regular Java application (breakpoints, variable inspection, etc.).

If you try to debug some class external to the project you'll be faced with a blank screen and a message stating that the IDE doesn't not know where find the source for it. If this is the case you can use the "Link to source..." button to browse to the source file.

Advance to Some advanced features