flux = secureInterface.login("tomcat", "tomcat");
You will want to make sure that the JAASMemoryLoginModule is included in your classpath. This can often be found in the Catalina-optional.jar, additionally, you may need to include tomcat-util.jar and Catalina.jar. These are typically located in CATALINA_HOME\common\lib.import flux.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletException;
public class startsecuretomcat extends HttpServlet {
Engine flux;
Factory fluxFactory = Factory.makeInstance();
RemoteSecurity secureInterface;
public void init() throws ServletException {
try
{
System.out.println("setting up the configuration");
Configuration config = fluxFactory.makeConfiguration();
config.setSecurityEnabled(true);
config.setRegistryPort(1199);
config.setSecurityPolicyOverrideEnabled(false);
config.setSecurityPolicyFile(null);
config.setSecurityConfigurationFile(null);
config.setDatabaseType(DatabaseType.MYSQL);
config.setJdbcUsername("fake");
config.setJdbcPassword("fake");
config.setMaxConnections(5);
config.setDriver("com.mysql.jdbc.Driver");
config.setUrl("jdbc:mysql://localhost:3306/fluxtest");
config.setSecurityConfigurationFileEntry("TOMCAT_SECURITY_LOGIN");
System.out.println(?Making the Engine?);
flux = fluxFactory.makeEngine(config);
System.out.println("factory.makeRemoteSecurity(conifguration,engine");
secureInterface = fluxFactory.makeRemoteSecurity(config,flux);
System.out.println("\nenginge secured"+flux.isSecured()+"\n");
System.out.println("secureInterface.login(tomcat,tomcat)");
flux = secureInterface.login("tomcat", "tomcat");
System.out.println("engine.start()");
flux.start();
System.out.println("engine started");
}
catch (Throwable e)
{
e.printStackTrace();
System.out.println("printing cause");
e.getCause().printStackTrace();
throw new ServletException(e.getMessage());
} // catch
}//end of init
public void destroy()
{
try{
flux.dispose();
}//end of try
catch (Throwable d)
{
d.printStackTrace();
}//end of catch
}//end of destroy()
}//end of class startsecuretomcat
There are no comments on this document