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....

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]

Reply via email to