Hi Mark, Actually, I am declaring a Loader in tomcat\conf\context.xml file as
-------------------------------------------------------------------------------------------------------------------- <Loader className="com.teradata.viewpoint.portal.container.loader.SharedClasspathWebappLoader" /> in its startInternal() method, we are creating SharedClassLoader as like this. Field field = WebappLoader.class.getDeclaredField("parentClassLoader"); field.setAccessible(true); field.set(this, SharedClassLoader.getInstance()); The SharedClassLoader returns its instance, through this code. sharedClassLoader = new SharedClassLoader(WebappLoader.class.getClassLoader()); Its constructor is like this public SharedClassLoader(ClassLoader parent) throws Exception { super(parent); this.parentClassLoader = parent; for (URL url : parseClassPath(SHARED_LOCATION)) { addURL(url); } start(); } for Tomcat 7.0.68, It was working fine. ----------------------------------------------------------------------------------------------------------------------- After upgrade to tomcat 9.0.17. The start method of SharedClassLoader.java is expecting resources variable needs to be populated. How can I pass the Resources to above SharedClassLoader? Any idea? Regards, Akram. On Fri, Apr 19, 2019 at 4:09 AM Mark Thomas <ma...@apache.org> wrote: > On 16/04/2019 20:32, Christopher Schultz wrote: > > 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. > > The OP is trying to load JARs so the /path/to/your/shared/libraries > directory needs to be mounted at WEB-INF/lib, not WEB-INF/classes. > > We (OK I since I wrote this stuff) should probably have better > documented which implementation to pick. > > You pick the implementation based on where the files you want to insert > are located. > > If you want to insert a single file, use FileResourceSet > If you want to insert a directory tree, use DirResourceSet > If you want to insert files from inside an archive (JAR) then use a > JarResourceSet. > > Note: Using a JarResourceSet effectively unpacks the archive as far as > Tomcat is concerned so Tomcat sees directories and files, not a single > JAR file. > > In this case you have a directory of JAR files so you want a > DirResourceSet. > > Assuming you want those JAR files to be treated as if they were placed > in WEB-INF/lib then you want: > > <Resources> > <PostResources > webAppMount="/WEB-INF/lib" > base="/path/to/your/shared/libraries" > className="org.apache.catalina.webresources.DirResourceSet" > /> > </Resources> > > That has the same effect as copying the entire contents of > /path/to/your/shared/libraries to WEB-INF/lib. > > If you want this to apply to every web application you deploy then add > the above to global context.xml in CATALINA_BASE/conf/context.xml > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >