glassfish
  1. glassfish
  2. GLASSFISH-9654

instance name must be set as system property

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1.1
    • Fix Version/s: None
    • Component/s: command_line_interface
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      9,654
    • Status Whiteboard:
      Hide

      V2.1.1_exclude

      Show
      V2.1.1_exclude

      Description

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

      <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.

        Activity

          People

          • Assignee:
            Bhavanishankar
            Reporter:
            asigl
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: