users@glassfish.java.net

Re: Can't create embeddable AppClientContainer (ACC ) ?

From: <glassfish_at_javadesktop.org>
Date: Thu, 04 Mar 2010 05:18:22 PST

I just downloaded the latest-glassfish.zip (v3.1/nightly/), unzipped it and used modules/acc-config.jar, gf-client-module.jar, gf-client.jar along with the program below.

I nolonger get the problem as reported in this thread with v3, but instead "acc.startClient(appArgs)" results in an IllegalStateException.
Alt.main() is not called.

What am I doing wrong?

Thanks for your help.

===============================================
package javaapplication6;

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

public class Main {

    public static void main(String[] args) {
     try {
       TargetServer[] ts = {new TargetServer("localhost", 3700)} ;
       AppClientContainer.Builder accBuilder = AppClientContainer.newBuilder(ts) ;

       Class mainClass = Alt.class;
       AppClientContainer acc = accBuilder.newContainer(mainClass);

       String[] appArgs = {"123"};
       acc.startClient(appArgs); // Start the client
     } catch (org.glassfish.appclient.client.acc.UserError e) {
       System.out.println(e.getMessage()) ;
     } catch (Exception e) {
       System.out.println(e.getMessage()) ;
       System.out.println(e.getCause()) ;
     }
    }
}
===============================================
package javaapplication6;

public class Alt {
  public static void main(String[] args) {
     System.out.println("In ALT" + args[0]) ;
  }
}
===============================================
[Message sent by forum member 'ajvok' (ajvok1_at_gmail.com)]

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