users@glassfish.java.net

Bug in ant task "sun-appserv-admin" (where to report?)

From: <glassfish_at_javadesktop.org>
Date: Sun, 20 Sep 2009 10:00:03 PDT

Hi,

I found a bug in the "sun-appserv-admin" ant task and also found a workaround. Unfortunately, I couldn't find out how to report a bug in glassfish without being a glassfish contributor. So I post it here.
Perhabs someone can tell me where to report it. Thanks in advance.

My Glassfish version is "Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)".

In the forum "Java Technology & XML" someone has the same proplem (http://forums.sun.com/thread.jspa?threadID=5387320).


I tried to start glassfish with ant for integration tests. I used the following commands in my ant scripts:

    <path id="glassfish.ant.classpath">
        <fileset dir="${glassfish.home.dir}">
            <include name="lib\sun-appserv-ant.jar"/>
            <include name="javadb\lib\derby.jar"/>
            <include name="jbi\lib\jbi-ant-tasks.jar"/>
        </fileset>
    </path>

   <taskdef resource="com/sun/tools/appserver/antlib.xml" uri="antlib:com.sun.tools.appserver" classpathref="glassfish.ant.classpath"/>

  <gf:sun-appserv-admin explicitcommand="start-domain" asinstalldir="${glassfish.home.dir}"/>

After execution the following error occurs:

[gf:sun-appserv-admin] Executing: start-domain
[gf:sun-appserv-admin] Starting Domain domain1, please wait.
[gf:sun-appserv-admin] Default Log location is D:\Development\server\glassfish-2.1\domains\domain1\logs\server.log.
[gf:sun-appserv-admin] com.sun.enterprise.config.ConfigException: Server Instance null does not exist.
[gf:sun-appserv-admin] at com.sun.enterprise.config.serverbeans.ServerHelper.getServerByName(ServerHelper.java:114)
[gf:sun-appserv-admin] at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildInternalCommand(ASLauncher.java:771)
[gf:sun-appserv-admin] at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildCommand(ASLauncher.java:726)
[gf:sun-appserv-admin] at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.process(ASLauncher.java:430)
[gf:sun-appserv-admin] at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstanceAllJava(PEInstancesManager.java:287)
[gf:sun-appserv-admin] at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstance(PEInstancesManager.java:162)
[gf:sun-appserv-admin] at com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager.startDomain(PEDomainsManager.java:243)
[gf:sun-appserv-admin] at com.sun.enterprise.cli.commands.StartDomainCommand.startDomain(StartDomainCommand.java:148)
[gf:sun-appserv-admin] at com.sun.enterprise.cli.commands.StartDomainCommand.runCommand(StartDomainCommand.java:215)
[gf:sun-appserv-admin] at com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:171)
[gf:sun-appserv-admin] at com.sun.enterprise.cli.framework.CLIMain.invokeCLI(CLIMain.java:64)
[gf:sun-appserv-admin] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[gf:sun-appserv-admin] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[gf:sun-appserv-admin] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[gf:sun-appserv-admin] at java.lang.reflect.Method.invoke(Unknown Source)
[gf:sun-appserv-admin] at org.apache.tools.ant.taskdefs.optional.sun.appserv.AppServerAdmin.execAdminCommand(AppServerAdmin.java:543)
[gf:sun-appserv-admin] at org.apache.tools.ant.taskdefs.optional.sun.appserv.AdminTask.execute(AdminTask.java:182)
..........
[gf:sun-appserv-admin] Timeout waiting for domain domain1 to go to starting state.

BUILD FAILED


I investigated this bug a bit further and found a workaround.

In the method ASLauncher.buildInternalCommand (line 770) the "serverName" is fetched from the java system property "com.sun.aas.instanceName".
If I set this property as JVM argument for Ant it works. In the case of asadmin shell script it works because there this property is set as JVM argument.

In the code I found a code snippet where this is set (com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstanceUsingScript line 356):

//FIXTHIS: The com.sun.aas.instanceName probably needs to be dynamically set, but for
                //now this is not important as it is not being used.
        args.add("-Dcom.sun.aas.instanceName=server");

This code will only be executed if the OS environment variable "OLD_LAUNCHER" is set to "true" (see PEInstancesManager.startInstance line 142).
If it is not set the method "PEInstancesManager.startInstanceAllJava" will be executed as you see in the stack trace above.

Thanks,
Andreas
[Message sent by forum member 'asigl' (andreas.siglreithmayr_at_gmx.de)]

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