> On 30 Jan 2020, at 00:09, Christopher Schultz <ch...@christopherschultz.net> > wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Xavier, > > On 1/29/20 3:23 PM, Xavier (Apache) wrote: >> Hello Tomcat list, >> >> I’m struggling with a classpath problem. I have a webapp deployed >> under Tomcat. I have setup multiple tests (3 to be exact). They are >> all running 9.0.20, one under macOS, and the other 2 under Debian >> (same version for both). My app requires the jar lib to be loaded >> in a specific order. What I was able to gather so far is that I >> should do that customisation in myapp/WEB-INF/context.xml (it looks >> like I don’t need to tell Tomcat to look for that file) >> >> I’m looking for some sample code to better understand how to do >> it. >> >> So far I tried >> >> <?xml version="1.0" encoding="UTF-8"?> <Context >> docBase="\webapps\CloudManager"> <Loader >> className="org.apache.catalina.loader.VirtualWebappLoader"/> >> <lib>xxxxxx</lib> <lib>yyyyyy</lib> ... </Context> >> >> xxxxxx and yyyyyy are jar files in myapp/WEB-INF/lib/xxxxxx.jar >> >> but without any luck. >> >> I’m probably missing something obvious, but I just can’t find it. > > Tomcat has no facility to force the loading of specific JARs in a > specific order. There has been no consensus that e.g. "alphabetic" > ordering should be enforced. There is no (servlet) spec-defined order, > either. > > If you have some special libraries that must be loaded before others > (rather than a complete and total ordering), you can use the > <PreResources>[1] facility to establish a directory where some > libraries are loaded first. I suppose you could use many PreResources, > in order, to achieve a total ordering, but it will be a lot of typing. > > The VirtualWebappLoader has been deprecated for a long time. I can't > even find the class in any currently-supported branch of Tomcat. > > - -chris > > [1] > http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html#Nested_Com > <http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html#Nested_Com> > ponents > -----BEGIN PGP SIGNATURE----- > Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ > <https://www.enigmail.net/> > > iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl4yEJMACgkQHPApP6U8 > pFiUiw//ae5zTje1y7YE0wTnBxIVwlM7mz2KaGsZnONEUUMtGsscx7hfgHHIcs+j > R6mHSmeoH2YKlvG3qarcCvb0UpNXGjfORslbPcj1U4GQzUcftatcFPLGMejlWVBy > xFUcpmGe52zJ4NUWt0zW+3Bq8HfuD2eBJ+eUky9jQ5qS3sOFjrjafiWx2ftjvikd > E1qv1haoCq2Y9UwHq4K2gFoS8OTWvs3AHxZyrRYPoyKyQvSg3FTkNvy1DiNEeAqg > E6ZDl3FWryur/2PtOV4LhbRE/0UoifCIchrRomHxnbep4cqDx+DivLPgsG8ms4Iv > XQJiuWD3lWD3/GHm5ymEMgRNssZsO8EEIwoYkSk0ZueX4TaTWyYO4KEY4YHlukXt > igaGjZCcKUVfEJnS8ZcWOhViwn8qNbZHTHi12m/3w/So+TBvbYilcvgGSNf1B6LT > yqmPFccFuKYSGeiGhUxo0z0nYTbgXgR07Dwj82DzFmd0pOd8a+KLoYavLaWXnE2u > 6oNWTtzXGfNjH0P0s4qqv0vSySxZZ/iP6NNIM0C2uJV4XtSeJGWCQ5R7ozAaNG9U > 77VYBojXk/8LmO+asEeqFqex+vZAkVA/wpW1RW47NfgLhtnWY4LE3xeDuKLeclnM > EBwyA3DObWdRiqzXv+ydlF9fliQFVEgxD3EaO//vk32Uif0Zbeo= > =2Y4Q > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > <mailto:users-unsubscr...@tomcat.apache.org> > For additional commands, e-mail: users-h...@tomcat.apache.org > <mailto:users-h...@tomcat.apache.org>
Thanks for the pointers Christopher. Here’s what I have so far, but I don’t understand why it doesn’t work (I get a java.lang.ClassNotFoundException for a class that is in the prelib jars) -I added a directory mywebapp/WEB-INF/prelib with all the jars that should be loaded first (the ones that should be loaded after are in the usual mywebapp/WEB-INF/lib directory) -mywebapp/WEB-INF/context.xml contains <?xml version="1.0" encoding="UTF-8"?> <Context> <Resources> <PreResources className="org.apache.catalina.webresources.DirResourceSet" base=“/WEB-INF/prelib" webAppMount="/WEB-INF/lib" /> </Resources> </Context> -I also tried with an absolute path for “base” without success (also I’d really need a path relative to the webapp or at least the Tomcat installation, is base=$CATALINA_BASE/webapps/mywebapp/WEB-INF/prelib” correct?) Any idea about what I’m doing wrong? Thanks a lot, Xavier