Thanks Chris for replying. 

I have tried placing all the jars into webapps/auth/web-inf/lib  folder but 
still getting the null value.

Is there any way to confirm the property file in tomcat classpath?

Many Thanks.
-----Original Message-----
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Monday, September 12, 2016 2:39 AM
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/9/16 2:48 PM, Venkata Reddy P wrote:
> These jars are deployed in common folder to make use of my two web 
> applications. I have modified the catalina.properties file to load 
> these jars by tomcat server.

What happens if you put those JAR files separately into each web application?

I would expect the code as presented to work, but it's worth trying.
And much easier to deal with than a complicated deployment where you need to 
stash things in Tomcat's common classloader.

- -chris

> -----Original Message----- From: Christopher Schultz 
> [mailto:ch...@christopherschultz.net] Sent: 10 September 2016
> 00:08 To: Tomcat Users List Subject: Re: tomcat8 unable to load the 
> Resource/property file from jar
> 
> Venkata,
> 
> On 9/9/16 5:18 AM, Venkata Reddy P wrote:
>> I have tried it and still getting the null value. URL url = 
>> Auth.class.getClassLoader().getResource("/com/trianz/auth/auth.proper
t
>
>> 
ies");
> 
>> 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.
> 
> And where are those .jar files located?
> 
> -chris
> 
>> -----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
> 
>> 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.proper
t
>
>>> 
i
> 
>>> 
> 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.proper
t
>
>> 
ie
> 
> 
> s")
> 
>> ? (note the leading "/")
> 
>> Also, from where is the Auth class being loaded? Where is auth.jar 
>> located?
> 
>> -chris
> 
>> ---------------------------------------------------------------------
>
>> 
> 
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
>> ---------------------------------------------------------------------
>
>> 
> 
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJX1cfgAAoJEBzwKT+lPKRYmHIP/jsftQpRftre+Uztu0NNvQae
3aThWLhGBbtVi8LQGQYf5C6nRsQNW+RL5mY73CKdVe8Ux6+ae7hyaXDHTo8yMDrV
66nq3kRJTjYl3nNjAltTjsVNwdjCiabHoF4LxLnfOwmVBF3+LyJ3AWCzj8Z+EKO/
RXq9rX/0FwOZEr+p8ihS7ucMvJnZR6tPiyGgmk6GwYxGe6lYVyctwOiugYv7wAiC
D0uwtgr19eYreJlv+m9WwNvmLg5B+zOl7ZWQWmJ/vamoTFNxAUstaaGXuGv+ojC3
E5USMruCF1MjXG1KJ3LNaByFtZnPtvJy0I+E0j2rFDSQuto6CCPckk9qK9ERKYFO
JelWfd5kzKtX5Keacwc4m6Sv9ttw5U3bn6jziH6B+YWjJKwgzKXzhe7lIbbTt+0l
dvKroBxJlJp0WjUnjpElV6nN8qJfGnpQTqa+AvkGuNTZfs6CxXtrisFjw9Sle2Lg
mNzjP/6sUBTUEdwv6Q6uGWcT3kxmuzLzPVqG4z0lG9E85NI7102Uwvuyf1YaXhl/
I2zwNZJ5vWGtCOvibLDd31IwmJwfUSjEzVKzfTmJeC+cMyMIK54eJlBBDhuEfJI9
XHfwI24P8lZmDDTtu5uSfTkOL+tTHvrWLgu80t3qO0EDXnkfTijpAubB6oFvE3YQ
UY1yEAnm57IzLFw75bJX
=vxK0
-----END PGP SIGNATURE-----

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


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

Reply via email to