Use the Log4j 2 API instead of Log4j 1.

Gary

On Tue, Mar 8, 2022, 08:20 Pooja Pandey <pooja.pan...@asg.com.invalid>
wrote:

> -> Please consider the simpler long term path of updating your call sites
> to the Log4j 2 API.
>
> I am sorry but I could not under what do you mean by above. An example
> might help.
>
> -----Original Message-----
> From: Gary Gregory <garydgreg...@gmail.com>
> Sent: Tuesday, March 8, 2022 6:21 PM
> To: Log4J Users List <log4j-user@logging.apache.org>
> Subject: Re: Log4j1.x bridge error: Unable to create Lookup for bundle
> java.lang.ClassCastException: class
> org.apache.logging.log4j.core.lookup.ResourceBundleLookup
>
> *** External email: Verify sender before opening attachments or links ***
>
>
> Well done then ;-)
>
> Please consider the simpler long term path of updating your call sites to
> the Log4j 2 API.
>
> Gary
>
> Gary
>
> On Tue, Mar 8, 2022, 07:20 Pooja Pandey <pooja.pan...@asg.com.invalid>
> wrote:
>
> > -> What does your Log4j configuration file look like?
> >
> > I have figured adding log4j-web.jar into my libs fixes below issue. I
> > have added following 2 jars as well log4j-jcl.jar, log4j-jul.jar.
> >
> > -----Original Message-----
> > From: Gary Gregory <garydgreg...@gmail.com>
> > Sent: Tuesday, March 8, 2022 4:18 PM
> > To: Log4J Users List <log4j-user@logging.apache.org>
> > Subject: Re: Log4j1.x bridge error: Unable to create Lookup for bundle
> > java.lang.ClassCastException: class
> > org.apache.logging.log4j.core.lookup.ResourceBundleLookup
> >
> > *** External email: Verify sender before opening attachments or links
> > ***
> >
> >
> > Hi Pooja,
> >
> > What does your Log4j configuration file look like?
> >
> > Gary
> >
> > On Tue, Mar 8, 2022, 01:48 Pooja Pandey <pooja.pan...@asg.com.invalid>
> > wrote:
> >
> > > Hi,
> > >
> > >
> > > I am trying to migrate from log4j1.x to log4j2.17.2 using log4j1.x
> > > bridge approach. I am getting below ClassCastException error message.
> > > Please let me know if you have any idea how to fix this.
> > >
> > > 2022-03-08 01:41:17,023 http-nio-8088-exec-9 ERROR Unable to create
> > > Lookup for bundle java.lang.ClassCastException: class
> > > org.apache.logging.log4j.core.lookup.ResourceBundleLookup
> > >               at java.lang.Class.asSubclass(Class.java:3404)
> > >               at
> > >
> > org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.
> > java:79)
> > >               at
> > >
> > org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.
> > java:100)
> > >               at
> > >
> > org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(Abst
> > ractConfiguration.java:133)
> > >               at
> > >
> > org.apache.log4j.config.Log4j1Configuration.<init>(Log4j1Configuration
> > .java:43)
> > >               at
> > >
> > org.apache.log4j.config.PropertiesConfiguration.<init>(PropertiesConfi
> > guration.java:99)
> > >               at
> > >
> > org.apache.log4j.config.PropertiesConfiguration.<init>(PropertiesConfi
> > guration.java:110)
> > >               at
> > >
> > org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator
> > .java:300)
> > >               at
> > >
> > org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator
> > .java:276)
> > >               at
> > >
> > org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator
> > .java:388)
> > >               at
> > >
> > org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.j
> > ava:183)
> > >               at
> > > com.Custom.tools.logging.CustomLogger.resetURL(CustomLogger.java:408)
> > >               at
> > >
> > com.Custom..impl.JavaLogPropertyHelper.updateJavaLogPropertiesFromList
> > (JavaLogPropertyHelper.java:226)
> > >               at
> > >
> > com.Custom..impl.CustomServiceConfigurationImpl.SetHostProperties(Cust
> > omServiceConfigurationImpl.java:293)
> > >               at
> > >
> > com.Custom.Comm.CommToICustomServiceConfiguration.setHostProperties(Co
> > mmToICustomServiceConfiguration.java:642)
> > >               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > >               at
> > >
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > ava:62)
> > >               at
> > >
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > orImpl.java:43)
> > >               at java.lang.reflect.Method.invoke(Method.java:498)
> > >               at
> > com.sun.xml.ws.util.Trampoline.invoke(MethodUtil.java:52)
> > >               at
> > > sun.reflect.GeneratedMethodAccessor142.invoke(Unknown
> > > Source)
> > >               at
> > >
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > orImpl.java:43)
> > >               at java.lang.reflect.Method.invoke(Method.java:498)
> > >               at
> > com.sun.xml.ws.util.MethodUtil.invoke(MethodUtil.java:77)
> > >               at
> > > com.sun.xml.ws.api.server.MethodUtil.invoke(MethodUtil.java:34)
> > >               at
> > >
> > com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.j
> > ava:220)
> > >               at
> > > com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:119)
> > >               at
> > >
> > com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube
> > .java:58)
> > >               at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1106)
> > >               at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1020)
> > >               at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:989)
> > >               at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:847)
> > >               at
> > > com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:389)
> > >               at
> > >
> > com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapt
> > er.java:838)
> > >               at
> > > com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:392)
> > >               at
> > >
> > com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(Servl
> > etAdapter.java:195)
> > >               at
> > >
> > com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServle
> > tDelegate.java:131)
> > >               at
> > >
> > com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServl
> > etDelegate.java:167)
> > >               at
> > >
> com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:51)
> > >               at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
> > >               at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:227)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:162)
> > >               at
> > > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:189)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:162)
> > >               at
> > >
> > org.springframework.web.filter.RequestContextFilter.doFilterInternal(R
> > equestContextFilter.java:100)
> > >               at
> > >
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRe
> > questFilter.java:117)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:189)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:162)
> > >               at
> > >
> > org.springframework.web.filter.FormContentFilter.doFilterInternal(Form
> > ContentFilter.java:93)
> > >               at
> > >
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRe
> > questFilter.java:117)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:189)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:162)
> > >               at
> > >
> > org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(
> > ErrorPageFilter.java:126)
> > >               at
> > >
> > org.springframework.boot.web.servlet.support.ErrorPageFilter.access$00
> > 0(ErrorPageFilter.java:64)
> > >               at
> > >
> > org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilte
> > rInternal(ErrorPageFilter.java:101)
> > >               at
> > >
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRe
> > questFilter.java:117)
> > >               at
> > >
> > org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(
> > ErrorPageFilter.java:119)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:189)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:162)
> > >               at
> > >
> > org.springframework.web.filter.CharacterEncodingFilter.doFilterInterna
> > l(CharacterEncodingFilter.java:201)
> > >               at
> > >
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRe
> > questFilter.java:117)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:189)
> > >               at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:162)
> > >               at
> > >
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> > lve.java:197)
> > >               at
> > >
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
> > lve.java:97)
> > >               at
> > >
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat
> > orBase.java:540)
> > >               at
> > >
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
> > va:135)
> > >               at
> > >
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
> > va:92)
> > >               at
> > >
> > org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAcces
> > sLogValve.java:687)
> > >               at
> > >
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
> > e.java:78)
> > >               at
> > >
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> > :359)
> > >               at
> > >
> > org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:
> > 399)
> > >               at
> > >
> > org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLigh
> > t.java:65)
> > >               at
> > >
> > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractP
> > rotocol.java:889)
> > >               at org.apache.tomcat.util.net
> > > .NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1735)
> > >               at org.apache.tomcat.util.net
> > > .SocketProcessorBase.run(SocketProcessorBase.java:49)
> > >               at
> > >
> > org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPool
> > Executor.java:1191)
> > >               at
> > >
> > org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoo
> > lExecutor.java:659)
> > >               at
> > >
> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThr
> > ead.java:61)
> > >               at java.lang.Thread.run(Thread.java:748)
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>

Reply via email to