Aaaah. A man after my own heart! Keep it simple. Brandon Goodin
-----Original Message----- From: Larry Meadors [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 11:12 AM To: [EMAIL PROTECTED] Subject: RE: getResourceAsStream cached by Tomcat's Classloader? I think you are right, but I always use Thread method because it works even in a static method - you do not need 'this' for it to work. I prefer having one way to do this instead of two - that way I can think less about how to get the CL, and more about the problem it will help me solve (and I am lazy). ;-) Larry >>> [EMAIL PROTECTED] 06/05/03 10:58 AM >>> >"Are you using this code to get a classloader? >Thread.currentThread().getContextClassLoader(); >If not, you are not getting tomcat's you are getting the system one." Are you sure this is true? A ClassLoader can have a parent ClassLoader. But, a class does not maintain a single copy across all ClassLoader contexts. Therefore, the Class type can exist in multiple ClassLoaders. So a Class has a reference to it's ClassLoader context when it is created. When the this.getClass().getClassLoader() is called it calls the context that the class was loaded in. I think you would have to specifically call the getParent() of the Classloader in order to go up the Classloader chain. In this situation I think Thread.currentThread().getContextClassLoader() and this.getClass().getClassLoader() will accomplish the same thing. Brandon Goodin -----Original Message----- From: Larry Meadors [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 9:45 AM To: [EMAIL PROTECTED] Subject: RE: getResourceAsStream cached by Tomcat's Classloader? Are the static variables transient? If not, the session manager may persist them on a reload. >>> [EMAIL PROTECTED] 06/05/03 9:41 AM >>> I have tried it both ways. My notion is that it has to do with the fact that the getResourceAsStream is being called in a static method and the resulting InputStream, which is wrapped in an InputStreamReader, is passed into an object that is a static variable in my BaseDAO class. So, because the reference is at the Class level it might be holding onto it no matter what I do. If you want I can show you the code. I have some ideas. But, I'm not sure if they will work. Brandon Goodin -----Original Message----- From: Larry Meadors [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 8:58 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: getResourceAsStream cached by Tomcat's Classloader? Hey Brandon, Are you using this code to get a classloader? Thread.currentThread().getContextClassLoader(); If not, you are not getting tomcat's you are getting the system one. Larry >>> [EMAIL PROTECTED] 06/05/03 8:04 AM >>> Yes, it is closed. Brandon Goodin -----Original Message----- From: Dominic Parry [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 7:44 AM To: Tomcat Users List Subject: Re: getResourceAsStream cached by Tomcat's Classloader? did you close the original stream before making changes and reloading? ----- Original Message ----- From: "Brandon Goodin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 05, 2003 3:45 PM Subject: getResourceAsStream cached by Tomcat's Classloader? > I saw a question similar to this asked in the Archives early in 2002. I > didn't see a response to it. So, I hope there is an answer. > > I have a generic config file that is an xml file. We'll call it > my-config.xml. > > When I load my-config.xml using > Classloader.getResourceAsStream("my-config.xml") everything works great. > However, when I make a change to that file and again call > Classloader.getResourceAsStream("my-config.xml") the changes are not picked > up and the same initial resource is returned. How do I get the Classloader > to reconginze the resource changes? I'm using Tomcat 4.1.18. > > > Brandon Goodin > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]