Thank you Christopher. I have tried it and still getting the null value. URL url = Auth.class.getClassLoader().getResource("/com/trianz/auth/auth.properties");
The Auth.java is part of other jar called tools.jar My jars: 1)auth.jar com/trianz/auth/*.java com/trianz/auth/auth.properties 2)tools.jar com/trianz/tools /Auth.java com/trianz/tools/*.properties Many thanks for the response. -----Original Message----- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Thursday, September 08, 2016 8:33 PM To: Tomcat Users List Subject: Re: tomcat8 unable to load the Resource/property file from jar -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Venkata, On 9/7/16 4:49 AM, Venkata Reddy P wrote: > Recently we have upgraded the one of application from tomcat6.x to > tomcat8.0.36 version. In tomcat6, i was able to read the > property/resource file from the jar file but certain reasons after > upgrading to the tomca8.0.36 its failing to load. > > My jar: auth.jar com/trianz/auth/*.java > com/trianz/auth/auth.properties > > //failing code, here url always getting null value. URL url = > Auth.class.getClassLoader().getResource("com/trianz/auth/auth.properti es"); > > I am sure by looking at the tomcat catalina.startup logs the auth.jar > is loading properly Is there any way to confirm the file in classpath > "com/trianz/auth/auth.properties"? How do I fix this? > > Many Thanks in advance. Can you try reading the file like this: URL url = Auth.class.getClassLoader().getResource("/com/trianz/auth/auth.propertie s") ? (note the leading "/") Also, from where is the Auth class being loaded? Where is auth.jar located? - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJX0X2hAAoJEBzwKT+lPKRYIqkQAK4zfB78BcjFmjN+PXPCuVVN JJus2+fdZ9d4g1bl/A1aJrZPalTqttkrE/cQiJm5G3LTFw2WAXMHX/PslG9Q6nNk tZ+1uXR6rROngAQpJadIJ5d1TjSnjxYWf75un33Sn2+BCEhGj0ZnTVnVbxSZOamE Vf0MwXSanwmaBGU0qafrPTswQratHEvk+/9Z7eLPF3ZIEAvdbpsqrjSIW0M2qGTA tuFqppIWHB6pFWk92n7hTNq8rycVQyRZjIX8ROAn9Z+AM3w7Rej8XC2WhwcOmF3O /iIN5/Xhl8muiG+n2zyMtkDeYFKIsqJmNLiCCVxJZBaYs8v0ASo12yXobPa1Q0qe lxk7sIBZaLUwbGc18vN3meLuMNzBHrMb7ZjLf+GTGvzSDyMm6caYDhVFPHHyhn3i 6kpUXCF05hnFUMHk7eIRC4s+VfIM72WnFEeVx0Dhb+xdpaMrcIXUA9aXS/TjPVQb qV5hQxZsTbG+2aKf/JqPRPZPrkE8SE1ljPB3xNviorRGQqOLb/vRS+6k2DHhk3RJ JyhSB1UfNfZ49nwlMPbmPoJMyZTgoeEnw6WxSrYOeZR4Nisi5+3+LTrOZlotpQaS 26U+dzBiv1XJtc74rFaYZQ7FiAnWybAbZGkyIVMjmVsdo0c6dpkXRUTvInLo+aai KBcIRAlgxYbh0LT3pjI9 =dMbb -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org