Gatein-Portal code bug which is causing the following error: ++++++++++++++++++++++++ 11:22:01,452 ERROR [portal:UIPortletLifecycle] (http-/127.0.0.1:8080-1) Error processing the action: java.lang.NoClassDefFoundError cannot be cast to java.lang.Exception: java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to java.lang.Exception at org.exoplatform.portal.webui.application.UIPortletActionListener$ProcessActionActionListener.handleErrorResponse(UIPortletActionListener.java:241) [exo.portal.webui.portal-3.5.2.Final-redhat-4.jar:3.5.2.Final-redhat-4] at org.exoplatform.portal.webui.application.UIPortletActionListener$ProcessActionActionListener.execute(UIPortletActionListener.java:140) [exo.portal.webui.portal-3.5.2.Final-redhat-4.jar:3.5.2.Final-redhat-4] at org.exoplatform.webui.event.Event.broadcast(Event.java:97) [exo.portal.webui.framework-3.5.2.Final-redhat-4.jar:3.5.2.Final-redhat-4] +++++++++++++++++++++++++ Notice the class [1] where the method is trying to cast the (Throwable) object into an Exception.. as in runtime it can be any thing like Error/Exception so everything Should *not* be casted to Exception. _+++++++++++++++ Notice following Method +++++++++++++++_ private void handleErrorResponse(ErrorResponse response) throws Exception { throw (Exception) response.getCause(); } Which means suppose if the [response.getCause()] returns NoClassDefFoundError (rather than an Exception) then definitely it can not be Casted to an Exception. [1] https://github.com/gatein/gatein-portal/blob/master/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
Martin Weiler <mweiler> made a comment on jira GTNPORTAL-3122 Attaching a reproducer for this issue. The portlet is calling a helper class in processAction method. This helper class is using MVEL to evaluate an expression. The mvel libraries are not being included into the build, to force the NoClassDefFoundError at runtime. Without the fix, the NoClassDefFoundError is masked by the ClassCastException, thus giving no clue that the missing mvel library is the actual root cause.
PR sent by Martin discussed and verified.
Verified on ER3 using the reproducer from GTNPORTAL-3122.