> -----Original Message----- > From: Johnny Kewl [mailto:[EMAIL PROTECTED] > Sent: Friday, April 13, 2007 2:36 AM > To: Tomcat Users List > Subject: Re: getResourceAsStream returning blank (NOT NULL) > > > InputStream in = getClass().getResourceAsStream(sPackageNameWithSlashes); > > If the class name is com.myCo.data > > You put it in like this /com/myCo/data > > Also because this stuff looks for a class loader.... I dont think it will > work in a STATIC class. > Use a normal class....
Static classes are loaded by a classloader. You can't say getClass(), however. Instead you would say MyClass.class.xxx()... Read this: http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html on loading properties. Very helpful. Tim > > NO DOTS.... have fun > > ----- Original Message ----- > From: "Thomas Polliard" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Friday, April 13, 2007 3:40 AM > Subject: getResourceAsStream returning blank (NOT NULL) > > > >I have the following code: > > package net.digitalassembly.auth; > > > > import java.util.ArrayList; > > import java.util.List; > > import java.util.Properties; > > import java.io.InputStream; > > import java.io.IOException; > > import net.digitalassembly.auth.PamModule; > > import net.digitalassembly.auth.PamHibernateModule; // May need to have > > this in the config file to make it plugable > > import org.apache.log4j.Logger; > > > > public class Pam { > > > > private Properties pamProperties = new Properties(); > > private List<PamModule> pamModules = new ArrayList<PamModule> > (); > > private static Logger logger = Logger.getLogger(Pam.class); > > private static Pam instance = new Pam(); > > > > private Pam() { > > logger.debug("Pam private constructor called"); > > > > try { > > InputStream inputStream = > > instance.getClass().getClassLoader() > > .getResourceAsStream("/pam.properties"); > > > > // I have also tried "this.getClass().getClassLoader()...... > > // It too returns blank (NOT NULL) > > logger.debug("CLASS: " + inputStream); > > > > > > When the logger writes out its output the inputStream is empty. Why > > would this be. I have looked at a couple of resources online and this > > looks like the ticket that I need. > > > > Please help :( > > > > Thomas > > > > --------------------------------------------------------------------- > > To start a new topic, e-mail: [EMAIL PROTECTED] > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To start a new topic, e-mail: [EMAIL PROTECTED] > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]