glassfish
  1. glassfish
  2. GLASSFISH-20705

java.io.IOException will be thrown out when create the instance during the admin command line

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b89_RC5
    • Fix Version/s: 4.1
    • Component/s: admin
    • Labels:
      None
    • Environment:

      Win 7

      Description

      [Phenomenon]
      Here's my steps to reproduce the Exception:

      1). Reset the value of AS_DEF_NODES_PATH in asenv.bat(In my platform, the asenv.bat is under the directory of E:\glassfish4\glassfish\config\asenv.bat) as AS_DEF_NODES_PATH=..\my_nodes

      2). asadmin start-domain
      Command start-domain executed successfully.

      3). asadmin create-instance --node localhost-domain1 ins1
      Successfully created instance ins1 in the DAS configuration, but failed to retri
      eve configuration files during bootstrap.
      Command create-instance completed with warnings.

      4). Check the server.log and you'll find the following Exception will be thrown out:

      [2013-07-17T13:34:05.401+0800] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=35 _ThreadName=admin-listener(3)] [timeMillis: 1374039245401] [levelValue: 1000] [[
        Successfully created instance ins1 in the DAS configuration, but failed to retrieve configuration files during bootstrap.
      java.io.IOException: No node parent directory found.
      	at com.sun.enterprise.util.io.InstanceDirs.<init>(InstanceDirs.java:98)
      	at com.sun.enterprise.v3.admin.cluster.CreateInstanceCommand.getLocalInstanceDir(CreateInstanceCommand.java:241)
      	at com.sun.enterprise.v3.admin.cluster.CreateInstanceCommand.bootstrapSecureAdminLocally(CreateInstanceCommand.java:279)
      	at com.sun.enterprise.v3.admin.cluster.CreateInstanceCommand.createInstanceFilesystem(CreateInstanceCommand.java:427)
      	at com.sun.enterprise.v3.admin.cluster.CreateInstanceCommand.execute(CreateInstanceCommand.java:218)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:356)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      	at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
      	at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
      	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
      	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
      	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
      	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:331)
      	at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:165)
      	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      ]]
      

      [My suggestion]
      In my option, I think it will be successed without any Exception under my reproduced steps, what means it should be success to create the instance after step 3):

      E:\glassfish4\glassfish\bin>asadmin create-instance --node localhost-domain1 ins
      1
      Command _create-instance-filesystem executed successfully.
      Port Assignments for server instance ins1:
      JMX_SYSTEM_CONNECTOR_PORT=28686
      JMS_PROVIDER_PORT=27676
      HTTP_LISTENER_PORT=28080
      ASADMIN_LISTENER_PORT=24848
      JAVA_DEBUGGER_PORT=29009
      IIOP_SSL_LISTENER_PORT=23820
      IIOP_LISTENER_PORT=23700
      OSGI_SHELL_TELNET_PORT=26666
      HTTP_SSL_LISTENER_PORT=28181
      IIOP_SSL_MUTUALAUTH_PORT=23920
      The instance, ins1, was created on host localhost
      Command create-instance executed successfully.
      

        Activity

        Hide
        Jeremy_Lv added a comment -

        Chris:
        I have looked into the code and found it is because the default node directory in creating the instance is different from the default value defined in the asenv.bat(asenv.conf). I want to know whether it is the special syntax as you have designed for the command of "create-instance"?

        [My suggestion]
        Why not unify the default value of the node in the create-instance and create-local-instance into the same one, which are both defined in the asenv.bat(asenv.conf), Here's some of suggestions:

        CreateIntsnaceCommand.java
             private File defaultLocalNodeDirFile() {
        +        final Map<String,String> systemProps = 
        +            Collections.unmodifiableMap(new ASenvPropertyReader().getProps());
                 /*
        -         * The "nodes" directory we want to use is a child of
        -         * the install directory.
        -         *
        -         * The installDir field contains the installation directory which the
        -         * administrator specified, if s/he specified one, when the target node
        -         * was first created.  It is null if the administrator did not specify
        -         * an installation directory for the node.  In that case we should
        -         * use the DAS's install directory (because this method applies in the
        -         * local instance case).
        -         */
        -        final File nodeParentDir = (installDir == null
        -                ? serverContext.getInstallRoot()
        -                : new File(installDir, "glassfish"));
        -        return new File(nodeParentDir, "nodes");
        +         * The default "nodes" directory we want to use 
        +         * has been set in asenv.conf named as 
        +         * AS_DEF_NODES_PATH
        +          */
        +        String nodeDirDefault = systemProps.get(
        +                SystemPropertyConstants.AGENT_ROOT_PROPERTY);
        +        return new File(nodeDirDefault);
             }
        
        Show
        Jeremy_Lv added a comment - Chris: I have looked into the code and found it is because the default node directory in creating the instance is different from the default value defined in the asenv.bat(asenv.conf). I want to know whether it is the special syntax as you have designed for the command of "create-instance"? [My suggestion] Why not unify the default value of the node in the create-instance and create-local-instance into the same one, which are both defined in the asenv.bat(asenv.conf), Here's some of suggestions: CreateIntsnaceCommand.java private File defaultLocalNodeDirFile() { + final Map< String , String > systemProps = + Collections.unmodifiableMap( new ASenvPropertyReader().getProps()); /* - * The "nodes" directory we want to use is a child of - * the install directory. - * - * The installDir field contains the installation directory which the - * administrator specified, if s/he specified one, when the target node - * was first created. It is null if the administrator did not specify - * an installation directory for the node. In that case we should - * use the DAS's install directory (because this method applies in the - * local instance case ). - */ - final File nodeParentDir = (installDir == null - ? serverContext.getInstallRoot() - : new File(installDir, "glassfish" )); - return new File(nodeParentDir, "nodes" ); + * The default "nodes" directory we want to use + * has been set in asenv.conf named as + * AS_DEF_NODES_PATH + */ + String nodeDirDefault = systemProps.get( + SystemPropertyConstants.AGENT_ROOT_PROPERTY); + return new File(nodeDirDefault); }
        Hide
        zhouronghui added a comment -

        The patch for GLASSFISH-20705

        Show
        zhouronghui added a comment - The patch for GLASSFISH-20705
        Hide
        zhouronghui added a comment -

        Hi Chris,

        I think that this is because of the CreateIntsnaceCommand class in nucleus\cluster\admin. and we have maken a patch for that.

        Would you please check it? If the patch is OK, I will commit it.

        Thank you.

        Show
        zhouronghui added a comment - Hi Chris, I think that this is because of the CreateIntsnaceCommand class in nucleus\cluster\admin. and we have maken a patch for that. Would you please check it? If the patch is OK, I will commit it. Thank you.
        Hide
        Chris Kasso added a comment -


        The developer who wrote the original code looked at the fix and said it is OK. You are clear to integrate the change.

        Show
        Chris Kasso added a comment - The developer who wrote the original code looked at the fix and said it is OK. You are clear to integrate the change.
        Hide
        zhouronghui added a comment -

        Hi Chris,

        Thank you for reviewed the patch. I have committed the fix to trunk at r63166.

        Show
        zhouronghui added a comment - Hi Chris, Thank you for reviewed the patch. I have committed the fix to trunk at r63166.
        Hide
        zhouronghui added a comment -

        The patch have been reviewed by chris, committed at r63166.

        Show
        zhouronghui added a comment - The patch have been reviewed by chris, committed at r63166.

          People

          • Assignee:
            zhouronghui
            Reporter:
            Jeremy_Lv
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: