You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeremy Nguyen <je...@gmail.com> on 2023/05/01 18:22:01 UTC
WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Hi,
I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
nullpointerexception within WebappClassLoaderBase.CombinedEnumeration.inc.
It seems to occur when it's trying to initialize commons-logging LogFactory
for any class specified in Web.xml, and it's calling
getResources("commons-logging.properties") which I never had. Is it
required in 8.5? Even if I put it in conf/, it's not being picked up.
We're running Tomcat using a wrapper and it's erroring out here:
https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
I posted my web.xml and error trace here as well:
https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
Thanks,
Jeremy
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Jeremy Nguyen <je...@gmail.com>.
If WebAppClassLoader.findResources returns null then it would come from
java.net.URLClassLoader.findResources.
@Override
> public Enumeration<URL> findResources(String resources) throws IOException
> {
> logger.debug("finding resources " + resources);
> Enumeration<URL> urls = myPluginLoader.getResources(resources);
> if (urls != null && urls.hasMoreElements())
> return urls;
> urls = tomcatPluginLoader.getResources(resources);
> if (urls != null && urls.hasMoreElements())
> return urls;
> return super.findResources(resources);
> }
On Wed, May 3, 2023 at 8:01 AM <je...@gmail.com> wrote:
> Sure Ill run it.
>
> - Jeremy
>
> > On May 3, 2023, at 7:05 AM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
> >
> >
> > Jeremy,
> >
> >> On 5/2/23 22:27, Jeremy Nguyen wrote:
> >> I was able to retrieve some logs that might shed some insight on the
> >> parent classloader when running 8.5.87. I'll be frank that I don't quite
> >> understand the mechanics of classloaders in Java.
> >> LogFactory from
> >>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735]
> [LOOKUP]
> >>> LogFactory implementation requested for the first time for context
> >>> classloader
> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
> >>>
> >>> [LogFactory from
> >>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735]
> [LOOKUP]
> >>> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 ==
> >>> 'ParallelWebappClassLoader
> >>>
> >>> context: cg
> >>>
> >>> delegate: false
> >>>
> >>> ----------> Parent Classloader:
> >>>
> >>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@b887730
> >
> > I wonder if org.cg.dao.webcontainer.tomcat.WebAppClassLoader has a bug
> where getResources() can return null.
> >
> > That violates the contract of ClassLoader.getResources, but since it's
> /possible/ maybe Tomcat can work around it by simply ignoring the empty
> Enumeration. If I give you an unofficial build, can you try it?
> >
> > -chris
> >
> >>> [LogFactory from
> >>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735]
> [LOOKUP]
> >>> ClassLoader
> >>> tree:org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
> -->
> >>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@193492784 -->
> >>> jdk.internal.loader.ClassLoaders$AppClassLoader@2085857771 (SYSTEM)
> -->
> >>> jdk.internal.loader.ClassLoaders$PlatformClassLoader@105966264 -->
> BOOT
> >>>
> >>> May 02, 2023 7:23:21 PM org.apache.catalina.core.StandardContext
> >>> listenerStart
> >>>
> >>> SEVERE: Exception sending context initialized event to listener
> instance
> >>> of class [org.springframework.web.context.ContextLoaderListener]
> >>>
> >>> java.lang.NullPointerException
> >>>
> >>> at
> >>>
> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(
> >>> WebappClassLoaderBase.java:2775)
> >>>
> >>> at
> >>>
> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(
> >>> WebappClassLoaderBase.java:2760)
> >>>
> >>> at org.apache.commons.logging.LogFactory.getConfigurationFile(
> >>> LogFactory.java:1366)
> >>>
> >>> at
> org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:453)
> >>>
> >>> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
> >>>
> >>> at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(
> >>> ContextLoader.java:269)
> >>>
> >>> at
> >>>
> org.springframework.web.context.ContextLoaderListener.contextInitialized(
> >>> ContextLoaderListener.java:103)
> >>>
> >>> at org.apache.catalina.core.StandardContext.listenerStart(
> >>> StandardContext.java:4492)
> >>>
> >>> at org.apache.catalina.core.StandardContext.startInternal(
> >>> StandardContext.java:4950)
> >>>
> >>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
> >>>
> >>> at org.apache.catalina.core.ContainerBase.addChildInternal(
> >>> ContainerBase.java:711)
> >>>
> >>> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
> >>>
> >>> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
> >>>
> >>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(
> >>> TomcatWrapper.java:185)
> >>>
> >>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(
> >>> TomcatWrapper.java:140)
> >>>
> >>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startServer(
> >>> TomcatWrapper.java:206)
> >>>
> >>> at
> org.cg.dao.webcontainer.tomcat.Application.start(Application.java:30)
> >>>
> >>> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(
> >>> EclipseAppHandle.java:203)
> >>>
> >>> at
> >>>
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
> >>> EclipseAppLauncher.java:136)
> >>>
> >>> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
> >>> EclipseAppLauncher.java:104)
> >>>
> >>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
> >>> EclipseStarter.java:402)
> >>>
> >>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
> >>> EclipseStarter.java:255)
> >>>
> >>> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>> Method)
> >>>
> >>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
> >>> NativeMethodAccessorImpl.java:62)
> >>>
> >>> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
> >>> DelegatingMethodAccessorImpl.java:43)
> >>>
> >>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> >>>
> >>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
> >>>
> >>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
> >>>
> >>> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
> >>>
> >>> at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
> >>>
> >>> On Tue, May 2, 2023 at 6:18 PM Jeremy Nguyen <je...@gmail.com>
> wrote:
> >>> I picked 8.5.34 because 8.5.35 has that code change while 34 doesn't.
> >>>
> https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
> >>>
> >>> I'll do some debugging for the classloader soon. I'm still trying to
> get
> >>> my application running. I'm wrestling with the following error at
> runtime.
> >>>
> >>> Caused by: org.apache.jasper.JasperException: Unable to compile class
> for
> >>>> JSP
> >>>> at
> >>>>
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> >>>> ~[servlet-api.jar:?]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
> >>>> ~[com.centrify.platform.service.analytics/:?]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
> >>>> ~[org.cg.services.core/:?]
> >>>> at
> >>>>
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
> >>>> ~[spring-security-pac4j-2.0.0.jar:?]
> >>>> at
> >>>>
> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
> >>>> ~[pac4j-core-1.9.1.jar:?]
> >>>> ... 34 more
> >>>> Caused by: java.lang.NullPointerException
> >>>> at
> >>>>
> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> >>>> ~[jasper.jar:8.5.34]
> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> >>>> ~[servlet-api.jar:?]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
> >>>> ~[com.centrify.platform.service.analytics/:?]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
> >>>> ~[org.cg.services.core/:?]
> >>>> at
> >>>>
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>> ~[catalina.jar:8.5.34]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>> at
> >>>>
> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
> >>>> ~[spring-security-pac4j-2.0.0.jar:?]
> >>>> at
> >>>>
> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
> >>>> ~[pac4j-core-1.9.1.jar:?]
> >>>> ... 34 more
> >>>
> >>>
> >>> On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
> >>> chris@christopherschultz.net> wrote:
> >>>
> >>>> Jeremy,
> >>>>
> >>>> On 5/1/23 17:46, Jeremy Nguyen wrote:
> >>>>> I noticed this change was introduced:
> >>>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
> >>>>>
> >>>>
> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
> >>>>>
> >>>>> I'll try running 8.5.34 and report back.
> >>>>
> >>>> Wow that's ancient. What made you pick 8.5.34? That change should have
> >>>> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
> >>>> which (if either) works?
> >>>>
> >>>> I wonder if the parent ClassLoader is violating the contract for
> >>>> getResources().
> >>>>
> >>>> Jeremy, can you throw some code into your application that runs early
> >>>> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp)
> that
> >>>> reports the class name of thew parent ClassLoader for the
> >>>> WebappClassLoader being used for the webapp?
> >>>>
> >>>> If you aren't able to do that -- and since you are running from
> Eclipse
> >>>> -- try putting a breakpoint in WebappClassLoaderBase.getResources
> >>>> and just inspecting the situation at that point -- you should be
> able
> >>>> to see what the parent ClassLoader is, and even see what
> >>>> getParent().getResources() returns.
> >>>>
> >>>> -chris
> >>>>
> >>>>> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
> >>>> wrote:
> >>>>>
> >>>>>>
> >>>>>>
> >>>>>> On 5/1/23 14:36, Christopher Schultz wrote:
> >>>>>>> Jeremy,
> >>>>>>>
> >>>>>>> On 5/1/23 14:22, Jeremy Nguyen wrote:
> >>>>>>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
> >>>>>>>> nullpointerexception within
> >>>>>>>> WebappClassLoaderBase.CombinedEnumeration.inc.
> >>>>>>>> It seems to occur when it's trying to initialize commons-logging
> >>>>>>>> LogFactory
> >>>>>>>> for any class specified in Web.xml, and it's calling
> >>>>>>>> getResources("commons-logging.properties") which I never had. Is
> it
> >>>>>>>> required in 8.5? Even if I put it in conf/, it's not being picked
> up.
> >>>>>>>>
> >>>>>>>> We're running Tomcat using a wrapper and it's erroring out here:
> >>>>>>>>
> >>>>>>
> >>>>
> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> I posted my web.xml and error trace here as well:
> >>>>>>>>
> >>>>>>
> >>>>
> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
> >>>>>>>>
> >>>>>>>
> >>>>>>> I have no idea how this is throwing an NPE. The only pointer being
> >>>>>>> dereferenced by the inc() method is "sources":
> >>>>>>>
> >>>>>>> 2773 private boolean inc() {
> >>>>>>> 2774 while (index < sources.length) {
> >>>>>>> 2775 if (sources[index].hasMoreElements()) {
> >>>>>>> 2776 return true;
> >>>>>>> 2777 }
> >>>>>>> 2778 index++;
> >>>>>>> 2779 }
> >>>>>>> 2780 return false;
> >>>>>>> 2781 }
> >>>>>>>
> >>>>>>> That member (sources) is instantiated in the one-and-only-one
> >>>>>>> constructor:
> >>>>>>>
> >>>>>>> CombinedEnumeration(Enumeration<URL> enum1,
> Enumeration<URL>
> >>>>>>> enum2) {
> >>>>>>> @SuppressWarnings("unchecked")
> >>>>>>> Enumeration<URL>[] sources = new Enumeration[] {
> enum1,
> >>>>>>> enum2 };
> >>>>>>> this.sources = sources;
> >>>>>>> }
> >>>>>>>
> >>>>>>> Also weird is that this throws NPE on line 2775 and not 2774. I
> can't
> >>>>>>> explain how line 2775 could throw an NPE if line 2774 did not.
> >>>>>>>
> >>>>>>>> :/
> >>>>>>
> >>>>>> Is the null pointer in the index'th position of source, not source
> >>>> itself?
> >>>>>>
> >>>>>>>
> >>>>>>> I use Tomcat 8.5.x and I have never had a
> commons-logging.properties
> >>>>>>> file, and I use some components which are surely causing
> >>>>>>> commons-logging LogFactory to initialize, and I've never seen this
> >>>>>>> problem before.
> >>>>>>>
> >>>>>>> -chris
> >>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>
> >>>>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jeremy,
On 5/3/23 12:27, Jeremy Nguyen wrote:
> Thanks Chris! That works for me now.
Okay. I'll ask the rest of the team if it's an acceptable workaround.
Honestly, that parent ClassLoader is violating The Rules.
> Only issue I have left is failing to compile/validate JSP.
>
> Caused by: java.lang.NullPointerException
>>
>> at org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(
>> Validator.java:527) ~[jasper.jar:8.5.89]
>>
>> at org.apache.jasper.compiler.Validator.validateExDirectives(
>> Validator.java:1869) ~[jasper.jar:8.5.89]
Something is very strange, here.
This is failing either due to a missing default JSPFactory or a missing
compiler.
I can give you another test build to generate some logging, but if you
are doing anything like especially configuring your JSP compiler, using
Tomcat in an embdded environment, etc. then you might want to check all
that config/code before I do another build for you.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Jeremy Nguyen <je...@gmail.com>.
Thanks Chris! That works for me now.
Only issue I have left is failing to compile/validate JSP.
Caused by: java.lang.NullPointerException
>
> at org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(
> Validator.java:527) ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.compiler.Validator.validateExDirectives(
> Validator.java:1869) ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:221)
> ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:375)
> ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
> ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:335)
> ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.JspCompilationContext.compile(
> JspCompilationContext.java:597) ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.servlet.JspServletWrapper.service(
> JspServletWrapper.java:398) ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:383)
> ~[jasper.jar:8.5.89]
>
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:331)
> ~[jasper.jar:8.5.89]
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:583)
> ~[servlet-api.jar:?]
>
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:212) ~[catalina.jar:8.5.89]
>
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:156) ~[catalina.jar:8.5.89]
>
> at
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(
> GlobalAttributeFilter.java:41)
> ~[com.centrify.platform.service.analytics/:?]
>
> at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(
> DelegatingFilterProxy.java:358)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>
> at org.springframework.web.filter.DelegatingFilterProxy.doFilter(
> DelegatingFilterProxy.java:271)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:181) ~[catalina.jar:8.5.89]
>
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:156) ~[catalina.jar:8.5.89]
>
> at org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(
> ExecutionTimeFilter.java:29) ~[org.cg.services.core/:?]
>
> at org.springframework.web.filter.OncePerRequestFilter.doFilter(
> OncePerRequestFilter.java:119)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>
> at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(
> DelegatingFilterProxy.java:358)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>
> at org.springframework.web.filter.DelegatingFilterProxy.doFilter(
> DelegatingFilterProxy.java:271)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:181) ~[catalina.jar:8.5.89]
>
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:156) ~[catalina.jar:8.5.89]
>
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(
> FilterChainProxy.java:317)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(
> FilterSecurityInterceptor.java:127)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(
> FilterSecurityInterceptor.java:91)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(
> FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(
> ExceptionTranslationFilter.java:115)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(
> FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(
> AnonymousAuthenticationFilter.java:112)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(
> FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(
> SecurityContextHolderAwareRequestFilter.java:169)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(
> FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>
> at org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(
> SecurityFilter.java:52) ~[spring-security-pac4j-2.0.0.jar:?]
>
> at org.pac4j.core.engine.DefaultSecurityLogic.perform(
> DefaultSecurityLogic.java:136) ~[pac4j-core-1.9.1.jar:?]
>
> ... 34 more
>
On Wed, May 3, 2023 at 9:07 AM Christopher Schultz <
chris@christopherschultz.net> wrote:
> Jeremy,
>
> On 5/3/23 11:00, jeremyn408@gmail.com wrote:
> > Sure Ill run it.
>
> https://people.apache.org/~schultz/binaries/apache-tomcat-8.5.89-dev.tar.gz
>
> Please note that this is not an official Tomcat release (it's current
> 8.5.x HEAD plus a tiny patch to ignore any null resources obtained from
> the parent ClassLoader). No warranty, you accept all responsibility, etc.
>
> -chris
>
> >> On May 3, 2023, at 7:05 AM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
> >>
> >>
> >> Jeremy,
> >>
> >>> On 5/2/23 22:27, Jeremy Nguyen wrote:
> >>> I was able to retrieve some logs that might shed some insight on the
> >>> parent classloader when running 8.5.87. I'll be frank that I don't
> quite
> >>> understand the mechanics of classloaders in Java.
> >>> LogFactory from
> >>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735]
> [LOOKUP]
> >>>> LogFactory implementation requested for the first time for context
> >>>> classloader
> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
> >>>>
> >>>> [LogFactory from
> >>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735]
> [LOOKUP]
> >>>> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 ==
> >>>> 'ParallelWebappClassLoader
> >>>>
> >>>> context: cg
> >>>>
> >>>> delegate: false
> >>>>
> >>>> ----------> Parent Classloader:
> >>>>
> >>>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@b887730
> >>
> >> I wonder if org.cg.dao.webcontainer.tomcat.WebAppClassLoader has a bug
> where getResources() can return null.
> >>
> >> That violates the contract of ClassLoader.getResources, but since it's
> /possible/ maybe Tomcat can work around it by simply ignoring the empty
> Enumeration. If I give you an unofficial build, can you try it?
> >>
> >> -chris
> >>
> >>>> [LogFactory from
> >>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735]
> [LOOKUP]
> >>>> ClassLoader
> >>>> tree:org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
> -->
> >>>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@193492784 -->
> >>>> jdk.internal.loader.ClassLoaders$AppClassLoader@2085857771 (SYSTEM)
> -->
> >>>> jdk.internal.loader.ClassLoaders$PlatformClassLoader@105966264 -->
> BOOT
> >>>>
> >>>> May 02, 2023 7:23:21 PM org.apache.catalina.core.StandardContext
> >>>> listenerStart
> >>>>
> >>>> SEVERE: Exception sending context initialized event to listener
> instance
> >>>> of class [org.springframework.web.context.ContextLoaderListener]
> >>>>
> >>>> java.lang.NullPointerException
> >>>>
> >>>> at
> >>>>
> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(
> >>>> WebappClassLoaderBase.java:2775)
> >>>>
> >>>> at
> >>>>
> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(
> >>>> WebappClassLoaderBase.java:2760)
> >>>>
> >>>> at org.apache.commons.logging.LogFactory.getConfigurationFile(
> >>>> LogFactory.java:1366)
> >>>>
> >>>> at
> org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:453)
> >>>>
> >>>> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
> >>>>
> >>>> at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(
> >>>> ContextLoader.java:269)
> >>>>
> >>>> at
> >>>>
> org.springframework.web.context.ContextLoaderListener.contextInitialized(
> >>>> ContextLoaderListener.java:103)
> >>>>
> >>>> at org.apache.catalina.core.StandardContext.listenerStart(
> >>>> StandardContext.java:4492)
> >>>>
> >>>> at org.apache.catalina.core.StandardContext.startInternal(
> >>>> StandardContext.java:4950)
> >>>>
> >>>> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
> >>>>
> >>>> at org.apache.catalina.core.ContainerBase.addChildInternal(
> >>>> ContainerBase.java:711)
> >>>>
> >>>> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
> >>>>
> >>>> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
> >>>>
> >>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(
> >>>> TomcatWrapper.java:185)
> >>>>
> >>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(
> >>>> TomcatWrapper.java:140)
> >>>>
> >>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startServer(
> >>>> TomcatWrapper.java:206)
> >>>>
> >>>> at
> org.cg.dao.webcontainer.tomcat.Application.start(Application.java:30)
> >>>>
> >>>> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(
> >>>> EclipseAppHandle.java:203)
> >>>>
> >>>> at
> >>>>
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
> >>>> EclipseAppLauncher.java:136)
> >>>>
> >>>> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
> >>>> EclipseAppLauncher.java:104)
> >>>>
> >>>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
> >>>> EclipseStarter.java:402)
> >>>>
> >>>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
> >>>> EclipseStarter.java:255)
> >>>>
> >>>> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>>> Method)
> >>>>
> >>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
> >>>> NativeMethodAccessorImpl.java:62)
> >>>>
> >>>> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
> >>>> DelegatingMethodAccessorImpl.java:43)
> >>>>
> >>>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> >>>>
> >>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
> >>>>
> >>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
> >>>>
> >>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
> >>>>
> >>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
> >>>>
> >>>> On Tue, May 2, 2023 at 6:18 PM Jeremy Nguyen <je...@gmail.com>
> wrote:
> >>>> I picked 8.5.34 because 8.5.35 has that code change while 34
> doesn't.
> >>>>
> https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
> >>>>
> >>>> I'll do some debugging for the classloader soon. I'm still trying to
> get
> >>>> my application running. I'm wrestling with the following error at
> runtime.
> >>>>
> >>>> Caused by: org.apache.jasper.JasperException: Unable to compile class
> for
> >>>>> JSP
> >>>>> at
> >>>>>
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> >>>>> ~[servlet-api.jar:?]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
> >>>>> ~[com.centrify.platform.service.analytics/:?]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
> >>>>> ~[org.cg.services.core/:?]
> >>>>> at
> >>>>>
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
> >>>>> ~[spring-security-pac4j-2.0.0.jar:?]
> >>>>> at
> >>>>>
> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
> >>>>> ~[pac4j-core-1.9.1.jar:?]
> >>>>> ... 34 more
> >>>>> Caused by: java.lang.NullPointerException
> >>>>> at
> >>>>>
> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> >>>>> ~[jasper.jar:8.5.34]
> >>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> >>>>> ~[servlet-api.jar:?]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
> >>>>> ~[com.centrify.platform.service.analytics/:?]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
> >>>>> ~[org.cg.services.core/:?]
> >>>>> at
> >>>>>
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> >>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >>>>> ~[catalina.jar:8.5.34]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> >>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> >>>>> at
> >>>>>
> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
> >>>>> ~[spring-security-pac4j-2.0.0.jar:?]
> >>>>> at
> >>>>>
> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
> >>>>> ~[pac4j-core-1.9.1.jar:?]
> >>>>> ... 34 more
> >>>>
> >>>>
> >>>> On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
> >>>> chris@christopherschultz.net> wrote:
> >>>>
> >>>>> Jeremy,
> >>>>>
> >>>>> On 5/1/23 17:46, Jeremy Nguyen wrote:
> >>>>>> I noticed this change was introduced:
> >>>>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
> >>>>>>
> >>>>>
> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
> >>>>>>
> >>>>>> I'll try running 8.5.34 and report back.
> >>>>>
> >>>>> Wow that's ancient. What made you pick 8.5.34? That change should
> have
> >>>>> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
> >>>>> which (if either) works?
> >>>>>
> >>>>> I wonder if the parent ClassLoader is violating the contract for
> >>>>> getResources().
> >>>>>
> >>>>> Jeremy, can you throw some code into your application that runs early
> >>>>> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp)
> that
> >>>>> reports the class name of thew parent ClassLoader for the
> >>>>> WebappClassLoader being used for the webapp?
> >>>>>
> >>>>> If you aren't able to do that -- and since you are running from
> Eclipse
> >>>>> -- try putting a breakpoint in WebappClassLoaderBase.getResources
> >>>>> and just inspecting the situation at that point -- you should be
> able
> >>>>> to see what the parent ClassLoader is, and even see what
> >>>>> getParent().getResources() returns.
> >>>>>
> >>>>> -chris
> >>>>>
> >>>>>> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
> >>>>> wrote:
> >>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On 5/1/23 14:36, Christopher Schultz wrote:
> >>>>>>>> Jeremy,
> >>>>>>>>
> >>>>>>>> On 5/1/23 14:22, Jeremy Nguyen wrote:
> >>>>>>>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
> >>>>>>>>> nullpointerexception within
> >>>>>>>>> WebappClassLoaderBase.CombinedEnumeration.inc.
> >>>>>>>>> It seems to occur when it's trying to initialize commons-logging
> >>>>>>>>> LogFactory
> >>>>>>>>> for any class specified in Web.xml, and it's calling
> >>>>>>>>> getResources("commons-logging.properties") which I never had. Is
> it
> >>>>>>>>> required in 8.5? Even if I put it in conf/, it's not being
> picked up.
> >>>>>>>>>
> >>>>>>>>> We're running Tomcat using a wrapper and it's erroring out here:
> >>>>>>>>>
> >>>>>>>
> >>>>>
> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> I posted my web.xml and error trace here as well:
> >>>>>>>>>
> >>>>>>>
> >>>>>
> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> I have no idea how this is throwing an NPE. The only pointer being
> >>>>>>>> dereferenced by the inc() method is "sources":
> >>>>>>>>
> >>>>>>>> 2773 private boolean inc() {
> >>>>>>>> 2774 while (index < sources.length) {
> >>>>>>>> 2775 if (sources[index].hasMoreElements()) {
> >>>>>>>> 2776 return true;
> >>>>>>>> 2777 }
> >>>>>>>> 2778 index++;
> >>>>>>>> 2779 }
> >>>>>>>> 2780 return false;
> >>>>>>>> 2781 }
> >>>>>>>>
> >>>>>>>> That member (sources) is instantiated in the one-and-only-one
> >>>>>>>> constructor:
> >>>>>>>>
> >>>>>>>> CombinedEnumeration(Enumeration<URL> enum1,
> Enumeration<URL>
> >>>>>>>> enum2) {
> >>>>>>>> @SuppressWarnings("unchecked")
> >>>>>>>> Enumeration<URL>[] sources = new Enumeration[] {
> enum1,
> >>>>>>>> enum2 };
> >>>>>>>> this.sources = sources;
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> Also weird is that this throws NPE on line 2775 and not 2774. I
> can't
> >>>>>>>> explain how line 2775 could throw an NPE if line 2774 did not.
> >>>>>>>>
> >>>>>>>>> :/
> >>>>>>>
> >>>>>>> Is the null pointer in the index'th position of source, not source
> >>>>> itself?
> >>>>>>>
> >>>>>>>>
> >>>>>>>> I use Tomcat 8.5.x and I have never had a
> commons-logging.properties
> >>>>>>>> file, and I use some components which are surely causing
> >>>>>>>> commons-logging LogFactory to initialize, and I've never seen this
> >>>>>>>> problem before.
> >>>>>>>>
> >>>>>>>> -chris
> >>>>>>>>
> >>>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>
> >>>>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jeremy,
On 5/3/23 11:00, jeremyn408@gmail.com wrote:
> Sure Ill run it.
https://people.apache.org/~schultz/binaries/apache-tomcat-8.5.89-dev.tar.gz
Please note that this is not an official Tomcat release (it's current
8.5.x HEAD plus a tiny patch to ignore any null resources obtained from
the parent ClassLoader). No warranty, you accept all responsibility, etc.
-chris
>> On May 3, 2023, at 7:05 AM, Christopher Schultz <ch...@christopherschultz.net> wrote:
>>
>>
>> Jeremy,
>>
>>> On 5/2/23 22:27, Jeremy Nguyen wrote:
>>> I was able to retrieve some logs that might shed some insight on the
>>> parent classloader when running 8.5.87. I'll be frank that I don't quite
>>> understand the mechanics of classloaders in Java.
>>> LogFactory from
>>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>>>> LogFactory implementation requested for the first time for context
>>>> classloader org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
>>>>
>>>> [LogFactory from
>>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>>>> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 ==
>>>> 'ParallelWebappClassLoader
>>>>
>>>> context: cg
>>>>
>>>> delegate: false
>>>>
>>>> ----------> Parent Classloader:
>>>>
>>>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@b887730
>>
>> I wonder if org.cg.dao.webcontainer.tomcat.WebAppClassLoader has a bug where getResources() can return null.
>>
>> That violates the contract of ClassLoader.getResources, but since it's /possible/ maybe Tomcat can work around it by simply ignoring the empty Enumeration. If I give you an unofficial build, can you try it?
>>
>> -chris
>>
>>>> [LogFactory from
>>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>>>> ClassLoader
>>>> tree:org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 -->
>>>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@193492784 -->
>>>> jdk.internal.loader.ClassLoaders$AppClassLoader@2085857771 (SYSTEM) -->
>>>> jdk.internal.loader.ClassLoaders$PlatformClassLoader@105966264 --> BOOT
>>>>
>>>> May 02, 2023 7:23:21 PM org.apache.catalina.core.StandardContext
>>>> listenerStart
>>>>
>>>> SEVERE: Exception sending context initialized event to listener instance
>>>> of class [org.springframework.web.context.ContextLoaderListener]
>>>>
>>>> java.lang.NullPointerException
>>>>
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(
>>>> WebappClassLoaderBase.java:2775)
>>>>
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(
>>>> WebappClassLoaderBase.java:2760)
>>>>
>>>> at org.apache.commons.logging.LogFactory.getConfigurationFile(
>>>> LogFactory.java:1366)
>>>>
>>>> at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:453)
>>>>
>>>> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
>>>>
>>>> at org.springframework.web.context.ContextLoader.initWebApplicationContext(
>>>> ContextLoader.java:269)
>>>>
>>>> at
>>>> org.springframework.web.context.ContextLoaderListener.contextInitialized(
>>>> ContextLoaderListener.java:103)
>>>>
>>>> at org.apache.catalina.core.StandardContext.listenerStart(
>>>> StandardContext.java:4492)
>>>>
>>>> at org.apache.catalina.core.StandardContext.startInternal(
>>>> StandardContext.java:4950)
>>>>
>>>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>>>
>>>> at org.apache.catalina.core.ContainerBase.addChildInternal(
>>>> ContainerBase.java:711)
>>>>
>>>> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
>>>>
>>>> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
>>>>
>>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(
>>>> TomcatWrapper.java:185)
>>>>
>>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(
>>>> TomcatWrapper.java:140)
>>>>
>>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startServer(
>>>> TomcatWrapper.java:206)
>>>>
>>>> at org.cg.dao.webcontainer.tomcat.Application.start(Application.java:30)
>>>>
>>>> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(
>>>> EclipseAppHandle.java:203)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
>>>> EclipseAppLauncher.java:136)
>>>>
>>>> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
>>>> EclipseAppLauncher.java:104)
>>>>
>>>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
>>>> EclipseStarter.java:402)
>>>>
>>>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
>>>> EclipseStarter.java:255)
>>>>
>>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>
>>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
>>>> NativeMethodAccessorImpl.java:62)
>>>>
>>>> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
>>>> DelegatingMethodAccessorImpl.java:43)
>>>>
>>>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>>>>
>>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
>>>>
>>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
>>>>
>>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
>>>>
>>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
>>>>
>>>> On Tue, May 2, 2023 at 6:18 PM Jeremy Nguyen <je...@gmail.com> wrote:
>>>> I picked 8.5.34 because 8.5.35 has that code change while 34 doesn't.
>>>> https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
>>>>
>>>> I'll do some debugging for the classloader soon. I'm still trying to get
>>>> my application running. I'm wrestling with the following error at runtime.
>>>>
>>>> Caused by: org.apache.jasper.JasperException: Unable to compile class for
>>>>> JSP
>>>>> at
>>>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at
>>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at
>>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>>>>> ~[servlet-api.jar:?]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>>>>> ~[com.centrify.platform.service.analytics/:?]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>>>>> ~[org.cg.services.core/:?]
>>>>> at
>>>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>>>>> ~[spring-security-pac4j-2.0.0.jar:?]
>>>>> at
>>>>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>>>>> ~[pac4j-core-1.9.1.jar:?]
>>>>> ... 34 more
>>>>> Caused by: java.lang.NullPointerException
>>>>> at
>>>>> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at
>>>>> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at
>>>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at
>>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at
>>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>>>>> ~[jasper.jar:8.5.34]
>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>>>>> ~[servlet-api.jar:?]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>>>>> ~[com.centrify.platform.service.analytics/:?]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>>>>> ~[org.cg.services.core/:?]
>>>>> at
>>>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>>> ~[catalina.jar:8.5.34]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>>> at
>>>>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>>>>> ~[spring-security-pac4j-2.0.0.jar:?]
>>>>> at
>>>>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>>>>> ~[pac4j-core-1.9.1.jar:?]
>>>>> ... 34 more
>>>>
>>>>
>>>> On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
>>>> chris@christopherschultz.net> wrote:
>>>>
>>>>> Jeremy,
>>>>>
>>>>> On 5/1/23 17:46, Jeremy Nguyen wrote:
>>>>>> I noticed this change was introduced:
>>>>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
>>>>>>
>>>>> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
>>>>>>
>>>>>> I'll try running 8.5.34 and report back.
>>>>>
>>>>> Wow that's ancient. What made you pick 8.5.34? That change should have
>>>>> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
>>>>> which (if either) works?
>>>>>
>>>>> I wonder if the parent ClassLoader is violating the contract for
>>>>> getResources().
>>>>>
>>>>> Jeremy, can you throw some code into your application that runs early
>>>>> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp) that
>>>>> reports the class name of thew parent ClassLoader for the
>>>>> WebappClassLoader being used for the webapp?
>>>>>
>>>>> If you aren't able to do that -- and since you are running from Eclipse
>>>>> -- try putting a breakpoint in WebappClassLoaderBase.getResources
>>>>> and just inspecting the situation at that point -- you should be able
>>>>> to see what the parent ClassLoader is, and even see what
>>>>> getParent().getResources() returns.
>>>>>
>>>>> -chris
>>>>>
>>>>>> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
>>>>> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 5/1/23 14:36, Christopher Schultz wrote:
>>>>>>>> Jeremy,
>>>>>>>>
>>>>>>>> On 5/1/23 14:22, Jeremy Nguyen wrote:
>>>>>>>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>>>>>>>>> nullpointerexception within
>>>>>>>>> WebappClassLoaderBase.CombinedEnumeration.inc.
>>>>>>>>> It seems to occur when it's trying to initialize commons-logging
>>>>>>>>> LogFactory
>>>>>>>>> for any class specified in Web.xml, and it's calling
>>>>>>>>> getResources("commons-logging.properties") which I never had. Is it
>>>>>>>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>>>>>>>>>
>>>>>>>>> We're running Tomcat using a wrapper and it's erroring out here:
>>>>>>>>>
>>>>>>>
>>>>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I posted my web.xml and error trace here as well:
>>>>>>>>>
>>>>>>>
>>>>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>>>>>>>>>
>>>>>>>>
>>>>>>>> I have no idea how this is throwing an NPE. The only pointer being
>>>>>>>> dereferenced by the inc() method is "sources":
>>>>>>>>
>>>>>>>> 2773 private boolean inc() {
>>>>>>>> 2774 while (index < sources.length) {
>>>>>>>> 2775 if (sources[index].hasMoreElements()) {
>>>>>>>> 2776 return true;
>>>>>>>> 2777 }
>>>>>>>> 2778 index++;
>>>>>>>> 2779 }
>>>>>>>> 2780 return false;
>>>>>>>> 2781 }
>>>>>>>>
>>>>>>>> That member (sources) is instantiated in the one-and-only-one
>>>>>>>> constructor:
>>>>>>>>
>>>>>>>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>>>>>>>> enum2) {
>>>>>>>> @SuppressWarnings("unchecked")
>>>>>>>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
>>>>>>>> enum2 };
>>>>>>>> this.sources = sources;
>>>>>>>> }
>>>>>>>>
>>>>>>>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
>>>>>>>> explain how line 2775 could throw an NPE if line 2774 did not.
>>>>>>>>
>>>>>>>>> :/
>>>>>>>
>>>>>>> Is the null pointer in the index'th position of source, not source
>>>>> itself?
>>>>>>>
>>>>>>>>
>>>>>>>> I use Tomcat 8.5.x and I have never had a commons-logging.properties
>>>>>>>> file, and I use some components which are surely causing
>>>>>>>> commons-logging LogFactory to initialize, and I've never seen this
>>>>>>>> problem before.
>>>>>>>>
>>>>>>>> -chris
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by je...@gmail.com.
Sure Ill run it.
- Jeremy
> On May 3, 2023, at 7:05 AM, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
>
> Jeremy,
>
>> On 5/2/23 22:27, Jeremy Nguyen wrote:
>> I was able to retrieve some logs that might shed some insight on the
>> parent classloader when running 8.5.87. I'll be frank that I don't quite
>> understand the mechanics of classloaders in Java.
>> LogFactory from
>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>>> LogFactory implementation requested for the first time for context
>>> classloader org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
>>>
>>> [LogFactory from
>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>>> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 ==
>>> 'ParallelWebappClassLoader
>>>
>>> context: cg
>>>
>>> delegate: false
>>>
>>> ----------> Parent Classloader:
>>>
>>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@b887730
>
> I wonder if org.cg.dao.webcontainer.tomcat.WebAppClassLoader has a bug where getResources() can return null.
>
> That violates the contract of ClassLoader.getResources, but since it's /possible/ maybe Tomcat can work around it by simply ignoring the empty Enumeration. If I give you an unofficial build, can you try it?
>
> -chris
>
>>> [LogFactory from
>>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>>> ClassLoader
>>> tree:org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 -->
>>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@193492784 -->
>>> jdk.internal.loader.ClassLoaders$AppClassLoader@2085857771 (SYSTEM) -->
>>> jdk.internal.loader.ClassLoaders$PlatformClassLoader@105966264 --> BOOT
>>>
>>> May 02, 2023 7:23:21 PM org.apache.catalina.core.StandardContext
>>> listenerStart
>>>
>>> SEVERE: Exception sending context initialized event to listener instance
>>> of class [org.springframework.web.context.ContextLoaderListener]
>>>
>>> java.lang.NullPointerException
>>>
>>> at
>>> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(
>>> WebappClassLoaderBase.java:2775)
>>>
>>> at
>>> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(
>>> WebappClassLoaderBase.java:2760)
>>>
>>> at org.apache.commons.logging.LogFactory.getConfigurationFile(
>>> LogFactory.java:1366)
>>>
>>> at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:453)
>>>
>>> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
>>>
>>> at org.springframework.web.context.ContextLoader.initWebApplicationContext(
>>> ContextLoader.java:269)
>>>
>>> at
>>> org.springframework.web.context.ContextLoaderListener.contextInitialized(
>>> ContextLoaderListener.java:103)
>>>
>>> at org.apache.catalina.core.StandardContext.listenerStart(
>>> StandardContext.java:4492)
>>>
>>> at org.apache.catalina.core.StandardContext.startInternal(
>>> StandardContext.java:4950)
>>>
>>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>>
>>> at org.apache.catalina.core.ContainerBase.addChildInternal(
>>> ContainerBase.java:711)
>>>
>>> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
>>>
>>> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
>>>
>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(
>>> TomcatWrapper.java:185)
>>>
>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(
>>> TomcatWrapper.java:140)
>>>
>>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startServer(
>>> TomcatWrapper.java:206)
>>>
>>> at org.cg.dao.webcontainer.tomcat.Application.start(Application.java:30)
>>>
>>> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(
>>> EclipseAppHandle.java:203)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
>>> EclipseAppLauncher.java:136)
>>>
>>> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
>>> EclipseAppLauncher.java:104)
>>>
>>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
>>> EclipseStarter.java:402)
>>>
>>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
>>> EclipseStarter.java:255)
>>>
>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)
>>>
>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
>>> NativeMethodAccessorImpl.java:62)
>>>
>>> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
>>> DelegatingMethodAccessorImpl.java:43)
>>>
>>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>>>
>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
>>>
>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
>>>
>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
>>>
>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
>>>
>>> On Tue, May 2, 2023 at 6:18 PM Jeremy Nguyen <je...@gmail.com> wrote:
>>> I picked 8.5.34 because 8.5.35 has that code change while 34 doesn't.
>>> https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
>>>
>>> I'll do some debugging for the classloader soon. I'm still trying to get
>>> my application running. I'm wrestling with the following error at runtime.
>>>
>>> Caused by: org.apache.jasper.JasperException: Unable to compile class for
>>>> JSP
>>>> at
>>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
>>>> ~[jasper.jar:8.5.34]
>>>> at
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>>>> ~[jasper.jar:8.5.34]
>>>> at
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>>>> ~[jasper.jar:8.5.34]
>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>>>> ~[jasper.jar:8.5.34]
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>>>> ~[servlet-api.jar:?]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>>>> ~[com.centrify.platform.service.analytics/:?]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>>>> ~[org.cg.services.core/:?]
>>>> at
>>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>>>> ~[spring-security-pac4j-2.0.0.jar:?]
>>>> at
>>>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>>>> ~[pac4j-core-1.9.1.jar:?]
>>>> ... 34 more
>>>> Caused by: java.lang.NullPointerException
>>>> at
>>>> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
>>>> ~[jasper.jar:8.5.34]
>>>> at
>>>> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
>>>> ~[jasper.jar:8.5.34]
>>>> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
>>>> ~[jasper.jar:8.5.34]
>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
>>>> ~[jasper.jar:8.5.34]
>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
>>>> ~[jasper.jar:8.5.34]
>>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
>>>> ~[jasper.jar:8.5.34]
>>>> at
>>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
>>>> ~[jasper.jar:8.5.34]
>>>> at
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>>>> ~[jasper.jar:8.5.34]
>>>> at
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>>>> ~[jasper.jar:8.5.34]
>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>>>> ~[jasper.jar:8.5.34]
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>>>> ~[servlet-api.jar:?]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>>>> ~[com.centrify.platform.service.analytics/:?]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>>>> ~[org.cg.services.core/:?]
>>>> at
>>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>>> ~[catalina.jar:8.5.34]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>>> at
>>>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>>>> ~[spring-security-pac4j-2.0.0.jar:?]
>>>> at
>>>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>>>> ~[pac4j-core-1.9.1.jar:?]
>>>> ... 34 more
>>>
>>>
>>> On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
>>> chris@christopherschultz.net> wrote:
>>>
>>>> Jeremy,
>>>>
>>>> On 5/1/23 17:46, Jeremy Nguyen wrote:
>>>>> I noticed this change was introduced:
>>>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
>>>>>
>>>> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
>>>>>
>>>>> I'll try running 8.5.34 and report back.
>>>>
>>>> Wow that's ancient. What made you pick 8.5.34? That change should have
>>>> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
>>>> which (if either) works?
>>>>
>>>> I wonder if the parent ClassLoader is violating the contract for
>>>> getResources().
>>>>
>>>> Jeremy, can you throw some code into your application that runs early
>>>> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp) that
>>>> reports the class name of thew parent ClassLoader for the
>>>> WebappClassLoader being used for the webapp?
>>>>
>>>> If you aren't able to do that -- and since you are running from Eclipse
>>>> -- try putting a breakpoint in WebappClassLoaderBase.getResources
>>>> and just inspecting the situation at that point -- you should be able
>>>> to see what the parent ClassLoader is, and even see what
>>>> getParent().getResources() returns.
>>>>
>>>> -chris
>>>>
>>>>> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
>>>> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On 5/1/23 14:36, Christopher Schultz wrote:
>>>>>>> Jeremy,
>>>>>>>
>>>>>>> On 5/1/23 14:22, Jeremy Nguyen wrote:
>>>>>>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>>>>>>>> nullpointerexception within
>>>>>>>> WebappClassLoaderBase.CombinedEnumeration.inc.
>>>>>>>> It seems to occur when it's trying to initialize commons-logging
>>>>>>>> LogFactory
>>>>>>>> for any class specified in Web.xml, and it's calling
>>>>>>>> getResources("commons-logging.properties") which I never had. Is it
>>>>>>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>>>>>>>>
>>>>>>>> We're running Tomcat using a wrapper and it's erroring out here:
>>>>>>>>
>>>>>>
>>>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>>>>>>>>
>>>>>>>>
>>>>>>>> I posted my web.xml and error trace here as well:
>>>>>>>>
>>>>>>
>>>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>>>>>>>>
>>>>>>>
>>>>>>> I have no idea how this is throwing an NPE. The only pointer being
>>>>>>> dereferenced by the inc() method is "sources":
>>>>>>>
>>>>>>> 2773 private boolean inc() {
>>>>>>> 2774 while (index < sources.length) {
>>>>>>> 2775 if (sources[index].hasMoreElements()) {
>>>>>>> 2776 return true;
>>>>>>> 2777 }
>>>>>>> 2778 index++;
>>>>>>> 2779 }
>>>>>>> 2780 return false;
>>>>>>> 2781 }
>>>>>>>
>>>>>>> That member (sources) is instantiated in the one-and-only-one
>>>>>>> constructor:
>>>>>>>
>>>>>>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>>>>>>> enum2) {
>>>>>>> @SuppressWarnings("unchecked")
>>>>>>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
>>>>>>> enum2 };
>>>>>>> this.sources = sources;
>>>>>>> }
>>>>>>>
>>>>>>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
>>>>>>> explain how line 2775 could throw an NPE if line 2774 did not.
>>>>>>>
>>>>>>>> :/
>>>>>>
>>>>>> Is the null pointer in the index'th position of source, not source
>>>> itself?
>>>>>>
>>>>>>>
>>>>>>> I use Tomcat 8.5.x and I have never had a commons-logging.properties
>>>>>>> file, and I use some components which are surely causing
>>>>>>> commons-logging LogFactory to initialize, and I've never seen this
>>>>>>> problem before.
>>>>>>>
>>>>>>> -chris
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jeremy,
On 5/2/23 22:27, Jeremy Nguyen wrote:
> I was able to retrieve some logs that might shed some insight on the
> parent classloader when running 8.5.87. I'll be frank that I don't quite
> understand the mechanics of classloaders in Java.
>
> LogFactory from
>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>> LogFactory implementation requested for the first time for context
>> classloader org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
>>
>> [LogFactory from
>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 ==
>> 'ParallelWebappClassLoader
>>
>> context: cg
>>
>> delegate: false
>>
>> ----------> Parent Classloader:
>>
>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@b887730
I wonder if org.cg.dao.webcontainer.tomcat.WebAppClassLoader has a bug
where getResources() can return null.
That violates the contract of ClassLoader.getResources, but since it's
/possible/ maybe Tomcat can work around it by simply ignoring the empty
Enumeration. If I give you an unofficial build, can you try it?
-chris
>> [LogFactory from
>> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
>> ClassLoader
>> tree:org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 -->
>> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@193492784 -->
>> jdk.internal.loader.ClassLoaders$AppClassLoader@2085857771 (SYSTEM) -->
>> jdk.internal.loader.ClassLoaders$PlatformClassLoader@105966264 --> BOOT
>>
>> May 02, 2023 7:23:21 PM org.apache.catalina.core.StandardContext
>> listenerStart
>>
>> SEVERE: Exception sending context initialized event to listener instance
>> of class [org.springframework.web.context.ContextLoaderListener]
>>
>> java.lang.NullPointerException
>>
>> at
>> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(
>> WebappClassLoaderBase.java:2775)
>>
>> at
>> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(
>> WebappClassLoaderBase.java:2760)
>>
>> at org.apache.commons.logging.LogFactory.getConfigurationFile(
>> LogFactory.java:1366)
>>
>> at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:453)
>>
>> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
>>
>> at org.springframework.web.context.ContextLoader.initWebApplicationContext(
>> ContextLoader.java:269)
>>
>> at
>> org.springframework.web.context.ContextLoaderListener.contextInitialized(
>> ContextLoaderListener.java:103)
>>
>> at org.apache.catalina.core.StandardContext.listenerStart(
>> StandardContext.java:4492)
>>
>> at org.apache.catalina.core.StandardContext.startInternal(
>> StandardContext.java:4950)
>>
>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>
>> at org.apache.catalina.core.ContainerBase.addChildInternal(
>> ContainerBase.java:711)
>>
>> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
>>
>> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
>>
>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(
>> TomcatWrapper.java:185)
>>
>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(
>> TomcatWrapper.java:140)
>>
>> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startServer(
>> TomcatWrapper.java:206)
>>
>> at org.cg.dao.webcontainer.tomcat.Application.start(Application.java:30)
>>
>> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(
>> EclipseAppHandle.java:203)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
>> EclipseAppLauncher.java:136)
>>
>> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
>> EclipseAppLauncher.java:104)
>>
>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
>> EclipseStarter.java:402)
>>
>> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
>> EclipseStarter.java:255)
>>
>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>
>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>>
>> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>>
>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
>>
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
>>
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
>>
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
>>
>
> On Tue, May 2, 2023 at 6:18 PM Jeremy Nguyen <je...@gmail.com> wrote:
>
>> I picked 8.5.34 because 8.5.35 has that code change while 34 doesn't.
>> https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
>>
>> I'll do some debugging for the classloader soon. I'm still trying to get
>> my application running. I'm wrestling with the following error at runtime.
>>
>> Caused by: org.apache.jasper.JasperException: Unable to compile class for
>>> JSP
>>> at
>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
>>> ~[jasper.jar:8.5.34]
>>> at
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>>> ~[jasper.jar:8.5.34]
>>> at
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>>> ~[jasper.jar:8.5.34]
>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>>> ~[jasper.jar:8.5.34]
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>>> ~[servlet-api.jar:?]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>>> ~[com.centrify.platform.service.analytics/:?]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>>> ~[org.cg.services.core/:?]
>>> at
>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>>> ~[spring-security-pac4j-2.0.0.jar:?]
>>> at
>>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>>> ~[pac4j-core-1.9.1.jar:?]
>>> ... 34 more
>>> Caused by: java.lang.NullPointerException
>>> at
>>> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
>>> ~[jasper.jar:8.5.34]
>>> at
>>> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
>>> ~[jasper.jar:8.5.34]
>>> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
>>> ~[jasper.jar:8.5.34]
>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
>>> ~[jasper.jar:8.5.34]
>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
>>> ~[jasper.jar:8.5.34]
>>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
>>> ~[jasper.jar:8.5.34]
>>> at
>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
>>> ~[jasper.jar:8.5.34]
>>> at
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>>> ~[jasper.jar:8.5.34]
>>> at
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>>> ~[jasper.jar:8.5.34]
>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>>> ~[jasper.jar:8.5.34]
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>>> ~[servlet-api.jar:?]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>>> ~[com.centrify.platform.service.analytics/:?]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>>> ~[org.cg.services.core/:?]
>>> at
>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>>> ~[catalina.jar:8.5.34]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>>> at
>>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>>> ~[spring-security-pac4j-2.0.0.jar:?]
>>> at
>>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>>> ~[pac4j-core-1.9.1.jar:?]
>>> ... 34 more
>>
>>
>> On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
>> chris@christopherschultz.net> wrote:
>>
>>> Jeremy,
>>>
>>> On 5/1/23 17:46, Jeremy Nguyen wrote:
>>>> I noticed this change was introduced:
>>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
>>>>
>>> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
>>>>
>>>> I'll try running 8.5.34 and report back.
>>>
>>> Wow that's ancient. What made you pick 8.5.34? That change should have
>>> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
>>> which (if either) works?
>>>
>>> I wonder if the parent ClassLoader is violating the contract for
>>> getResources().
>>>
>>> Jeremy, can you throw some code into your application that runs early
>>> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp) that
>>> reports the class name of thew parent ClassLoader for the
>>> WebappClassLoader being used for the webapp?
>>>
>>> If you aren't able to do that -- and since you are running from Eclipse
>>> -- try putting a breakpoint in WebappClassLoaderBase.getResources
>>> and just inspecting the situation at that point -- you should be able
>>> to see what the parent ClassLoader is, and even see what
>>> getParent().getResources() returns.
>>>
>>> -chris
>>>
>>>> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> On 5/1/23 14:36, Christopher Schultz wrote:
>>>>>> Jeremy,
>>>>>>
>>>>>> On 5/1/23 14:22, Jeremy Nguyen wrote:
>>>>>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>>>>>>> nullpointerexception within
>>>>>>> WebappClassLoaderBase.CombinedEnumeration.inc.
>>>>>>> It seems to occur when it's trying to initialize commons-logging
>>>>>>> LogFactory
>>>>>>> for any class specified in Web.xml, and it's calling
>>>>>>> getResources("commons-logging.properties") which I never had. Is it
>>>>>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>>>>>>>
>>>>>>> We're running Tomcat using a wrapper and it's erroring out here:
>>>>>>>
>>>>>
>>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>>>>>>>
>>>>>>>
>>>>>>> I posted my web.xml and error trace here as well:
>>>>>>>
>>>>>
>>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>>>>>>>
>>>>>>
>>>>>> I have no idea how this is throwing an NPE. The only pointer being
>>>>>> dereferenced by the inc() method is "sources":
>>>>>>
>>>>>> 2773 private boolean inc() {
>>>>>> 2774 while (index < sources.length) {
>>>>>> 2775 if (sources[index].hasMoreElements()) {
>>>>>> 2776 return true;
>>>>>> 2777 }
>>>>>> 2778 index++;
>>>>>> 2779 }
>>>>>> 2780 return false;
>>>>>> 2781 }
>>>>>>
>>>>>> That member (sources) is instantiated in the one-and-only-one
>>>>>> constructor:
>>>>>>
>>>>>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>>>>>> enum2) {
>>>>>> @SuppressWarnings("unchecked")
>>>>>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
>>>>>> enum2 };
>>>>>> this.sources = sources;
>>>>>> }
>>>>>>
>>>>>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
>>>>>> explain how line 2775 could throw an NPE if line 2774 did not.
>>>>>>
>>>>>>> :/
>>>>>
>>>>> Is the null pointer in the index'th position of source, not source
>>> itself?
>>>>>
>>>>>>
>>>>>> I use Tomcat 8.5.x and I have never had a commons-logging.properties
>>>>>> file, and I use some components which are surely causing
>>>>>> commons-logging LogFactory to initialize, and I've never seen this
>>>>>> problem before.
>>>>>>
>>>>>> -chris
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Jeremy Nguyen <je...@gmail.com>.
I was able to retrieve some logs that might shed some insight on the
parent classloader when running 8.5.87. I'll be frank that I don't quite
understand the mechanics of classloaders in Java.
LogFactory from
> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
> LogFactory implementation requested for the first time for context
> classloader org.apache.catalina.loader.ParallelWebappClassLoader@1204822967
>
> [LogFactory from
> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
> org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 ==
> 'ParallelWebappClassLoader
>
> context: cg
>
> delegate: false
>
> ----------> Parent Classloader:
>
> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@b887730
>
> '
>
> [LogFactory from
> org.eclipse.osgi.internal.loader.EquinoxClassLoader@1628551735] [LOOKUP]
> ClassLoader
> tree:org.apache.catalina.loader.ParallelWebappClassLoader@1204822967 -->
> org.cg.dao.webcontainer.tomcat.WebAppClassLoader@193492784 -->
> jdk.internal.loader.ClassLoaders$AppClassLoader@2085857771 (SYSTEM) -->
> jdk.internal.loader.ClassLoaders$PlatformClassLoader@105966264 --> BOOT
>
> May 02, 2023 7:23:21 PM org.apache.catalina.core.StandardContext
> listenerStart
>
> SEVERE: Exception sending context initialized event to listener instance
> of class [org.springframework.web.context.ContextLoaderListener]
>
> java.lang.NullPointerException
>
> at
> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(
> WebappClassLoaderBase.java:2775)
>
> at
> org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(
> WebappClassLoaderBase.java:2760)
>
> at org.apache.commons.logging.LogFactory.getConfigurationFile(
> LogFactory.java:1366)
>
> at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:453)
>
> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
>
> at org.springframework.web.context.ContextLoader.initWebApplicationContext(
> ContextLoader.java:269)
>
> at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(
> ContextLoaderListener.java:103)
>
> at org.apache.catalina.core.StandardContext.listenerStart(
> StandardContext.java:4492)
>
> at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:4950)
>
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>
> at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:711)
>
> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
>
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
>
> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(
> TomcatWrapper.java:185)
>
> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(
> TomcatWrapper.java:140)
>
> at org.cg.dao.webcontainer.tomcat.TomcatWrapper.startServer(
> TomcatWrapper.java:206)
>
> at org.cg.dao.webcontainer.tomcat.Application.start(Application.java:30)
>
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(
> EclipseAppHandle.java:203)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
> EclipseAppLauncher.java:136)
>
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
> EclipseAppLauncher.java:104)
>
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
> EclipseStarter.java:402)
>
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(
> EclipseStarter.java:255)
>
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
>
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
>
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
>
> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
>
> at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
>
On Tue, May 2, 2023 at 6:18 PM Jeremy Nguyen <je...@gmail.com> wrote:
> I picked 8.5.34 because 8.5.35 has that code change while 34 doesn't.
> https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
>
> I'll do some debugging for the classloader soon. I'm still trying to get
> my application running. I'm wrestling with the following error at runtime.
>
> Caused by: org.apache.jasper.JasperException: Unable to compile class for
>> JSP
>> at
>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
>> ~[jasper.jar:8.5.34]
>> at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>> ~[jasper.jar:8.5.34]
>> at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>> ~[jasper.jar:8.5.34]
>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>> ~[jasper.jar:8.5.34]
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>> ~[servlet-api.jar:?]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>> ~[catalina.jar:8.5.34]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>> ~[catalina.jar:8.5.34]
>> at
>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>> ~[com.centrify.platform.service.analytics/:?]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>> ~[catalina.jar:8.5.34]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>> ~[catalina.jar:8.5.34]
>> at
>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>> ~[org.cg.services.core/:?]
>> at
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>> ~[catalina.jar:8.5.34]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>> ~[catalina.jar:8.5.34]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>> ~[spring-security-pac4j-2.0.0.jar:?]
>> at
>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>> ~[pac4j-core-1.9.1.jar:?]
>> ... 34 more
>> Caused by: java.lang.NullPointerException
>> at
>> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
>> ~[jasper.jar:8.5.34]
>> at
>> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
>> ~[jasper.jar:8.5.34]
>> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
>> ~[jasper.jar:8.5.34]
>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
>> ~[jasper.jar:8.5.34]
>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
>> ~[jasper.jar:8.5.34]
>> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
>> ~[jasper.jar:8.5.34]
>> at
>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
>> ~[jasper.jar:8.5.34]
>> at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
>> ~[jasper.jar:8.5.34]
>> at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
>> ~[jasper.jar:8.5.34]
>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
>> ~[jasper.jar:8.5.34]
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>> ~[servlet-api.jar:?]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>> ~[catalina.jar:8.5.34]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>> ~[catalina.jar:8.5.34]
>> at
>> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
>> ~[com.centrify.platform.service.analytics/:?]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>> ~[catalina.jar:8.5.34]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>> ~[catalina.jar:8.5.34]
>> at
>> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
>> ~[org.cg.services.core/:?]
>> at
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
>> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>> ~[catalina.jar:8.5.34]
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>> ~[catalina.jar:8.5.34]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
>> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
>> at
>> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
>> ~[spring-security-pac4j-2.0.0.jar:?]
>> at
>> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
>> ~[pac4j-core-1.9.1.jar:?]
>> ... 34 more
>
>
> On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
>> Jeremy,
>>
>> On 5/1/23 17:46, Jeremy Nguyen wrote:
>> > I noticed this change was introduced:
>> > https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
>> >
>> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
>> >
>> > I'll try running 8.5.34 and report back.
>>
>> Wow that's ancient. What made you pick 8.5.34? That change should have
>> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
>> which (if either) works?
>>
>> I wonder if the parent ClassLoader is violating the contract for
>> getResources().
>>
>> Jeremy, can you throw some code into your application that runs early
>> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp) that
>> reports the class name of thew parent ClassLoader for the
>> WebappClassLoader being used for the webapp?
>>
>> If you aren't able to do that -- and since you are running from Eclipse
>> -- try putting a breakpoint in WebappClassLoaderBase.getResources
>> and just inspecting the situation at that point -- you should be able
>> to see what the parent ClassLoader is, and even see what
>> getParent().getResources() returns.
>>
>> -chris
>>
>> > On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
>> wrote:
>> >
>> >>
>> >>
>> >> On 5/1/23 14:36, Christopher Schultz wrote:
>> >>> Jeremy,
>> >>>
>> >>> On 5/1/23 14:22, Jeremy Nguyen wrote:
>> >>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>> >>>> nullpointerexception within
>> >>>> WebappClassLoaderBase.CombinedEnumeration.inc.
>> >>>> It seems to occur when it's trying to initialize commons-logging
>> >>>> LogFactory
>> >>>> for any class specified in Web.xml, and it's calling
>> >>>> getResources("commons-logging.properties") which I never had. Is it
>> >>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>> >>>>
>> >>>> We're running Tomcat using a wrapper and it's erroring out here:
>> >>>>
>> >>
>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>> >>>>
>> >>>>
>> >>>> I posted my web.xml and error trace here as well:
>> >>>>
>> >>
>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>> >>>>
>> >>>
>> >>> I have no idea how this is throwing an NPE. The only pointer being
>> >>> dereferenced by the inc() method is "sources":
>> >>>
>> >>> 2773 private boolean inc() {
>> >>> 2774 while (index < sources.length) {
>> >>> 2775 if (sources[index].hasMoreElements()) {
>> >>> 2776 return true;
>> >>> 2777 }
>> >>> 2778 index++;
>> >>> 2779 }
>> >>> 2780 return false;
>> >>> 2781 }
>> >>>
>> >>> That member (sources) is instantiated in the one-and-only-one
>> >>> constructor:
>> >>>
>> >>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>> >>> enum2) {
>> >>> @SuppressWarnings("unchecked")
>> >>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
>> >>> enum2 };
>> >>> this.sources = sources;
>> >>> }
>> >>>
>> >>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
>> >>> explain how line 2775 could throw an NPE if line 2774 did not.
>> >>>
>> >>>> :/
>> >>
>> >> Is the null pointer in the index'th position of source, not source
>> itself?
>> >>
>> >>>
>> >>> I use Tomcat 8.5.x and I have never had a commons-logging.properties
>> >>> file, and I use some components which are surely causing
>> >>> commons-logging LogFactory to initialize, and I've never seen this
>> >>> problem before.
>> >>>
>> >>> -chris
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >>> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Jeremy Nguyen <je...@gmail.com>.
I picked 8.5.34 because 8.5.35 has that code change while 34 doesn't.
https://github.com/apache/tomcat/blob/8.5.35/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1050
I'll do some debugging for the classloader soon. I'm still trying to get my
application running. I'm wrestling with the following error at runtime.
Caused by: org.apache.jasper.JasperException: Unable to compile class for
> JSP
> at
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:610)
> ~[jasper.jar:8.5.34]
> at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
> ~[jasper.jar:8.5.34]
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> ~[jasper.jar:8.5.34]
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> ~[jasper.jar:8.5.34]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> ~[servlet-api.jar:?]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> ~[catalina.jar:8.5.34]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> ~[catalina.jar:8.5.34]
> at
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
> ~[com.centrify.platform.service.analytics/:?]
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> ~[catalina.jar:8.5.34]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> ~[catalina.jar:8.5.34]
> at
> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
> ~[org.cg.services.core/:?]
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> ~[catalina.jar:8.5.34]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> ~[catalina.jar:8.5.34]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
> ~[spring-security-pac4j-2.0.0.jar:?]
> at
> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
> ~[pac4j-core-1.9.1.jar:?]
> ... 34 more
> Caused by: java.lang.NullPointerException
> at
> org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:516)
> ~[jasper.jar:8.5.34]
> at
> org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1854)
> ~[jasper.jar:8.5.34]
> at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
> ~[jasper.jar:8.5.34]
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
> ~[jasper.jar:8.5.34]
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
> ~[jasper.jar:8.5.34]
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
> ~[jasper.jar:8.5.34]
> at
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595)
> ~[jasper.jar:8.5.34]
> at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
> ~[jasper.jar:8.5.34]
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> ~[jasper.jar:8.5.34]
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> ~[jasper.jar:8.5.34]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> ~[servlet-api.jar:?]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> ~[catalina.jar:8.5.34]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> ~[catalina.jar:8.5.34]
> at
> com.centrify.platform.service.analytics.filter.GlobalAttributeFilter.doFilter(GlobalAttributeFilter.java:41)
> ~[com.centrify.platform.service.analytics/:?]
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> ~[catalina.jar:8.5.34]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> ~[catalina.jar:8.5.34]
> at
> org.cg.services.core.filter.ExecutionTimeFilter.doFilterInternal(ExecutionTimeFilter.java:29)
> ~[org.cg.services.core/:?]
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
> ~[spring-web-5.1.20.RELEASE.jar:5.1.20.RELEASE]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> ~[catalina.jar:8.5.34]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> ~[catalina.jar:8.5.34]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> ~[spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
> at
> org.pac4j.springframework.security.web.SecurityFilter.lambda$doFilter$1(SecurityFilter.java:52)
> ~[spring-security-pac4j-2.0.0.jar:?]
> at
> org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:136)
> ~[pac4j-core-1.9.1.jar:?]
> ... 34 more
On Tue, May 2, 2023 at 5:23 AM Christopher Schultz <
chris@christopherschultz.net> wrote:
> Jeremy,
>
> On 5/1/23 17:46, Jeremy Nguyen wrote:
> > I noticed this change was introduced:
> > https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
> >
> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
> >
> > I'll try running 8.5.34 and report back.
>
> Wow that's ancient. What made you pick 8.5.34? That change should have
> gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
> which (if either) works?
>
> I wonder if the parent ClassLoader is violating the contract for
> getResources().
>
> Jeremy, can you throw some code into your application that runs early
> (like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp) that
> reports the class name of thew parent ClassLoader for the
> WebappClassLoader being used for the webapp?
>
> If you aren't able to do that -- and since you are running from Eclipse
> -- try putting a breakpoint in WebappClassLoaderBase.getResources
> and just inspecting the situation at that point -- you should be able
> to see what the parent ClassLoader is, and even see what
> getParent().getResources() returns.
>
> -chris
>
> > On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com>
> wrote:
> >
> >>
> >>
> >> On 5/1/23 14:36, Christopher Schultz wrote:
> >>> Jeremy,
> >>>
> >>> On 5/1/23 14:22, Jeremy Nguyen wrote:
> >>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
> >>>> nullpointerexception within
> >>>> WebappClassLoaderBase.CombinedEnumeration.inc.
> >>>> It seems to occur when it's trying to initialize commons-logging
> >>>> LogFactory
> >>>> for any class specified in Web.xml, and it's calling
> >>>> getResources("commons-logging.properties") which I never had. Is it
> >>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
> >>>>
> >>>> We're running Tomcat using a wrapper and it's erroring out here:
> >>>>
> >>
> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
> >>>>
> >>>>
> >>>> I posted my web.xml and error trace here as well:
> >>>>
> >>
> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
> >>>>
> >>>
> >>> I have no idea how this is throwing an NPE. The only pointer being
> >>> dereferenced by the inc() method is "sources":
> >>>
> >>> 2773 private boolean inc() {
> >>> 2774 while (index < sources.length) {
> >>> 2775 if (sources[index].hasMoreElements()) {
> >>> 2776 return true;
> >>> 2777 }
> >>> 2778 index++;
> >>> 2779 }
> >>> 2780 return false;
> >>> 2781 }
> >>>
> >>> That member (sources) is instantiated in the one-and-only-one
> >>> constructor:
> >>>
> >>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
> >>> enum2) {
> >>> @SuppressWarnings("unchecked")
> >>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
> >>> enum2 };
> >>> this.sources = sources;
> >>> }
> >>>
> >>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
> >>> explain how line 2775 could throw an NPE if line 2774 did not.
> >>>
> >>>> :/
> >>
> >> Is the null pointer in the index'th position of source, not source
> itself?
> >>
> >>>
> >>> I use Tomcat 8.5.x and I have never had a commons-logging.properties
> >>> file, and I use some components which are surely causing
> >>> commons-logging LogFactory to initialize, and I've never seen this
> >>> problem before.
> >>>
> >>> -chris
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jeremy,
On 5/1/23 17:46, Jeremy Nguyen wrote:
> I noticed this change was introduced:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
>
> I'll try running 8.5.34 and report back.
Wow that's ancient. What made you pick 8.5.34? That change should have
gone into 8.5.36. Can you try both 8.5.35 and 8.5.36 and let us know
which (if either) works?
I wonder if the parent ClassLoader is violating the contract for
getResources().
Jeremy, can you throw some code into your application that runs early
(like in org.cg.dao.webcontainer.tomcat.TomcatWrapper.startWebApp) that
reports the class name of thew parent ClassLoader for the
WebappClassLoader being used for the webapp?
If you aren't able to do that -- and since you are running from Eclipse
-- try putting a breakpoint in WebappClassLoaderBase.getResources
and just inspecting the situation at that point -- you should be able
to see what the parent ClassLoader is, and even see what
getParent().getResources() returns.
-chris
> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com> wrote:
>
>>
>>
>> On 5/1/23 14:36, Christopher Schultz wrote:
>>> Jeremy,
>>>
>>> On 5/1/23 14:22, Jeremy Nguyen wrote:
>>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>>>> nullpointerexception within
>>>> WebappClassLoaderBase.CombinedEnumeration.inc.
>>>> It seems to occur when it's trying to initialize commons-logging
>>>> LogFactory
>>>> for any class specified in Web.xml, and it's calling
>>>> getResources("commons-logging.properties") which I never had. Is it
>>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>>>>
>>>> We're running Tomcat using a wrapper and it's erroring out here:
>>>>
>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>>>>
>>>>
>>>> I posted my web.xml and error trace here as well:
>>>>
>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>>>>
>>>
>>> I have no idea how this is throwing an NPE. The only pointer being
>>> dereferenced by the inc() method is "sources":
>>>
>>> 2773 private boolean inc() {
>>> 2774 while (index < sources.length) {
>>> 2775 if (sources[index].hasMoreElements()) {
>>> 2776 return true;
>>> 2777 }
>>> 2778 index++;
>>> 2779 }
>>> 2780 return false;
>>> 2781 }
>>>
>>> That member (sources) is instantiated in the one-and-only-one
>>> constructor:
>>>
>>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>>> enum2) {
>>> @SuppressWarnings("unchecked")
>>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
>>> enum2 };
>>> this.sources = sources;
>>> }
>>>
>>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
>>> explain how line 2775 could throw an NPE if line 2774 did not.
>>>
>>>> :/
>>
>> Is the null pointer in the index'th position of source, not source itself?
>>
>>>
>>> I use Tomcat 8.5.x and I have never had a commons-logging.properties
>>> file, and I use some components which are surely causing
>>> commons-logging LogFactory to initialize, and I've never seen this
>>> problem before.
>>>
>>> -chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Jeremy Nguyen <je...@gmail.com>.
Confirmed that running 8.5.34 resolves the issue. I'll have no choice but
to run this version until the issue is resolved, or a workaround is found.
Thanks all!
On Mon, May 1, 2023 at 2:46 PM Jeremy Nguyen <je...@gmail.com> wrote:
> I noticed this change was introduced:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
>
> https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
>
> I'll try running 8.5.34 and report back.
>
> Jeremy
>
>
>
> On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com> wrote:
>
>>
>>
>> On 5/1/23 14:36, Christopher Schultz wrote:
>> > Jeremy,
>> >
>> > On 5/1/23 14:22, Jeremy Nguyen wrote:
>> >> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>> >> nullpointerexception within
>> >> WebappClassLoaderBase.CombinedEnumeration.inc.
>> >> It seems to occur when it's trying to initialize commons-logging
>> >> LogFactory
>> >> for any class specified in Web.xml, and it's calling
>> >> getResources("commons-logging.properties") which I never had. Is it
>> >> required in 8.5? Even if I put it in conf/, it's not being picked up.
>> >>
>> >> We're running Tomcat using a wrapper and it's erroring out here:
>> >>
>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>> >>
>> >>
>> >> I posted my web.xml and error trace here as well:
>> >>
>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>> >>
>> >
>> > I have no idea how this is throwing an NPE. The only pointer being
>> > dereferenced by the inc() method is "sources":
>> >
>> > 2773 private boolean inc() {
>> > 2774 while (index < sources.length) {
>> > 2775 if (sources[index].hasMoreElements()) {
>> > 2776 return true;
>> > 2777 }
>> > 2778 index++;
>> > 2779 }
>> > 2780 return false;
>> > 2781 }
>> >
>> > That member (sources) is instantiated in the one-and-only-one
>> > constructor:
>> >
>> > CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>> > enum2) {
>> > @SuppressWarnings("unchecked")
>> > Enumeration<URL>[] sources = new Enumeration[] { enum1,
>> > enum2 };
>> > this.sources = sources;
>> > }
>> >
>> > Also weird is that this throws NPE on line 2775 and not 2774. I can't
>> > explain how line 2775 could throw an NPE if line 2774 did not.
>> >
>> > >:/
>>
>> Is the null pointer in the index'th position of source, not source itself?
>>
>> >
>> > I use Tomcat 8.5.x and I have never had a commons-logging.properties
>> > file, and I use some components which are surely causing
>> > commons-logging LogFactory to initialize, and I've never seen this
>> > problem before.
>> >
>> > -chris
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Jeremy Nguyen <je...@gmail.com>.
I noticed this change was introduced:
https://bz.apache.org/bugzilla/show_bug.cgi?id=62868
https://github.com/apache/tomcat/blame/8.5.x/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1122
I'll try running 8.5.34 and report back.
Jeremy
On Mon, May 1, 2023 at 2:12 PM Rob Sargent <rs...@xmission.com> wrote:
>
>
> On 5/1/23 14:36, Christopher Schultz wrote:
> > Jeremy,
> >
> > On 5/1/23 14:22, Jeremy Nguyen wrote:
> >> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
> >> nullpointerexception within
> >> WebappClassLoaderBase.CombinedEnumeration.inc.
> >> It seems to occur when it's trying to initialize commons-logging
> >> LogFactory
> >> for any class specified in Web.xml, and it's calling
> >> getResources("commons-logging.properties") which I never had. Is it
> >> required in 8.5? Even if I put it in conf/, it's not being picked up.
> >>
> >> We're running Tomcat using a wrapper and it's erroring out here:
> >>
> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
> >>
> >>
> >> I posted my web.xml and error trace here as well:
> >>
> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
> >>
> >
> > I have no idea how this is throwing an NPE. The only pointer being
> > dereferenced by the inc() method is "sources":
> >
> > 2773 private boolean inc() {
> > 2774 while (index < sources.length) {
> > 2775 if (sources[index].hasMoreElements()) {
> > 2776 return true;
> > 2777 }
> > 2778 index++;
> > 2779 }
> > 2780 return false;
> > 2781 }
> >
> > That member (sources) is instantiated in the one-and-only-one
> > constructor:
> >
> > CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
> > enum2) {
> > @SuppressWarnings("unchecked")
> > Enumeration<URL>[] sources = new Enumeration[] { enum1,
> > enum2 };
> > this.sources = sources;
> > }
> >
> > Also weird is that this throws NPE on line 2775 and not 2774. I can't
> > explain how line 2775 could throw an NPE if line 2774 did not.
> >
> > >:/
>
> Is the null pointer in the index'th position of source, not source itself?
>
> >
> > I use Tomcat 8.5.x and I have never had a commons-logging.properties
> > file, and I use some components which are surely causing
> > commons-logging LogFactory to initialize, and I've never seen this
> > problem before.
> >
> > -chris
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Rob,
On 5/1/23 17:12, Rob Sargent wrote:
=> On 5/1/23 14:36, Christopher Schultz wrote:
>> Jeremy,
>>
>> On 5/1/23 14:22, Jeremy Nguyen wrote:
>>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>>> nullpointerexception within
>>> WebappClassLoaderBase.CombinedEnumeration.inc.
>>> It seems to occur when it's trying to initialize commons-logging
>>> LogFactory
>>> for any class specified in Web.xml, and it's calling
>>> getResources("commons-logging.properties") which I never had. Is it
>>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>>>
>>> We're running Tomcat using a wrapper and it's erroring out here:
>>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>>>
>>> I posted my web.xml and error trace here as well:
>>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>>
>> I have no idea how this is throwing an NPE. The only pointer being
>> dereferenced by the inc() method is "sources":
>>
>> 2773 private boolean inc() {
>> 2774 while (index < sources.length) {
>> 2775 if (sources[index].hasMoreElements()) {
>> 2776 return true;
>> 2777 }
>> 2778 index++;
>> 2779 }
>> 2780 return false;
>> 2781 }
>>
>> That member (sources) is instantiated in the one-and-only-one
>> constructor:
>>
>> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
>> enum2) {
>> @SuppressWarnings("unchecked")
>> Enumeration<URL>[] sources = new Enumeration[] { enum1,
>> enum2 };
>> this.sources = sources;
>> }
>>
>> Also weird is that this throws NPE on line 2775 and not 2774. I can't
>> explain how line 2775 could throw an NPE if line 2774 did not.
>>
>> >:/
>
> Is the null pointer in the index'th position of source, not source itself?
Possibly (and it's really the only probable cause), but the
documentation for getResources() and findResources() (both of which are
used to assemble the CombinedEnumeration in the first place) say that if
no resources are found, an empty Enumeration is returned, not null.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Rob Sargent <rs...@xmission.com>.
On 5/1/23 14:36, Christopher Schultz wrote:
> Jeremy,
>
> On 5/1/23 14:22, Jeremy Nguyen wrote:
>> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
>> nullpointerexception within
>> WebappClassLoaderBase.CombinedEnumeration.inc.
>> It seems to occur when it's trying to initialize commons-logging
>> LogFactory
>> for any class specified in Web.xml, and it's calling
>> getResources("commons-logging.properties") which I never had. Is it
>> required in 8.5? Even if I put it in conf/, it's not being picked up.
>>
>> We're running Tomcat using a wrapper and it's erroring out here:
>> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>>
>>
>> I posted my web.xml and error trace here as well:
>> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
>>
>
> I have no idea how this is throwing an NPE. The only pointer being
> dereferenced by the inc() method is "sources":
>
> 2773 private boolean inc() {
> 2774 while (index < sources.length) {
> 2775 if (sources[index].hasMoreElements()) {
> 2776 return true;
> 2777 }
> 2778 index++;
> 2779 }
> 2780 return false;
> 2781 }
>
> That member (sources) is instantiated in the one-and-only-one
> constructor:
>
> CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
> enum2) {
> @SuppressWarnings("unchecked")
> Enumeration<URL>[] sources = new Enumeration[] { enum1,
> enum2 };
> this.sources = sources;
> }
>
> Also weird is that this throws NPE on line 2775 and not 2774. I can't
> explain how line 2775 could throw an NPE if line 2774 did not.
>
> >:/
Is the null pointer in the index'th position of source, not source itself?
>
> I use Tomcat 8.5.x and I have never had a commons-logging.properties
> file, and I use some components which are surely causing
> commons-logging LogFactory to initialize, and I've never seen this
> problem before.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: WebappClassLoaderBase error when upgrading Tomcat 8 to 8.5
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jeremy,
On 5/1/23 14:22, Jeremy Nguyen wrote:
> I'm trying to upgrade Tomcat 8 to 8.5 and I'm getting a
> nullpointerexception within WebappClassLoaderBase.CombinedEnumeration.inc.
> It seems to occur when it's trying to initialize commons-logging LogFactory
> for any class specified in Web.xml, and it's calling
> getResources("commons-logging.properties") which I never had. Is it
> required in 8.5? Even if I put it in conf/, it's not being picked up.
>
> We're running Tomcat using a wrapper and it's erroring out here:
> https://github.com/CodeGerm/osgi-server/blob/master/plugins/org.cg.dao.webcontainer/src/org/cg/dao/webcontainer/tomcat/TomcatWrapper.java#L185
>
> I posted my web.xml and error trace here as well:
> https://stackoverflow.com/questions/76139108/web-xml-configuration-is-broken-when-upgrading-to-tomcat-8-5-and-spring-5-1
I have no idea how this is throwing an NPE. The only pointer being
dereferenced by the inc() method is "sources":
2773 private boolean inc() {
2774 while (index < sources.length) {
2775 if (sources[index].hasMoreElements()) {
2776 return true;
2777 }
2778 index++;
2779 }
2780 return false;
2781 }
That member (sources) is instantiated in the one-and-only-one constructor:
CombinedEnumeration(Enumeration<URL> enum1, Enumeration<URL>
enum2) {
@SuppressWarnings("unchecked")
Enumeration<URL>[] sources = new Enumeration[] { enum1,
enum2 };
this.sources = sources;
}
Also weird is that this throws NPE on line 2775 and not 2774. I can't
explain how line 2775 could throw an NPE if line 2774 did not.
>:/
I use Tomcat 8.5.x and I have never had a commons-logging.properties
file, and I use some components which are surely causing commons-logging
LogFactory to initialize, and I've never seen this problem before.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org