Managed to narrow down to a regression:
https://bz.apache.org/bugzilla/show_bug.cgi?id=62224

On Tue, Mar 27, 2018 at 2:09 PM, Behrooz Nobakht <nob...@gmail.com> wrote:

> Hi Chris,
>
> Thanks for the reply. Comments inline:
>
> On Tue, Mar 27, 2018 at 4:31 AM, Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Behrooz,
>>
>> On 3/26/18 12:26 AM, Behrooz Nobakht wrote:
>> > Hi,
>> >
>> > I am migrating a code base from Tomcat 8.0.38 to 9.0.6. There are a
>> > few things I'd like to confirm based on observations so far and ask
>> > for advice:
>> >
>> > 1. Default Class Loader
>> >
>> > In 9, it seems that the default is ParallelWebAppClassLoader
>> > compared with WebAppClassLoader in 8.0. What behavior changes does
>> > the new class loader bring esp. now that it seems to use
>> > "concurrent" approach?
>> >
>> > One specific observation so far is that the code
>> >
>> > Thread.currentThread().getContextClassLoader()
>> >
>> > used to give out "a" class loader in 8.0 but it returns null in
>> > 9.0. Any advice on this?
>>
>> What code is fetching the TCCL? Something like a ServletContextListener?
>>
>
> This is a business object trying to resolve a resource using
> ClassLoader#gerResource
> and class loader is retrieved via above way. The call stack comes from a
> REST request
> and it's not part of container/context life cycle.
>
>
>>
>> > 2. ClassNotFoundException:
>> > org.apache.naming.java.javaURLContextFactory
>> >
>> > Having the code:
>> >
>> > InitialContext ic = new InitialContext()
>>
>> What data type is InitialContext in your code, here? Can you post the
>> complete stack trace?
>>
>
> InitialContext is javax.naming.InitialContext.
> As I traced this, by default this is enabled by Tomcat itself at
> Catalina.java
> <https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/startup/Catalina.java#L823>
> .
> We might be having implicit class loader conflicts which I am tracing now.
> I event tried to install a custom Loader
> <http://tomcat.apache.org/tomcat-9.0-doc/config/loader.html> inside the
> Context with WebappClassLoader
> to see anything changes in comparison with ParallelWebappClassLoader.
> Tomcat 8 works but Tomcat 9 fails with ClassNotFoundException:
>
> javax.naming.NoInitialContextException: Cannot instantiate class:
> org.apache.naming.java.javaURLContextFactory [Root exception is 
> java.lang.ClassNotFoundException:
> org.apache.naming.java.javaURLContextFactory]
>     at javax.naming.spi.NamingManager.getInitialContext(
> NamingManager.java:674)
>     at javax.naming.InitialContext.getDefaultInitCtx(
> InitialContext.java:313)
>     at javax.naming.InitialContext.init(InitialContext.java:244)
>     at javax.naming.InitialContext.<init>(InitialContext.java:192)
>
> And, we're not explicitly bundling tomcat-catalina.jar with the webapp.
>
> Thanks,
> Behrooz
>
>
>
>>
>> > used to work on Tomcat 8.0 but now yields the above exception in
>> > Tomcat 9. It seems that catalina.jar is not exposed by default to a
>> > webapp class loader.
>>
>> Nor should it. It should not have been available to applications in
>> Tomcat 8, either. Are you bundling catalina.jar with your application?
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlq5LncdHGNocmlzQGNo
>> cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhSiBAArOCcZ0okwbEp1ag+
>> gCJw3jXcndN3JfmcEoIjNddR8/P2BvGSpZrvNX3b/hECrmlMV7hUl0SpORl7afL5
>> zrP1liEdRlZ50EmpQJULG+yjktc298Ip6eXWQLa6oX9OOLbkZyknlGeI249j6syo
>> FXomtb6ZQ4F0WP9wC14N/keAHL2nqTOk7+1p1khfIYPVUM1MfT9EtVnW3weL9kHd
>> sn1FZIV3TNkOiukQm9znIeed00YlH0kaS2V9l/GNOvkhwH66xROxiJukm3dUzTQe
>> djsigv/mHrEWZDG9rhteJbt9RB6XMsaQogfXh8JlZsfxt2i7Yy12O2LOOHFIMaTl
>> 4fjKxiuQl0iOi52rfvrp+CTO/0y0TklPh3gYcNa2dpZm/UGkLrRty199Qs9+KIgy
>> d0L5zT9pwFusTwKt/wiVyGcm+Jg2Lq13fD8WNMmElk1h78ceVbM3NFDxZqqaSHK2
>> p3S3xrMsTeFfyFI2BRdUXlV/+HGwwLYnmHWPVSEUhV448WXdOd0kehYSJGLmfXBM
>> UrYiZksVTYjsJc5zCADtp4xNm/At9T/Ktcfp67Rm97bR8ityQBuf9xKpJ7eo5Gzj
>> Ecl4kFz2W4sRxli0H5zX8lcoO7A9AAk7P0bR1ooMZ/8d6nx1WrIx19zNXz1ou8me
>> qI6/uYGGZX23quqgKXKP9g2basE=
>> =DOWh
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>
>
> --
> -- Behrooz Nobakht
>



-- 
-- Behrooz Nobakht

Reply via email to