legacy-knowledge-base
Publicado Jul. 25, 2002

ClassCastException on com.liferay.frontend.theme.contributor.extender after installing a newer fix pack

written-by

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • After patching the environment with a newer fix pack, the below error may be encountered at server startup:
     ERROR [ServerService Thread Pool -- 68][ThemeContributorTopHeadDynamicInclude:93] bundle com.liferay.frontend.theme.contributor.extender:4.0.8 (504)[com.liferay.frontend.theme.contributor.extender.internal.servlet.taglib.ThemeContributorTopHeadDynamicInclude(1581)] : The addBundleWebResources method has thrown an exception 
    java.lang.ClassCastException: com.liferay.frontend.theme.contributor.extender.internal.BundleWebResourcesImpl cannot be cast to com.liferay.frontend.theme.contributor.extender.BundleWebResources
     at com.liferay.frontend.theme.contributor.extender.internal.servlet.taglib.ThemeContributorTopHeadDynamicInclude._rebuild(ThemeContributorTopHeadDynamicInclude.java:157)
     at com.liferay.frontend.theme.contributor.extender.internal.servlet.taglib.ThemeContributorTopHeadDynamicInclude.addBundleWebResources(ThemeContributorTopHeadDynamicInclude.java:129)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [...]

Environment

  • Liferay DXP 7.0+

Resolution

  1. Have a clean, uncustomized Liferay DXP bundle (you may download it from the Downloads page on the Customer Portal) and patch it with the same patching level that is present on your affected Liferay environment
  2. Ensure the affected server is stopped
  3. Now, have the $LIFERAY_HOME/osgi/marketplace/Liferay Foundation - Liferay Frontend Theme - Impl.lpkg freshly patched in the vanilla bundle from step 1) and copy/replace it into the corresponding place of your bundle: $LIFERAY_HOME/osgi/marketplace/Liferay Foundation - Liferay Frontend Theme - Impl.lpkg
  4. Cleanup the content of $LIFERAY_HOME/osgi/state, $LIFERAY_HOME/work and $TOMCAT_HOME/work and /temp
  5. Start the server, you should no longer see the error coming up

Additional Information

  • The root cause is that the /osgi/marketplace/Liferay Foundation - Liferay Frontend Theme - Impl.lpkg contains both com.liferay.frontend.theme.contributor.extender-4.0.8.jar and com.liferay.frontend.theme.contributor.extender-4.0.12.jar, this is probably the result of a corrupt patching operation.
did-this-article-resolve-your-issue

legacy-knowledge-base