ADempiere and Glassfish, the love story begins

As of this writing, JBoss is the only application server that runs ADempiere. As a part of the organic evolution of the product, it is only natural that Glassfish be added to the list of supported application servers. Here is the first step in that direction.

Once you complete the steps outlined here, you will be able to run ADempiere on both Glassfish and JBoss. Based on the performance of the two application servers, you can then decide which one to take to production.

Lethargy Overcome

So, here comes something which has long been overdue. Nearly a couple months back, I finished investigating the changes required to make ADempiere run on Glassfish.  But writing web services for ADempiere kept me so busy that I kept postponing this blog. One positive outcome of this torpidity is the thorough testing of  ADempiere on Glassfish. I am yet to find any feature that runs differently on Glassfish. BTW, if you have any problems in running ADempiere on Glassfish, mail me. I am much faster in responding to mails than in writing blogs.

Prerquisites

Since the changes described here are not yet integrated into the code repository, we will need to modify the code ourselves to make Adempiere run on Glassfish.  Good thing is you don't need to make a whole lot of changes to the Java code. But, before you start, make sure that:

  1. You have installed Netbeans and Glassfish V2.
  2. You have read blog 1, blog 2 describing how to use ADempiere code inside Netbeans.
  3. Checked out ADempiere code and have an Adempiere project in Netbeans. In case you want to remote debug, this might help you.

Goes without saying you also need one of the supported databases with ADempiere data (Adempiere_pg.dmp) loaded in it.

Since, I have not been working on this project for sometime, I didn't get a chance to test the work on the latest releases of Glassfish and ADempiere. Hence, I would strongly recommend checking out the 340 branch rather than trunk. Also, get Glassfish V2 UR2  rather than the latest.

Source code changes required

Changes to Java files

Fortunately, there are no significant changes in java files. There are just two files you need to modify. All java changes are in install/src/org/compiere/install folder.  You can download this zip and put the contents in install/src/org/compiere/install. The two files that are changed are

  1. install/src/org/compiere/install/ConfigGlassfish.java : Add this file. For now, the lines 63-69 have been commented. This means that checking of your deployment directory has been disabled for now.

  2. install/src/org/compiere/install/ConfigurationData.java: Line 1026

    /** Glassfish            */
        protected static String APPSTYPE_GLASSFISH = "Glassfish";

Changes to XML files

Unfortunately, a larger number of xml files need to be patched. Some of the deployment descriptors need to be upgraded to version 2.4. A couple more need to change  to conform with Glassfish. Again, as with java files you can download the set of changed files as a zip and either place each one of the changed files in the appropriate directory or just copy all the contents in your trunk folder. Here is the list of changed files:

  1. trunk\lib\adempiereAll.xml

    trunk\adempiere\adempiere\lib\adempiereAll.xml (you would not need to change this if you changed the one above and did a complete build)
    install\build\adempiere\lib\adempiereAll.xml (you would not need to change this if you made proper changes in the first step and did a complete build)
  2. install\Adempiere\build.xml:  Line 404 has a comment, the target setupGlassfish is yet incomplete.
  3. webCM\src\web\WEB-INF\web.xml - changes to conform to web-app_2_4.xsd
  4. posterita\src\ear\application.xml - - changes to conform to application_1_4.xsd
  5. serverRoot\src\web\WEB-INF\web.xml- changes to conform to web-app_2_4.xsd
  6. serverApps\src\web\WEB-INF\web.xml- changes to conform to web-app_2_4.xsd
  7. serverRoot\src\ear\application.xml - - changes to conform to application_1_4.xsd
  8. webCM\src\ear\application.xml - - changes to conform to application_1_4.xsd
  9. AdempiereRoot.jar\META-INF\ejb-jar.xml
  10. Going forward, some changes may be required to extension/posterita/webui/WEB-INF/zk.xml

Generating Glassfish specific EAR file

Once you have made all the changes noted above, build Adempiere and next install ADempiere by pressing the Run Project button. If you have read the earlier blogs this should be a familiar step.

Y/N

Choose Y to get the installation panel. You would see an extra drop down option in Server Type, one specifically for Glassfish. You don't need to change the other details.

Once the installation is over you would get an EAR file called adempiereGlassfish.ear in \trunk\adempiere\Adempiere\.

Deploying ADempiereEAR file to Glassfish

Assuming that you have installed Glassfish and put its bin directory in your PATH, open a terminal and type the following commands:

Start Glassfish domain, domain1 for example

asadmin start-domain domain1

Deploying ear file

asadmin deploy --user=admin <FULL_PATH_TO_ADEMPIERE_GLASSFISH_EAR(adempiereGlassfish.ear)>

When this step completes go and check if ADempiere is deployed by looking at the list of applications deployed.

adempiere Running

Now open a browser window and just type in the following

http://<servername>:<portname>/adempiere

You should see the all too familiar window

That's all to it folks!!!

Comments:

Well done Praneet Tiwari! I have made an entry in our http://www.adempiere.com/wiki/index.php/ADempiere_Installing linking to your contribution here.

best regards
red1

Posted by Redhuan D. Oon on July 28, 2008 at 02:28 AM TPT #

Great!

But what is the advantages of using glash fish over jboss?..

Is there any significant change in terms of performance?

Best regards,
ivan ceras

Posted by ivan ceras on July 28, 2008 at 02:01 PM TPT #

Good job !!!

Posted by Syed Zuhdi on July 28, 2008 at 03:31 PM TPT #

Great Work!!

Posted by 192.18.43.225 on July 28, 2008 at 06:39 PM TPT #

Hi Praneet,

i have good news for you!

I commited your modifications into Adempiere SVN Server.
Since SVN Revision: 5816
http://adempiere.svn.sourceforge.net/adempiere/?rev=5816&view=rev

You will no longer need to modify Adempiere sources or XML files.

Thank you for the nice post and best regards,
Trifon

Posted by Trifon Trifonov on July 29, 2008 at 06:43 AM TPT #

Thanks a ton Trifon!!!
We continue to look forward for your help in making our other ADempiere projects available to the community.

Posted by Praneet on July 29, 2008 at 12:04 PM TPT #

Thanks everyone for the appreciation.
I'll try to publish a benchmarking report comparing performance of various app servers on various platforms. Hope that would answer Ivan's questions.

Posted by Praneet on July 29, 2008 at 12:07 PM TPT #

Pranjeet,

Congratulation!

Thanks a lot for booting the confidence of folks like us who are sitting on the fence and unable to decide.

Your efforts and passion has helped and would become catalyst in strengthening Adempiere project goals.
I am sure some other folks are working on BPMN and Workflow integration.

Cheers.
-rajan

Posted by Rajan Ahmad on August 04, 2008 at 12:48 PM TPT #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by praneet