Book Image

ADempiere 3.6 Cookbook

Book Image

ADempiere 3.6 Cookbook

Overview of this book

Table of Contents (16 chapters)
ADempiere 3.6 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Debugging the ADempiere server application (web version)


Working with the web/server version of ADempiere is equally practical and required as compared to the client/desktop version. The server version runs inside a J2EE container, like JBoss. In this recipe, we will see how to configure ADempiere and JBoss to be able to debug the code when it is deployed as a server. Though ADempiere comes along with a JBoss distribution, to have a better understanding of the subject matter, we will use the external JBoss installation.

Getting ready

  • Verify that JBoss is installed on your system and set up correctly

How to do it...

  1. 1. In Eclipse, go to the Servers view.

  2. 2. Right-click and select New | Server. You will see the New Server window.

  1. 3. On the New Server window, select the JBoss V4.2 and click the Next button. This will take you to the New JBoss V4.2 Runtime window.

  1. 4. On the runtime window, enter the following values and click the Next button:

    JRE: Choose JDK 1.6 or above

    Application Server Directory: Set this to your JBoss installation folder (which is JBOSS_HOME)

    This will take you to the following New JBoss V4.2 Server window:

  1. 5. On the New JBoss v4.2 Server window, enter the following and click the Next button:

    • Address: 127.0.0.1

    • Port: 9080 (make sure that this port is not being used by any other application on your system)

    • JNDI Port: 1099 (make sure that this port is not being used by any other application on your system)

    • Server Configuration: default

      Clicking on the Next button will take you to the Add and Remove window:

  1. 6. On the Add and Remove window, select Adempiere_trunk from the Available list, and add it to the Configured list.

  1. 7. Click on the Finish button. This will add an entry in the Servers view.

  1. 8. Open org.adempiere.webui.AdempiereWebUI.java and add a break-point inside the constructor.

  2. 9. Right-click on the server entry, which we just created, and select the Open menu option.

  1. 10. On the Overview screen, change the Start value under the Timeouts category to 500.

Note

For the default Server Configuration, the port number is defaulted to 8080 unless you go and change the config files of JBoss, which we'll see in the subsequent recipe. For now, note that even though you enter 9080 as the port, the JBoss server will run on port 8080. So, make sure that port 8080 is free on your system.

  1. 11. Click on the Open launch configuration. This will bring up the Edit configuration window to edit the JBoss configuration.

  1. 12. On the Arguments tab, add the following to the VM arguments:

    -DPropertyFile="C:\adempiere_svn\tags\adempiere360lts\ADempiere.properties"
    DADEMPIERE_HOME="C:\adempiere_svn\tags\adempiere360lts"
    
  2. 13. On the Classpath tab, click on the Add External JARs button to add the JARs from the following folders:

    • <ADEMPIERE_SVN>\tags\adempiere360lts\tools\lib

    Note

    Exclude the following JARs: ant.jar, ant-commons-net.jar, ant-contrib-1.0b1.jar, ant-launcher.jar, j2ee.jar, jnlp.jar, log4j.jar, commons-logging.jar, servlet-api.jar

    • <ADEMPIERE_SVN>\tags\adempiere360lts\JasperReportsTools\lib

    Note

    Exclude the following JARs: jfreechart-1.0.13.jar

    • Add <JAVA_HOME>\jre\lib\javaws.jar

  3. 14. Click Apply followed by the OK button.

  4. 15. Refresh the project adempiere_360.

  5. 16. Right-click on the JBoss server entry on the Servers view and select the Publish menu option. This will start the process of build and deployment. The application is deployed with the context name Adempiere_trunk.

  1. 4. After publish is completed (you will see the Synchronized text next to the JBoss server entry in the Servers view), right-click on the server and select the Debug menu option.

  • This will start the JBoss server in the debug mode and the debugger will stop at your break-point. Using the Debug toolbar, you will be able to debug ADempiere as a server application. If you resume the application, the server will run and you will see the following screen when you access the URL http://localhost:8080/Adempiere_trunk/ in your browser.

How it works...

Steps 1 through 7 take care of creating a JBoss server entry in Eclipse and adding the ADempiere project deployment resource to the JBoss server runtime. It is important to verify that the JBoss and JNDI port numbers (9080 and 1099) are free. Steps 9 through 14 are where the project related detail (for example, classpath) is configured in the JBoss server runtime. This is important for the deployment of the ADempiere server version in JBoss and running the same. The configuration adds the required JAR files and ADempiere classes to the JBoss configuration so that they are available to the runtime when we run the server.

See also

  • Creating the installer from the source code

  • Installing ADempiere