You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2016/09/08 15:02:57 UTC

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat8 unable to load the Resource/property file from jar

Posted by Venkata Reddy P <Ve...@trianz.com>.
YES Tim, in  webapps/auth/WEB-INF/lib	

-----Original Message-----
From: Tim Watts [mailto:tim@cliftonfarm.org] 
Sent: Wednesday, September 14, 2016 6:00 PM
To: Tomcat Users List
Subject: RE: tomcat8 unable to load the Resource/property file from jar

On Wed, 2016-09-14 at 11:54 +0000, Venkata Reddy P wrote:
> Thanks Chris for replying. 
> 
> I have tried placing all the jars into webapps/auth/web-inf/lib folder 
> but still getting the null value.
> 
You mean WEB-INF/lib not web-inf/lib, right?  Case matters.


> Is there any way to confirm the property file in tomcat classpath?
> 
> Many Thanks.
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@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
> 
> 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:chris@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.prop
> >> er
> 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:chris@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.prop
> >>> er
> 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.prop
> >> er
> 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-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> >> -------------------------------------------------------------------
> >> --
> >
> >> 
> > 
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> > --------------------------------------------------------------------
> > -
> >
> > 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> > --------------------------------------------------------------------
> > -
> >
> > 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org



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


RE: tomcat8 unable to load the Resource/property file from jar

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Wed, 2016-09-14 at 11:54 +0000, Venkata Reddy P wrote:
> Thanks Chris for replying. 
> 
> I have tried placing all the jars into webapps/auth/web-inf/lib
> folder but still getting the null value.
> 
You mean WEB-INF/lib not web-inf/lib, right?  Case matters.


> Is there any way to confirm the property file in tomcat classpath?
> 
> Many Thanks.
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@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
> 
> 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:chris@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:chris@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-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> >> ---------------------------------------------------------------------
> >
> >> 
> > 
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> >
> > 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> >
> > 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org



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


RE: tomcat8 unable to load the Resource/property file from jar

Posted by Venkata Reddy P <Ve...@trianz.com>.
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:chris@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:chris@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:chris@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-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
>> ---------------------------------------------------------------------
>
>> 
> 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


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


Re: tomcat8 unable to load the Resource/property file from jar

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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:chris@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:chris@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-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
>> ---------------------------------------------------------------------
>
>> 
> 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat8 unable to load the Resource/property file from jar

Posted by Venkata Reddy P <Ve...@trianz.com>.
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.

Many thanks. 

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: 10 September 2016 00:08
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 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.propert
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:chris@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.propert
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.propert
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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJX0wGQAAoJEBzwKT+lPKRYnPsP/Ri0B76o9g1Gxw3/YGNGmZFl
z7Q2IP7MpwCVb97kMNVleq+YD8uhBNYEZAfwu6l0k1l+YfPmJIkqItoFHapIvzOQ
9J5HwxJsSS4O1Hc0w458C1LYLtVlFNUC19upnzxkfx58S6Il9t5M1GhBtWhyJiUj
VrJqoU8DYksv4ZbNWLiUTse2vubxtjqxqv7SW5cXL+XckgCZ32LYb4xZWv0CiJER
sSEVRMwti+RrzwHqda1ClSwaRm3kyDfU8fYIiIcmDE4eIh/iUjWvGjCBfpQyaVPm
p5ZEvF73NInSmWZ2rIk7C2ELGY/LIk51UDUbjwaZtE929yCaLtBJn7dAnOV209YK
CSfm9Ichi7DU8mbimIaxCGtGIjrXk8FDvRGm8RaRocimf7mm/1gyLaLoQyCH484V
9SprUrr3AFxaME4uLB+3SZQBJtPEreVNXxZDYRXBoR9m/YJ7NsaV2xo51s9JgTAD
5IERjUoHJZkq7O6/Qy8vefL1ER5/p4fLMJjdG9FU54wQAfmm1Eh1GTUrUau4oBED
MAXugnweBMoXiCwxaTgEB9SKqbDcX5M8gH6Z6nbghVgkePy0v7icWTxapbWLA2y/
J4ByVjRBpXR2cU/PGd1y+9IcKAwYPDoaq67gNBNPWlEgnr+AbMmLPkZBnPo9y/jI
tUl8dnzjI5W08dUB4HtD
=3QzT
-----END PGP SIGNATURE-----

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


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


Re: tomcat8 unable to load the Resource/property file from jar

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

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.propert
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:chris@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.propert
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.propert
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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJX0wGQAAoJEBzwKT+lPKRYnPsP/Ri0B76o9g1Gxw3/YGNGmZFl
z7Q2IP7MpwCVb97kMNVleq+YD8uhBNYEZAfwu6l0k1l+YfPmJIkqItoFHapIvzOQ
9J5HwxJsSS4O1Hc0w458C1LYLtVlFNUC19upnzxkfx58S6Il9t5M1GhBtWhyJiUj
VrJqoU8DYksv4ZbNWLiUTse2vubxtjqxqv7SW5cXL+XckgCZ32LYb4xZWv0CiJER
sSEVRMwti+RrzwHqda1ClSwaRm3kyDfU8fYIiIcmDE4eIh/iUjWvGjCBfpQyaVPm
p5ZEvF73NInSmWZ2rIk7C2ELGY/LIk51UDUbjwaZtE929yCaLtBJn7dAnOV209YK
CSfm9Ichi7DU8mbimIaxCGtGIjrXk8FDvRGm8RaRocimf7mm/1gyLaLoQyCH484V
9SprUrr3AFxaME4uLB+3SZQBJtPEreVNXxZDYRXBoR9m/YJ7NsaV2xo51s9JgTAD
5IERjUoHJZkq7O6/Qy8vefL1ER5/p4fLMJjdG9FU54wQAfmm1Eh1GTUrUau4oBED
MAXugnweBMoXiCwxaTgEB9SKqbDcX5M8gH6Z6nbghVgkePy0v7icWTxapbWLA2y/
J4ByVjRBpXR2cU/PGd1y+9IcKAwYPDoaq67gNBNPWlEgnr+AbMmLPkZBnPo9y/jI
tUl8dnzjI5W08dUB4HtD
=3QzT
-----END PGP SIGNATURE-----

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


RE: tomcat8 unable to load the Resource/property file from jar

Posted by Venkata Reddy P <Ve...@trianz.com>.
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:chris@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org