dev@glassfish.java.net

Re: doc error in add-resources?

From: Jane Young <Jane.Young_at_Sun.COM>
Date: Tue, 18 Mar 2008 23:40:01 -0700

Hi Chinmayee,

Which build do you have?
see inline:

Chinmayee Srivathsa wrote:

> It's still a bit unclear to me..
>
>> Hi,
>>
>> IT 3754 <https://glassfish.dev.java.net/issues/show_bug.cgi?id=3754>
>> may explain the confusion here. In most cases, "asadmin add-resources
>> <relative path>" is executed on the server side.
>> The logic goes like this:
>> 1. check if file exists
>
> Where does the command look to see if the xml file exists? within
> <install-dir>?

If <relative-path> is used, asadmin takes the current directory and
creates the "canonical" path.
For example, say /export/GlassFish_v2/resources/resources.txt exists,
and you're executing asadmin on the server side then executing:
/export/GlassFish_v2/glassfish/bin/asadmin add-resources
../../resources/resources.txt
will succeed since asadmin converts the relative path,
"../../resources/resource.txt" to it's canonical path from the current
directory which is "/export/GlassFish_v2/resources/resource.txt"
If you're executing asadmin on the client side with the same command,
the current directory will be <domain-root>/config and you'll get a "No
such file or directory" error.

HTH,
Jane

>> 2. if true, then create the "canonical" path
>> 3. if false, then send the relative-path/xml-file. Since server's
>> current directory is <domain-root>/config, then it will try to find
>> the xml file from this directory.
>>
>> In Vince case, the file exists, then asadmin creates the "canonical"
>> path and executes the command. "add-resources" catches that it's an
>> invalid file and throws the message: "DOCTYPE is not present in xml".
>>
>> I think the manpage needs to be corrected.
>>
>> HTH,
>> Jane
>>
>>
>> vince kraemer wrote:
>>
>>> OK.
>>>
>>> So, there is something wrong... Either the command is not behaving
>>> like the documentation says it will OR the documentation is too
>>> unclear about how the xml-file-path is used.
>>>
>>> There is something that can be fixed here... the code or the doc.
>>>
>>> You can decide which should be fixed and assign the bug as appropriate.
>>>
>>> vbk
>>>
>>> Chinmayee Srivathsa wrote:
>>>
>>>> Yes, I saw that.
>>>> I have the sample XML file saved as chin.xml in my home directory
>>>> and I still got the "No such file or directory" error ie it did
>>>> prepend <install-dir>/domains/domain1/config.
>>>>
>>>> However, I need to replace <install-dir>/domains/domain1/config
>>>> with <install-dir>/domains/<domain-name>/config or
>>>> <domain-dir>/config.
>>>>
>>>> - Chinmayee
>>>>
>>>> vince kraemer wrote:
>>>>
>>>>> Chinmayee Srivathsa wrote:
>>>>>
>>>>>> Hi Vince,
>>>>>>
>>>>>> The description of xml-file-path in the add-resources man page
>>>>>> says "
>>>>>> The path to the XML file containing the resource(s) to be
>>>>>> created. The XML file must reside in the
>>>>>> <install-dir>/domains/domain1/config directory. If you specify a
>>>>>> relative path or simply provide the name of the XML file, this
>>>>>> command will prepend <install-dir>/domains/domain1/config to this
>>>>>> operand."
>>>>>>
>>>>>> I tried the command with the relative path to a (non-existent)
>>>>>> xml file. As specified in this description. the command did
>>>>>> prepend <install-dir>/domains/domain1/config.
>>>>>
>>>>>
>>>>>
>>>>> I guess that is why I am confused... I never give it the relative
>>>>> path of a file that doesn't exist.
>>>>>
>>>>> When you give the command a relative path to a file that does
>>>>> exist, it does the right thing, but the description of
>>>>> xml-file-path makes it sound like it should not...
>>>>>
>>>>> See my example further down... (I have edited out some of the
>>>>> intermediate responses for brevity...
>>>>>
>>>>>>
>>>>>> asadmin> add-resources --user admin --port 4848 chin.xml
>>>>>> Please enter the admin password>
>>>>>> Operation 'createResource' failed in 'resources' Config Mbean.
>>>>>> Target exception message:
>>>>>> /home/cs194067/SUNWappserver/domains/domain1/config/chin.xml (No
>>>>>> such file or directory)
>>>>>> CLI137 Command add-resources failed.
>>>>>>
>>>>>> Thanks,
>>>>>> Chinmayee
>>>>>>
>>>>>>
>>>>>>
>>>>>> [snip]
>>>>>>
>>>>>>>> Vince Kraemer wrote:
>>>>>>>>
>>>>>>>>> I was reading the 9.1 docs on add-resources... and it looks
>>>>>>>>> suspect.
>>>>>>>>>
>>>>>>>>> My main area of concern is the description of xml_file_path...
>>>>>>>>>
>>>>>>>>> Is that description actually correct?
>>>>>>>>>
>>>>>>>>> This snippit from my terminal window seems to say NO, to me.
>>>>>>>>>
>>>>>>>>> > pe/6/sailfin/bin/asadmin add-resources this-name-is-unique.txt
>>>>>>>>> Operation 'createResource' failed in 'resources' Config Mbean.
>>>>>>>>> Target exception message: DOCTYPE is not present in xml
>>>>>>>>> /export/home/vbk/sf/this-name-is-unique.txt. Please correct
>>>>>>>>> the issue.
>>>>>>>>> CLI137 Command add-resources failed.
>>>>>>>>
>>>>>>>>
>>>>>
>>>>> In the example above...
>>>>>
>>>>> The file doesn't exist in <install-dir>/domains/domain1/config.
>>>>>
>>>>> The command did not append <install-dir>/domains/domain1/config to
>>>>> the aperand to create an absolute path.
>>>>>
>>>>> Based on the description of xml-file-path... I was expecting to
>>>>> see something like
>>>>>
>>>>> Operation 'createResource' failed in 'resources' Config Mbean.
>>>>> Target exception message:
>>>>> /export/home/vbk/v21/pe/6/glassfish/domains/domain1/config/this-name-is-unique.xml
>>>>> (No such file or directory)
>>>>> CLI137 Command add-resources failed.
>>>>>
>>>>> Since I did not see that... I was a bit confused... Is the
>>>>> implementation of add-resources incorrect?
>>>>>
>>>>> vbk
>>>>>
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> vbk
>>>>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>