You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Price Michael M <MP...@alionscience.com> on 2003/04/25 22:16:13 UTC

Error while Using Turbine outside of an app container

Hi everyone I have a problem with initialization of Turbine. I added to the default  database schema. I didn't take any fields away from the schema just added some new tables. I'm using TurbineConfig to initialize Turbine outside of a app container. I'm receiving the following error message when I run my test driver class: 

log4j:WARN No appenders could be found for logger (org.apache.torque.util.BasePeer).
log4j:WARN Please initialize the log4j system properly.
java.lang.ExceptionInInitializerError
        at org.apache.turbine.services.security.db.DBSecurityService.getGroups(DBSecurityService.java:503)
        at org.apache.turbine.services.security.BaseSecurityService.getAllGroups(BaseSecurityService.java:612)
        at com.alion.service.security.TurbineSecurityDriver.getSystemGroups(TurbineSecurityDriver.java:57)
        at com.alion.service.security.TurbineSecurityDriver.main(TurbineSecurityDriver.java:101)
Caused by: java.lang.NullPointerException
        at org.apache.turbine.om.security.peer.GroupPeer.<clinit>(GroupPeer.java:90)
        ... 4 more


Here is the code I ran: 

public class TurbineSecurityDriver
{
    /**
     * instance of TurbineConfig
     */
    private TurbineConfig turbineConfig;
    private SecurityService tbService; 
    
    
    /** Creates a new instance of TurbineSecurity */
    public TurbineSecurityDriver() 
    {
       turbineConfig = new TurbineConfig("D:\\Projects\\Rational\\MPrice_FSA_Dev_View\\VOB-FSA\\source\\classes\\resources\\com\\alion\\common\\resource\\" ,"TurbineResources.properties");
       turbineConfig.initialize();
       
       tbService = TurbineSecurity.getService(); 
    }
    
    public Group[] getSystemGroups()
    {
        
        if(tbService != null)
        {
            try
            {
                GroupSet grpSet = tbService.getAllGroups();
                Group[] grpArray = grpSet.getGroupsArray(); 
                return grpArray;                
            }
            catch(Exception e)
            {
                e.printStackTrace(); 
            }
        }
        return null; 
    }
    
     
    public Permission[] getSystemPermissions()
    {
        
        if(tbService != null)
        {
            try
            {
                PermissionSet permSet = tbService.getAllPermissions();
                Permission[] permArray = permSet.getPermissionsArray(); 
                return permArray;                
            }
            catch(Exception e)
            {
                e.printStackTrace(); 
            }
        }
        return null; 
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
    {
        Group[] grps; 
        Permission[] perms;
        int i;
        
        // Initilize the driver
        TurbineSecurityDriver tsd = new TurbineSecurityDriver();
        
        // Print out Turbine System groups
        grps = tsd.getSystemGroups(); 
        
        System.out.println("Turbine System Groups:"); 
        for(i = 0; i < grps.length; i++)
        {
            System.out.println(grps[i].getName()); 
        }
        
        // Print out Turbine System groups
        perms = tsd.getSystemPermissions(); 
        
        System.out.println("Turbine System Permissions:"); 
        for(i = 0; i < perms.length; i++)
        {
            System.out.println(perms[i].getName()); 
        }
        
        
    }
    
}

If you can help please do so. 

Michael Price
mprice@alionscience.com


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org