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.
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.
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:
- You have installed Netbeans and Glassfish V2.
- You have read blog 1, blog 2 describing how to use ADempiere code inside Netbeans.
- 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
- 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.
- 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:
trunk\\adempiere\\adempiere\\lib\\adempiereAll.xml (you would not need to change this if you changed the one above and did
a complete build)
(you would not need to change this if you made proper changes in the first step and did
a complete build)
- install\\Adempiere\\build.xml: Line 404 has a comment, the target setupGlassfish is yet incomplete.
- webCM\\src\\web\\WEB-INF\\web.xml - changes to conform to web-app_2_4.xsd
- posterita\\src\\ear\\application.xml - - changes to conform to application_1_4.xsd
- serverRoot\\src\\web\\WEB-INF\\web.xml- changes to conform to web-app_2_4.xsd
- serverApps\\src\\web\\WEB-INF\\web.xml- changes to conform to web-app_2_4.xsd
- serverRoot\\src\\ear\\application.xml - - changes to conform to application_1_4.xsd
- webCM\\src\\ear\\application.xml - - changes to conform to application_1_4.xsd
- 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.
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.
Now open a browser window and just type in the following
You should see the all too familiar window
That's all to it folks!!!