tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akram Hussain <akram.hussain...@gmail.com>
Subject Re: Upgrade from Tomcat 7 to Tomcat 9.0.17
Date Tue, 16 Apr 2019 20:21:12 GMT
Hi Christopher,

I have almost 27-30 apps in my tomcat.

Do I need to declare in every applications's META-INF\context.xml.

And also I have a listener class which is in tomcat\lib folder, which also
access these shared classes using CustomSharedLibrary.

How can I access those shared libraries in listener which is in tomcat\lib
folder?

Regards,
Akram.



On Wed, Apr 17, 2019 at 1:02 AM Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Akram,
>
> On 4/16/19 12:41, Akram Hussain wrote:
> > I have gone through it, But it was not clear to me.
> >
> > If an example is provided, how to pass resources to
> > SharedClassLoader, it could be helpful.
>
> If you configure something like this in your META-INF/context.xml:
>
> <Resources>
>   <PostResources webAppMount="/WEB-INF/classes"
> base="/path/to/your/shared/libraries"
> className="org.apache.catalina.webresources.DirResourceSet" />
> </Resources>
>
> That should allow your application to load JAR files from your
> /path/to/your/shared/libraries directory.
>
> You should completely remove your custom class loader. Completely.
>
> - -chris
>
> > On Tue, Apr 16, 2019 at 7:57 PM Christopher Schultz <
> > chris@christopherschultz.net> wrote:
> >
> > 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
> >>
> >> ---------------------------------------------------------------------
> >>
> >>
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAly2LbIACgkQHPApP6U8
> pFj7hA//T4xw27FJxUCRXMM7KGJDu6AYcetov1tC7IqwNkjtSds7DJW3ijFCfimv
> sRd92bEinM6miZy5sVOAnlTZje/vL6NCJSJRuGvLk8YBmbJop2wl566L6gSeH8Co
> L9zV3HOOSNq7v+K2nIfrCbrrKNmYQ/15TLFrOJhXHmiLNv3Fq5cvJzdko5qfllWy
> qIQNlrQLm+vluIHnuITGo53D2EVxrYJHVb2xOO8PoAKSc2PYaJ0C7M0YRycc4Bw9
> zLVXlY2xqsG/3r6CpqFebTzNqhDdIhlB9pDwRKXGhlocvYOQyS4SFAM0obRP1KWz
> hNYzCe2JeJJBWkxANkrUdwxoLqwb2bWoOK7FIbzObeJ+sCbqIz55hz/FVoF5SQur
> iS2k7oqyWH63SSZXBsY6GkVIS9qb6Od7ve3Pk789ueG3JbXQs726msu4DXZDtOSp
> g+Vbwd+5lczSl3zW8iRqKlxxqcBVqxI3Sd4KfblehrWdf/qKbIvqfdv2wriPfC9L
> IAEaZLGIrRG42p2rBkj0RM/xSGQC85S8CjxULgIUsTuUuUXl1PBwNnJhpidGAZlH
> bXvqqsUP7JHupun67a1P438MppGDekvSp5L/iH1aXXldE2nk/VZTPU0ugl5ksXx/
> VLPCabwgEJmeeFzaQG3BuZCRf77xDR9aKWjqrQ2ohElkWEtV+LM=
> =CFOr
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message