SAP Knowledge Base Article - Preview

3616512 - Deployment failed in data migration phase due to ClassNotFoundException and ClassCastException with log4j after upgrade to 2211.37

Symptom

The deployment failed in data migration phase due to below exception in platform-update pod:

Loading additional classes from: [file:/opt/hybris/bin/platform/resources/libpatches/velocity-engine-patch-2.3-1.jar, file:/opt/hybris/bin/platform/resources/libpatches/spring4shell-patch-5.2.15.jar]
main ERROR Unable to create class de.hybris.platform.util.logging.log4j2.HybrisLog4j2LoggerContextFactory specified in the log4j2.loggerContextFactory system property java.lang.ClassNotFoundException: de.hybris.platform.util.logging.log4j2.HybrisLog4j2LoggerContextFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at org.apache.logging.log4j.util.LoaderUtil.loadClass(LoaderUtil.java:207)
    at org.apache.logging.log4j.util.ProviderUtil.selectProvider(ProviderUtil.java:224)
    at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:164)
    at org.apache.logging.log4j.util.ProviderUtil.getProvider(ProviderUtil.java:126)
    at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:62)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:54)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:32)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:432)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:457)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    at de.hybris.bootstrap.loader.PlatformInPlaceClassLoader.initializeLog4j2(PlatformInPlaceClassLoader.java:112)
    at de.hybris.bootstrap.loader.PlatformInPlaceClassLoader.<init>(PlatformInPlaceClassLoader.java:81)
    at de.hybris.bootstrap.loader.PlatformInPlaceClassLoader.<init>(PlatformInPlaceClassLoader.java:53)
    at de.hybris.bootstrap.loader.PlatformInPlaceClassLoader.<init>(PlatformInPlaceClassLoader.java:41)
    at de.hybris.bootstrap.loader.Loader.execute(Loader.java:134)
    at de.hybris.bootstrap.loader.Loader.main(Loader.java:108)

.................

shutting down hybris registry..

Caused by: Sourced file: inline evaluation of: ``try                 {                     de.hybris.ant.taskdefs.AntPerformable p = new de.hybris.ant.taskd . . . '' : Method Invocation de.hybris.platform.util.RedeployUtilities.shutdown : at Line: 8 : in file: inline evaluation of: ``try                 {                     de.hybris.ant.taskdefs.AntPerformable p = new de.hybris.ant.taskd . . . '' : de .hybris .platform .util .RedeployUtilities .shutdown ( ) 

Target exception: java.lang.ClassCastException: class org.apache.logging.log4j.core.LoggerContext cannot be cast to class de.hybris.platform.util.logging.log4j2.HybrisLoggerContext (org.apache.logging.log4j.core.LoggerContext and de.hybris.platform.util.logging.log4j2.HybrisLoggerContext are in unnamed module of loader de.hybris.bootstrap.loader.PlatformInPlaceClassLoader @7b227d8d)

    at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:91)
    at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
    at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
    at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
    at bsh.BSHBlock.eval(BSHBlock.java:75)
    at bsh.BSHBlock.eval(BSHBlock.java:41)
    at bsh.BSHTryStatement.eval(BSHTryStatement.java:173)
    at bsh.Interpreter.eval(Interpreter.java:659)
    at bsh.Interpreter.eval(Interpreter.java:750)
    at bsh.Interpreter.eval(Interpreter.java:739)
    at de.hybris.platform.util.ClientExecuter.execute(ClientExecuter.java:42)
    ... 6 more
Caused by: java.lang.ClassCastException: class org.apache.logging.log4j.core.LoggerContext cannot be cast to class de.hybris.platform.util.logging.log4j2.HybrisLoggerContext (org.apache.logging.log4j.core.LoggerContext and de.hybris.platform.util.logging.log4j2.HybrisLoggerContext are in unnamed module of loader de.hybris.bootstrap.loader.PlatformInPlaceClassLoader @7b227d8d)
    at de.hybris.platform.util.RedeployUtilities.shutdownLog4j2(RedeployUtilities.java:82)
    at de.hybris.platform.util.RedeployUtilities.shutdown(RedeployUtilities.java:71)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    at bsh.Reflect.invokeMethod(Reflect.java:131)
    at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
    at bsh.Name.invokeMethod(Name.java:868)
    at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
    ... 16 more
Exception in thread "ShutdownHookThread" java.lang.ClassCastException: class org.apache.logging.log4j.core.LoggerContext cannot be cast to class de.hybris.platform.util.logging.log4j2.HybrisLoggerContext (org.apache.logging.log4j.core.LoggerContext and de.hybris.platform.util.logging.log4j2.HybrisLoggerContext are in unnamed module of loader de.hybris.bootstrap.loader.PlatformInPlaceClassLoader @7b227d8d)
    at de.hybris.platform.util.RedeployUtilities.shutdownLog4j2(RedeployUtilities.java:82)
    at de.hybris.platform.util.RedeployUtilities.shutdown(RedeployUtilities.java:71)
    at java.base/java.lang.Thread.run(Thread.java:840)
    at de.hybris.platform.core.threadregistry.RegistrableThread.internalRun(RegistrableThread.java:134)
    at de.hybris.platform.core.threadregistry.RegistrableThread.run(RegistrableThread.java:124)

BUILD FAILED
/opt/hybris/bin/platform/build.xml:139: The following error occurred while executing this line:
/opt/hybris/bin/platform/resources/ant/platformadministration.xml:99: The following error occurred while executing this line:
/opt/hybris/bin/platform/resources/ant/antmacros.xml:680: Java returned: 1

Total time: 3 minutes 52 seconds
+ [[ 1 != 0 ]]
+ printMessage 'TYPESYSTEM UPDATE FAILED.'
+ echo '*'
+ echo '*'
+ echo -n '* '
+ echo TYPESYSTEM UPDATE FAILED.
+ echo '*'
+ echo '*'
*
*
* TYPESYSTEM UPDATE FAILED.


Read more...

Environment

SAP Commerce Cloud 2211.37 and all above versions.

Product

SAP Commerce Cloud 2211

Keywords

Deployment, log4j, log4j2, data migration, java.lang.ClassCastException, java.lang.ClassCastException: class org.apache.logging.log4j.core.LoggerContext cannot be cast to class de.hybris.platform.util.logging.log4j2.HybrisLoggerContext , KBA , CEC-SCC-CLA-DEP , Deployments , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.