I have an external properties file named myAccount.properties. This file resides in a folder called ${catalina.home}/usmo/MyAccount/resources/properties
. This folder is being added to the class path thru context.xml using configuration below:
<Resources className="org.apache.catalina.webresources.StandardRoot">
<PostResources className="org.apache.catalina.webresources.DirResourceSet"
base="${catalina.home}/usmo/MyAccount/resources/properties"
internalPath="/"
webAppMount="/WEB-INF/classes" />
</Resources>
I am expecting code below to return the URL or absolute path of this file. Sadly, it is returning a null. Any help would be appreciated.
URL url = MyClass.class.getClassLoader().getResource( "myAccount.properties" );
Turns out to be case sensitive issue. The actual file named is 'MyAccount.properties'. But the code uses 'myAccount.properties'. I change the code to below and it works:
URL url = MyClass.class.getClassLoader().getResource( "MyAccount.properties" );
Weird behavior though: