Programmatic login is used with context settings for getting a Mastercontroller handle from MDM client program.

The following parameter needs to be passed to the JVM

-Djava.security.auth.login.config=/appclientlogin.conf

If you are using Netbeans 6.5 and Windows, go to the project properties, at the "run" settings put

-Djava.security.auth.login.config=C:\JavaCAPS6\appserver\lib\appclient\appclientlogin.conf as the VM option.

where PATH is the fully qualified path to the appclientlogin.conf. You can get this file from your glassfish installation. This file should be shipped with your client code.

public MDMClient() {
        init();
        mc = getMasterController();
    }
    
public void init() {
       
        Hashtable env = new Hashtable();
        env.put("org.omg.CORBA.ORBInitialHost", "localhost");
        env.put("org.omg.CORBA.ORBInitialPort", "3700");
        try {
            ic = new InitialContext(env);
        } catch (Exception e) {
            System.out.println("Can not load the initial context");
        }       
    }
   
    public MasterControllerRemote getMasterController() {
       
        MasterControllerRemote mcr = null;
        try {
            ProgrammaticLogin programmaticLogin = new ProgrammaticLogin();           
            Boolean login = programmaticLogin.login("ui", "ui", "file", false);
            mcr = (MasterControllerRemote) ic.lookup("ejb/PersonMasterController");
        } catch (NamingException ex) {
            Logger.getLogger(MDMClient.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            System.out.println("Failed programmatic login or getting MC");
        }
        return mcr;
       
    }

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by parijatkar