users@glassfish.java.net

Re: GFv3 ACC and LoginContext

From: <glassfish_at_javadesktop.org>
Date: Thu, 20 May 2010 07:17:21 PDT

Hi,

I use the ProgrammaticLogin from Standalone Client and there working fine,
but from ACC I would like to use the LoginContext because that is general (AS independent).
Very interesting that if I call StatelessJavaClient from an Embedded ACC it is working fine, just if I call it from ACC happend this.

Can anyone help me, why happen this, why start the first InitialContext.lookup a new login from an ACC and why not from an Embedded ACC.

Thanks, Attila.

package enterprise.hello_stateless_client;

import org.glassfish.appclient.client.acc.config.TargetServer;
import org.glassfish.appclient.client.acc.AppClientContainer.Builder;
import org.glassfish.appclient.client.acc.AppClientContainer;
import org.glassfish.appclient.client.acc.UserError;

public class EmbACCStatelessJavaClient {

    public static void main(String[] args) {
        System.out.println("Start Embedded");
        AppClientContainer acc = null;
        TargetServer[] servers = new TargetServer[1];
        servers[0] = new TargetServer("localhost", 3700);
        Builder builder = AppClientContainer.newBuilder(servers);
        if (builder == null) {
            System.out.println("The 'Builder' is null!");
        } else {
            try {
                builder.authRealm("helloRealm");
                builder.clientCredentials("programmer", "hello".toCharArray());
                acc = builder.newContainer(StatelessJavaClient.class);
                if (acc == null) {
                    System.out.println("The 'AppClientContainer' is null!");
                } else {
                    try {
                        acc.startClient(args);
                    } finally {
                        acc.stop();
                    }
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            } catch (UserError ex) {
                ex.printStackTrace();
            }
            acc = null;
            builder = null;
        }
        servers[0] = null;
        servers = null;
        System.out.println("Stop Embedded");
    }

}
[Message sent by forum member 'aszomor']

http://forums.java.net/jive/thread.jspa?messageID=470702