users@glassfish.java.net

Re: DeploymentManager.getTargets method blocks Glassfish container

From: Hong Zhang <Hong.Zhang_at_Sun.COM>
Date: Thu, 22 Mar 2007 21:21:49 -0400

Hi,
   Can you use jstack to get the stack trace when it hang?
   You need to start the appserver in verbose mode:
        asadmin start-domain --verbose <domain name>
    and the stack dump will appear in the shell where you ran the
asadmin command (so redirecting that output to a file will be a good idea).

    Thanks,

- Hong

glassfish_at_javadesktop.org wrote:

>Hi,
>
>I've a problem fetching container targets when glassfish restarts. I've confined the code and the problem is that DeploymentManager.getTargets method of JSR88 blocks the ServletContextListener thread when the domain is started with a previously deployed war file.
>
>The test is very simple:
>1) Add to the contextInitialized method the following code:
> public void contextInitialized(ServletContextEvent arg0) {
> DeploymentManager manager = null;
> try {
> DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
> DeploymentFactory df = (DeploymentFactory)Class.forName("com.sun.enterprise.deployapi.SunDeploymentFactory").newInstance();
> dfm.registerDeploymentFactory(df);
> manager = dfm.getDeploymentManager("deployer:Sun:AppServer::127.0.0.1:4848", "admin", "adminadmin");
> System.err.println("Getting targets");
> Target[] targets = manager.getTargets(); // Blocks when glassfish starts
> for (TargetModuleID m : manager.getRunningModules(ModuleType.WAR, targets))
> System.err.println("Running Module: " + m);
> } catch (Exception e) {
> e.printStackTrace();
> throw new RuntimeException(e.toString());
> } finally {
> if (manager != null)
> manager.release();
> }
> }
>
>2) Deploy the war file (everything goes fine)
>
>3) Stop the domain
>
>4) Start the domain
>Now the container blocks when reaching the getTargets method.
>If the jvm option com.sun.enterprise.server.ss.ASQuickStartup is set to false, instead of blocking it gives the following exception:
>java.lang.RuntimeException: java.lang.IllegalStateException: java.io.IOException: Unable to connect to admin-server. Please check if the server is up and running and that the host and port provided are correct.
> at jsr88.ContainerTest.contextInitialized(ContainerTest.java:42)
>
>Check with b25, b33 and b40 and the behaviour is the same across all builds.
>
>Any idea how to solve the problem?
>The sample eclipse project can be fetched from http://egroupware.ipleiria.pt/jsr88_bug.zip
>
>Thanks,
>Vitor
>[Message sent by forum member 'bytec0de' (bytec0de)]
>
>http://forums.java.net/jive/thread.jspa?messageID=209513
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>