dev@glassfish.java.net

Re: asadmin create-jvm-options usage?

From: Prashanth Abbagani <Prashanth.Abbagani_at_Sun.COM>
Date: Thu, 15 Feb 2007 09:10:12 -0800

Thats a lot of info. This will sure help CLI team in debugging the problem.

thanks
Prashanth

Jonathan Benoit wrote:
>
>
> Prashanth Abbagani wrote:
>> Jonathan Benoit wrote:
>>
>>> kedar wrote:
>>>
>>>> I am not denying the possibility of a bug
>>>> here, and I am sorry if this is unnecessarily hard,
>>>> but it is important that we use the public interfaces
>>>> of the product and I thank you for giving it a chance.
>>>>
>>>> Some of the issues might also related with various shell settings and
>>>> that's why I suggested the perfectly supported way in which you
>>>> can curtail the length of the command line achieving the same result.
>>>
>>>
>>> I'm porting existing ant build.xml scripts and i'm trying to
>>> minimize the deltas to make it work in my environment. The existing
>>> ant targets
>>> cobble together the args to pass to create-jvm-options, and it's
>>> implemented to support running against different Glassfish installs
>>> under different ports.
>>>
>>>> I am really confused why it does not work with the complicated
>>>> path that you provided for the password file. The message "unclosed
>>>> string value" looks suspicious.
>>>
>>>
>>> here is more info. yes, this fails:
>>>
>>> asadmin> create-jvm-options --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> --user admin --terse=true --host localhost --echo=true --
>>> "-Demma.rt.control.port=47650"
>>> CLI161 Unclosed string value.
>>>
>>> however, this next command works:
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> -- "-Demma.rt.control.port=47650"
>>> Command create-jvm-options executed successfully.
>>
>> Iam clueless on whats going on here. The CLI parser doesnt really
>> care about the order of the options. Can you please set
>> '-DDebug=true' option inside the asadmin script, this will print the
>> stack trace on the console and that will help us debug the problem.
>
> i've added -DDebug=true to asadmin and executed create-jvm-options
> again from multi-user mode:
>
> % asadmin
> 0 descriptor = jar:file:/glassfish/lib/admin-cli.jar!/CLIDescriptor.xml
> 1 descriptor = jar:file:/glassfish/lib/appserv-se.jar!/CLIDescriptor.xml
> basePackage: com.sun.enterprise.cli.commands
> propertyFile: LocalStrings
> basePackage: com.sun.enterprise.cli.commands
> propertyFile: LocalStrings
> **** insert Default Options terse false
> **** insert Default Options echo false
> **** insert Default Options printprompt true
> Reading asadminenv.conf file
> asadminenv.conf: set the following options: profile=developer
> asadminenv.conf: set the following options: secure=false
> asadminenv.conf: set the following options: port=4849
> Use "exit" to exit and "help" for online help.
>
> asadmin> create-jvm-options --passwordfile
> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
> --user admin --terse=true --host localhost --echo=true --
> "-Demma.rt.control.port=47650"
> com.sun.enterprise.cli.framework.CommandException: CLI161 Unclosed
> string value.
> at
> com.sun.enterprise.cli.framework.CLITokenizer.<init>(CLITokenizer.java:92)
>
> at
> com.sun.enterprise.cli.commands.MultiProcessCommand.splitStringToArray(MultiProcessCommand.java:219)
>
> at
> com.sun.enterprise.cli.commands.MultiProcessCommand.processLine(MultiProcessCommand.java:288)
>
> at
> com.sun.enterprise.cli.commands.MultiProcessCommand.runCommand(MultiProcessCommand.java:106)
>
> at
> com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:158)
> at com.sun.enterprise.cli.framework.CLIMain.main(CLIMain.java:66)
>
> CLI161 Unclosed string value.
>
>
> when i try to add --port 4849 to this command it errors with "Invalid
> command":
>
> asadmin> create-jvm-options --passwordfile
> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
> --user admin --terse=true --host localhost --echo=true --port 4849
> -- "-Demma.rt.control.port=47650"
> CLIToken = [-Demma.rt.control.port=47650]
> CLI147 Invalid command, -Demma.rt.control.port=47650
> com.sun.enterprise.cli.framework.CommandException: Use "help" command
> for a list of valid commands.
> at
> com.sun.enterprise.cli.commands.MultiProcessCommand.checkValidCommand(MultiProcessCommand.java:274)
>
> at
> com.sun.enterprise.cli.commands.MultiProcessCommand.processLine(MultiProcessCommand.java:303)
>
> at
> com.sun.enterprise.cli.commands.MultiProcessCommand.runCommand(MultiProcessCommand.java:106)
>
> at
> com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:158)
> at com.sun.enterprise.cli.framework.CLIMain.main(CLIMain.java:66)
>
> Use "help" command for a list of valid commands.
>
>
>
> again, here is the one that works with -DDebug=true in asadmin, using
> --port 4849, but not using --terse=true --host localhost --echo=true:
>
> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
> -- "-Demma.rt.control.port=47650"
> CLIToken = [create-jvm-options]
> CLIToken = [--user]
> CLIToken = [admin]
> CLIToken = [--port]
> CLIToken = [4849]
> CLIToken = [--passwordfile]
> CLIToken =
> [/workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt]
>
> CLIToken = [--]
> CLIToken = [-Demma.rt.control.port=47650]
> **** insert Default Options host localhost
> **** insert Default Options interactive true
> **** insert Default Options terse false
> **** insert Default Options echo false
> **** insert Default Options target server
> Reading asadminenv.conf file
> asadminenv.conf: set the following options: profile=developer
> asadminenv.conf: set the following options: secure=false
> Object Name = [com.sun.appserv:type=configs,category=config]
> Types =
> [Ljava.lang.String;,
> boolean,
> java.lang.String,
>
> Types Info [0] = [Ljava.lang.String;
> Creating String Array
> strbuf = -Demma.rt.control.port=47650
> strArrayVal value = "-Demma.rt.control.port=47650"
> Types Info [1] = boolean
> Types Info [2] = java.lang.String
> {$target}
> strbuf = server
> ParamsInfo = server
> OperationName = createJvmOptions
> Types =
> [Ljava.lang.String;,
> boolean,
> java.lang.String,
>
> Command create-jvm-options executed successfully.
>
>
>>
>>> so it seems that it is not the path passed to --passwordfile,
>>> because i passed the same path to both. the difference is in the
>>> arguments and the ordering. (i.e. extra args --terse=true --host
>>> localhost --echo=true)
>>>
>>> this next one also works, but don't see "executed successfully"
>>> message:
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> --terse=true -- "-Demma.rt.control.port=47650"
>>>
>>> maybe that is a clue?
>>
>> --terse option when set to true, means that the output need to be
>> concise (script-friendly). Thats the reason why you aren't seeing the
>> success message in the second scenario. The default value of option
>> terse is false.
>>
>>>
>>> here is a dump of what i've tried and the results:
>>>
>>> asadmin> create-jvm-options --passwordfile
>>> /workspaces/wstx/emma_coverage/tango/qe-tests/wstx/functional/build-config/adminpassword.txt
>>> --user admin --terse=true --host localhost --echo=true --
>>> "-Demma.rt.control.port=47650"
>>> create-jvm-options --passwordfile
>>> /workspaces/wstx/emma_coverage/tango/qe-tests/wstx/functional/build-config/adminpassword.txt
>>> --user admin --terse=true --host localhost --echo=true
>>> -Demma.rt.control.port=47650
>>>
>>> asadmin> delete-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> -- "-Demma.rt.control.port=47650"
>>> Command delete-jvm-options executed successfully.
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> --terse=true --host localhost --echo=true --
>>> "-Demma.rt.control.port=47650"
>>> CLI161 Unclosed string value.
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> --terse=true -- "-Demma.rt.control.port=47650"
>>>
>>> asadmin> delete-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> -- "-Demma.rt.control.port=47650"
>>> Command delete-jvm-options executed successfully.
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> --terse=true --host localhost -- "-Demma.rt.control.port=47650"
>>> CLI161 Unclosed string value.
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> --terse=true --echo=true -- "-Demma.rt.control.port=47650"
>>> CLI161 Unclosed string value.
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --terse=true
>>> --echo=true --host localhost --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> -- "-Demma.rt.control.port=47650"
>>> CLI147 Invalid command, -Demma.rt.control.port=47650
>>> Use "help" command for a list of valid commands.
>>>
>>> asadmin> create-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> -- "-Demma.rt.control.port=47650"
>>> Command create-jvm-options executed successfully.
>>>
>>> asadmin> delete-jvm-options --user admin --port 4849 --passwordfile
>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>> -- "-Demma.rt.control.port=47650"
>>> Command delete-jvm-options executed successfully.
>>>
>>>
>>>> It is also not clear to me why you didn't see the message when
>>>> the command succeeded.
>>>>
>>>> Let me get back to you with some more answers.
>>>>
>>>> Jonathan Benoit wrote:
>>>>
>>>>> Okay here is what i tried:
>>>>>
>>>>> asadmin> create-jvm-options -- "-Demma.rt.control.port=47650"
>>>>> Command create-jvm-options executed successfully.
>>>>>
>>>>> this works with quotes, but I really want to pass in all these
>>>>> options, including path to my adminpassword.txt, passed via
>>>>> --passwordfile option:
>>>>>
>>>>> asadmin> create-jvm-options --passwordfile
>>>>> /workspaces/functional/pe/emma/../../../functional/build-config/adminpassword.txt
>>>>> --user admin --terse=true --host localhost --echo=true --
>>>>> "-Demma.rt.control.port=47650"
>>>>> CLI161 Unclosed string value.
>>>>>
>>>>> After seeing error here, I tried to remove the "../../../" from my
>>>>> path to the adminpassword.txt file location, and that seemed to work.
>>>>>
>>>>> asadmin> create-jvm-options --passwordfile
>>>>> /workspaces/functional/build-config/adminpassword.txt --user admin
>>>>> --terse=true --host localhost --echo=true --
>>>>> "-Demma.rt.control.port=47650"
>>>>> create-jvm-options --passwordfile
>>>>> /workspaces/wstx/emma_coverage/tango/qe-tests/wstx/functional/build-config/adminpassword.txt
>>>>> --user admin --terse=true --host localhost --echo=true
>>>>> -Demma.rt.control.port=47650
>>>>>
>>>>> It didn't echo "Command create-jvm-options executed successfully."
>>>>> but i could delete it via:
>>>>>
>>>>> asadmin> delete-jvm-options -- "-Demma.rt.control.port=47650"
>>>>> Command delete-jvm-options executed successfully.
>>>>>
>>>>> Questions -
>>>>>
>>>>> why can't I pass into --passwordfile option a value that contains
>>>>> "../../.." in path which points at adminpassword.txt location?
>>>>>
>>>>> why doesn't create-jvm-options echo "Command create-jvm-options
>>>>> executed successfully." in the case where it created VM arg, as
>>>>> noted above?
>>>>>
>>>>> kedar wrote:
>>>>>
>>>>>> I just tried:
>>>>>>
>>>>>> ./asadmin create-jvm-options -- "-Demma.rt.control.port=47650"
>>>>>>
>>>>>> and it works. Maybe quotes are necessary.
>>>>>>
>>>>>>
>>>>>> On Feb 14, 2007, at 2:01 PM, Jonathan Benoit wrote:
>>>>>>
>>>>>>> kedar wrote:
>>>>>>>
>>>>>>>> Use
>>>>>>>>
>>>>>>>>> create-jvm-options --passwordfile adminpassword.txt --user
>>>>>>>>> admin -- terse=true --host localhost --echo=true --port 4849
>>>>>>>>> -- - Demma.rt.control.port=47650
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I didn't see this format documented in the help, but it didn't
>>>>>>> work either.
>>>>>>>
>>>>>>> asadmin> create-jvm-options --passwordfile adminpassword.txt
>>>>>>> --user admin --terse=true --host localhost --echo=true --port
>>>>>>> 4849 -- - Demma.rt.control.port=47650
>>>>>>> CLI147 Invalid command, emma.rt.control.port=47650
>>>>>>> Use "help" command for a list of valid commands.
>>>>>>>
>>>>>>> fyi, my adminpassword.txt contains:
>>>>>>> AS_ADMIN_PASSWORD=adminadmin
>>>>>>> AS_ADMIN_ADMINPASSWORD=adminadmin
>>>>>>> AS_ADMIN_MASTERPASSWORD=changeit
>>>>>>>
>>>>>>>> I know this is a bit clumsy.
>>>>>>>> We should improve the usage if the above works.
>>>>>>>> Kedar
>>>>>>>> On Feb 14, 2007, at 1:26 PM, Jonathan Benoit wrote:
>>>>>>>>
>>>>>>>>> I'm trying to use asadmin create-jvm-options to add
>>>>>>>>> equivalent of VM option -Demma.rt.control.port=47651 into
>>>>>>>>> domain.xml.
>>>>>>>>>
>>>>>>>>> I do this:
>>>>>>>>>
>>>>>>>>> asadmin> create-jvm-options --passwordfile adminpassword.txt
>>>>>>>>> -- user admin --terse=true --host localhost --echo=true
>>>>>>>>> --port 4849 \- Demma.rt.control.port=47650
>>>>>>>>> CLI147 Invalid command, mma.rt.control.port=47650
>>>>>>>>> Use "help" command for a list of valid commands.
>>>>>>>>>
>>>>>>>>> why this error?
>>>>>>>>>
>>>>>>>>> The example from help shows:
>>>>>>>>>
>>>>>>>>> EXAMPLES
>>>>>>>>> Example 1: Using the create-jvm-options command
>>>>>>>>>
>>>>>>>>> JVM options must start with a dash (-). Use the backslash
>>>>>>>>> (\) to escape the dash delimiter.
>>>>>>>>>
>>>>>>>>> asadmin> create-jvm-options --interactive=true --secure=true
>>>>>>>>> Press enter to continue, q to quit:
>>>>>>>>>
>>>>>>>>> --passwordfile passwords.txt --terse=false --user admin
>>>>>>>>> --host localhost --port 4849 --target server
>>>>>>>>> \\-Dunixlocation=/root/example:-Dvariable=
>>>>>>>>>
>>>>>>>>> \$HOME:-Dwindowslocation=d\\:\\\sun\\\appserver:-Doption1=-
>>>>>>>>> value1
>>>>>>>>> Command create-jvm-options executed successfully
>>>>>>>>>
>>>>>>>>> Usage shows:
>>>>>>>>>
>>>>>>>>> asadmin> create-jvm-options
>>>>>>>>> Usage: create-jvm-options [--terse=false] [--echo=false] [--
>>>>>>>>> interactive=true] [--host localhost] [--port 4848|4849]
>>>>>>>>> [--secure | -s] [--user admin_user] [--passwordfile
>>>>>>>>> file_name] [-- profiler=false] [--target target(Default
>>>>>>>>> server)] (jvm_option_name
>>>>>>>>> [=jvm_option_value])[:jvm_option_name [=jvm_option_value]]*
>>>>>>>>> CLI020 Operand is required.
>>>>>>>>>
>>>>>>>>> What do I have to do to successfully create a VM arg in
>>>>>>>>> domain.xml using asadmin create-jvm-options?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------
>>>>>>>>> -
>>>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>