classcastexception deployment rules Jahia 7.3
ClassCastException in a module with drools rule after deployment
When you deploy a new version of a module, which contains a java class for the drools rule service, it could happen that you get a ClassCastException like:
java.lang.ClassCastException: class org.jahia.modules.comment.rules.CommentRuleService cannot be cast to class org.jahia.modules.comment.rules.CommentRuleService
The problem comes from the OSGI - class loader. Which use the old version of the class. The class loader didn't change the reference to the new module. So it could lead to this ClassCastException.
Since Jahia 220.127.116.11 an improvement was done, to unlink all classes from the class loader. Before this version, only a restart of the node helps to solve this issue.