Ok, so if the constructor is empty it works fine, but as soon as you put something in the constructor it fails.

Code:
package net.digitalassembly.auth;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.io.FileInputStream;
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 {
        /* Pam has a list of modules that it can support
         * There is a interface called PamModule that allows
         * other "modules" to interact with Pam
         * Pam should be a singleton
         * Does PAM ONLY allow one mechanism? I think Not
        */
        private static Pam instance = new Pam();
        private String pamConfigFile = "pam.conf";
        private Properties pamProperties = new Properties();
private List<PamModule> pamModules = new ArrayList<PamModule> ();
        private static Logger logger = Logger.getLogger(Pam.class);

        private  Pam() {
                logger.debug("Pam private constructor called");
        }
        public boolean authenticate(String username, String password) {
                logger.debug("Running Authenticate");
                return false;
        }

        public static Pam getInstance() {
                return instance;
        }

}

If I comment out the logger statement in the constructor it works fine, with it there it fails... This appears to be something im not aware of in the way Tomcat handles this. Even changing the constructor to public it fails.

Any other advice would be appreciated.

Thomas






On Apr 11, 2007, at 10:36 PM, Rashmi Rubdi wrote:

I tried a smaller version of your code since I don't have the
dependent Classes as follows:

---------------------------------------------------------------------- ----------
........\MyProject\WEB-INF\classes\net\digitalassembly\auth\Pam.class
---------------------------------------------------------------------- ----------

package net.digitalassembly.auth;

public class Pam {

   private static Pam instance = new Pam();

   private Pam() {
   }

   public boolean authenticate(String username, String password) {
       return false;
   }

   public static Pam getInstance() {
       return instance;
   }
}

---------------------------------------------------------------------- ------------------
.....\MyProject\somefolder\authenticate.jsp
---------------------------------------------------------------------- ------------------
<%@ page import="net.digitalassembly.auth.Pam" %>
<%
   Pam pam = Pam.getInstance();
   if (pam != null) {
       out.println(" pam not null ");
   } else {
       out.println("Pam failed to initialize");
   }
%>


And it printed "pam not null" on the screen.

So it worked.

-Rashmi

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