ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

ERROR Unable to create Lookup for main java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.MainMapLookup

book

Article ID: 240749

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction


After upgrading to Spectrum 21.2.10 the following exceptions are seen in the catalina.out log

2022-05-02 11:17:35,933 ERROR Unable to create Lookup for upper java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.UpperLookup
 at java.lang.Class.asSubclass(Class.java:3404)
 at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:64)
 at org.apache.logging.log4j.core.config.PropertiesPlugin.configureSubstitutor(PropertiesPlugin.java:57)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:137)
 at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
 at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
 at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:339)
 at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
 at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:361)
 at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:426)
 at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:442)
 at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
 at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
 at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
 at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
 at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:426)
 at com.ca.integration.normalization.common.NIMServletContextListener.<init>(NIMServletContextListener.java:63)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4691)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230)

 

Cause


In this exception, we see that it is coming from the NIM component used for Service Desk integrations.  The new ca-nim-sm.war file was not extracted
  leaving the older ca-nim-sm folder under $SPECROOT/tomcat/webapps/. Tomcat was looking for a class in an older log4j jar file from the older folder.

Environment

Release : 21.2

Component : Spectrum OneClick

Resolution


1. Stop tomcat
   
    cd $SPECROOT/tomcat/bin/
    ./stopTomcat.sh


2. Rename and move the ca-nim-sm folder to a location outside of the Spectrum install path
    
     cd $SPECROOT/tomcat/webapps/
     mv ca-nim-sm  /tmp/ca-nim-sm.OLD
     

3. Start OneClick Tomcat

    cd $SPECROOT/tomcat/bin/
    ./startTomcat.sh

 

Verify that the ca-nim-sm folder was recreated under $SPECROOT/tomcat/webapps/ and that the exceptions no longer occur.