ADempiere NoClassDefFoundError while applying customization

Hello everybody, Happy New Year to all of you. I wish, in this new year, we can have a more prosperous life. And hope we can share and spread our mercy.

In todays talks, we will discussing about ADempiere NoClassDefFoundError while applying our customization. Recently, I had a duty to applying bug fixing which not patched yet in the ADempiere previous version (342s. — means ADempiere 3.4.2 stable version –).

ADempiere current trunk, has a lot of new features and bug fixing which made ADempiere ERP even better and better. But, applying current trunk bug fixing to previous version is a challenging tasks. It’s not just about merging the source code only. There are so many things which needed carefully attention, like ensure that applying this fixing will not break ADempiere 342s core functionality. So I have to make sure to merge the proper codes and test this new codes accordingly.

I just realized that, they were so many activity to “broke the wall” which need to be done to ensure this patch working properly.

These error comes while ADempiere accounting processors, running its activity. I just do not understand, why this was happened.

Previously, we made our patching on Doc_Production.java files also and got java.lang.NoClassDefFoundError: org/compiere/acct/Doc_Production. And yes, our customizations contains several java class including MInvoice and Doc_Production classes.

We tried to isolate this issue with removing Doc_Production class first from our customization.jar, and the result was raise another no class def found error (in this case, we got error message appearing in the previous figure). We ensure that our patches java sources was compiled properly and successfully integrated with ADempiere core during executing run_setup.bat (or run_silentsetup.bat).

After “broken the other wall” during our test, finally we found what is the main problem are. Our machine box has 2 JDK version installed, ie JDK 5 and JDK 6. Currently, for testing purposes, I had set our JAVA_HOME to JDK 5 and compile ADempiere 342 with this version. Whereas, while developing the patches, Eclipse was setting up using JDK 6 as default java compiler. With our cases, changing to using JDK 5 after all, could eliminate NoClassDefFoundError error message.

Well, this is the end of today writings. Hope this can help readers, in case they face the same problems.