dev@glassfish.java.net

Re: Running glassfish with upstart

From: Byron Nevins <byron.nevins_at_oracle.com>
Date: Tue, 07 Feb 2012 10:23:38 -0800

Comments inline

On 2/7/2012 9:28 AM, Tom Mueller wrote:
>
>
> On 2/7/2012 10:46 AM, Sahoo wrote:
>> Tom,
>>
>> Do you know any code in GlassFish that assumes user.dir to be
>> domain_dir/config?
> No, and there shouldn't be any such code. However, this is visible to
> the application if running without the security manager.
If you start any server with our CLI, asadmin, then we /absolutely
positively /guarantee that the working directory is domain-dir/config.

This is useful for customers who want to "un-abstract" the file system
in a web app. E.g. new File("../docroot")
This is a supported feature since before V3.
I agree that no GF should depend on it -- especially since the server is
not always started by asadmin!


>> Since we *want* GlassFish to be embeddable, we should fix such such
>> code if any. I am not worried about those JVM memory settings as user
>> can always pass them while invoking java command explicitly.
>>
>> Vince,
>>
>> The bootstrapping done by start-domain command is not very different
>> from what happens in "java -jar glassfish.jar."
> Note that there are functions that start-domain does that "java -jar"
> doesn't, such as prompting for an admin password if it is set to
> reset. A java -jar in that case will just not start the server.
>
> Another difference has to do with instance or DAS restart. If using
> java -jar, the restart command doesn't know what options were passed
> in to the server, so it will use defaults. If started with
> start-domain or start-local-instance, the instance will be restarted
> with the same options that were used to start it.
restart-domain is guaranteed to use precisely the same args that were
given to java -jar -- or even args that were given to main() if the user
starts the server from inside a java app.
I.e. restart-domain|instance works very hard to restart it in exactly
the same way you started it--no matter how you started it.

>
> Tom
>
>>
>> Sahoo
>>
>> On Tuesday 07 February 2012 09:37 PM, Tom Mueller wrote:
>>> There are subtle differences between the two.
>>>
>>> With asadmin start-domain, the "user.dir" property is always the
>>> config directory of the domain. With java -jar, it is the cwd at
>>> the time java was run.
>>>
>>> With asadmin start-domain, you get the JVM flags from the
>>> domain.xml, e.g.: -XX:MaxPermSize=192m, -XX:NewRatio=2, etc.
>>> WIth java -jar, you don't get any of this (except for the -D JVM
>>> options that are in domain.xml).
>>>
>>> To see the differences, start the DAS both ways and run jinfo on the
>>> process.
>>>
>>> Tom
>>>
>>>
>>>
>>>
>>> On 2/7/2012 9:48 AM, Vince Kraemer wrote:
>>>> Hmm. OK.
>>>>
>>>> I just have to wonder why the process started by 'asadmin
>>>> start-domain' doesn't leverage this simplicity....
>>>>
>>>> vbk
>>>>
>>>> On 2/7/12 7:06 AM, Sahoo wrote:
>>>>> java -jar glassfish/modules/glassfish.jar should be sufficient to
>>>>> start glassfish. Let me put it this way, I have not seen it not
>>>>> working.
>>>>>
>>>>> Thanks,
>>>>> Sahoo
>>>>>
>>>>
>>