tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Upgrade from Tomcat 7 to Tomcat 9.0.17
Date Tue, 16 Apr 2019 14:27:42 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Akram,

On 4/16/19 06:29, Akram Hussain wrote:
> I have Custom SharedClassLoader in Tomcat 7 to load shared library
> jars, which is used by different applications in that tomcat. We
> migrated to Tomcat 9, now it is not working. How to achieve the
> same functionality in tomcat 9.

Have a look at the <Resources> which should be able to do what you
need without any custom code:

http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html

> In Tomcat 9 it expects resources to be passed. I don't find any
> sample Code on how to populate resources.
> 
> I tried like below
> 
> public CustomSharedClassLoader(ClassLoader parent) throws Exception
> { super(parent); //The below three lines are added by me to work
> for Tomcat 9. StandardRoot standardRoot = new StandardRoot(); 
> standardRoot.addPreResources(new DirResourceSet()); 
> setResources(standardRoot);// End for tomcat 9 changes.
> 
> for (URL urlForJars : getClassPath(SHARED_LIB)) { 
> addURL(urlForJars); } start(); }
> 
> It didn't work.
> 
> public class CustomSharedClassLoader extends
> WebappClassLoader{//Which takes shared folder libarary, it returns
> those classes.}

You should be able to ditch your custom ClassLoader entirely.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAly15l4ACgkQHPApP6U8
pFj9eRAAruPoNK9CF2Cy/aVM9eBuBWtlAC8j5Zgr/UGIb5XEQsYg/fw0SxiWC6lW
c7SV9jeUdptkqKPvqGDMb07/LSHobbuN1wrF/oWxDKJA9a8IltcI775ZxiCFAA7C
Fl//zP8rv/jXhGB+IyiH6OqbFRsC3tc630rsi4bVYMkaK58DuhvL9BpBWiobC7rF
YEQT+yNjqqLHO/SxN70Ar2/p7zNAiNdkv/wDkVFzdWhvqIYIekgeVMQr4GkcCLH6
9eNZb+lw9DBhTqJYYSBoolAs7nadYp3hTBgxRm5vyXl7ODSV0gZHXFoG9aEDYkgU
GCtltrGi0b32l+D3YDnMPjpdf1nc9A5No5cHXXdLi5LI1msEKcsfdHUA3Y30kxE3
p1m/Y7iVD8R8jLYp1g0JPwXnwfoBhSd0WVTZhlB6i6MP4o/mAAgsqQ1bDlvNlWOL
3l6drzE02zxJVk2RAVjSN/s1sCpsTOlldq8PwplQz8IZy3BHtrG2B2qMOVFkg4G2
mupFaB+/E5Lay1VWzPdsSECB2aMtf/sTtix+E0MmwmlVK2NLA1AEZGPuim7cHY8h
lW8JyXp/DdfqCL7qA1SSDZhPefeNQkN41y0vfKNUurkYUTnYgcmtMYzZjm00udhR
QzDL4qfnn/DXen+SXp8YpbfsvCc8bIaWlxmVrnFB4+DZ2KpyYb4=
=XVmW
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message