On 22/08/2022 18:56, anjan bacchu wrote:
Hi there,

   I have a Controller in a spring webapp deployed to tomcat as a .war
file(this is not a boot app).

I have this code in the Controller

this.getClass().getClassLoader().getResourceAsStream(licenseFile)


The licenseFile is a 3rd party license file in our artifactory repository
and gets deployed by the gradle build to the WEB-INF\lib directory.

As expected, this licenseFile is not accessible to the Controller and this
fails.

2 Questions
============
1) How do I find the effective classpath for this webapp at runtime ?  (I
read the howto at
https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html )

2) Is there a way to read this licenseFile in the WEB-INF\lib directory
from the Controller ?

ServletContext.getResource("/WEB-INF/lib/licenseFile");

Mark

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

Reply via email to