Bug 61782 - AuthConfigFactoryImpl.doRegisterConfigProvider() does not search in the web app classloader when loading the provider class
Summary: AuthConfigFactoryImpl.doRegisterConfigProvider() does not search in the web a...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.23
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-18 14:05 UTC by Lazar Kirchev
Modified: 2017-11-20 18:28 UTC (History)
0 users



Attachments
sample app (3.74 KB, application/zip)
2017-11-18 14:05 UTC, Lazar Kirchev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lazar Kirchev 2017-11-18 14:05:48 UTC
Created attachment 35536 [details]
sample app

AuthConfigFactoryImpl.doRegisterConfigProvider() first tries to load the provider class with the thread context class loader (which is the application loader) and after that it retries with its own loader. 
However, the retry is always done, even if the first loading was successful. The result is that if the provider implementation is in the application the second loading fails and the provider registration throws ClassNotFound

The attached war contains a very sample application illustrating the problem. It contains a sample provider implementation and a ServletContextListener which tries to register the provider it in its contextInitialized.
Comment 1 Lazar Kirchev 2017-11-18 14:07:08 UTC
This pull request contains a fix for it: https://github.com/apache/tomcat/pull/90
Comment 2 Mark Thomas 2017-11-20 18:28:19 UTC
Many thanks.

Fixed in:
- trunk for 9.0.2 onwards
- 8.5.x for 8.5.24 onwards