dev@glassfish.java.net

Re: [Ask]About Java System Property Setting

From: Ancoron Luciferis <ancoron.luciferis_at_googlemail.com>
Date: Sun, 17 Feb 2013 01:05:07 +0100

Hi Tang,

if you need system properties to be available immediately at domain
startup time you may need to include them manually into the
configuration file:

.../<domain-dir>/config/domain.xml

Your options would then go into the appropriate section:

/domain/configs/config/java-config/

...and would look like this:

<jvm-options>http.proxyHost=XXXXX</jvm-options>
<jvm-options>http.proxyPort=XXXXX</jvm-options>

This is essentially the same as what "asadmin create-jvm-options" does.

I've also written a little python script for this task (and some
others), which I attached for convenience (just use "-h" for a
comprehensive help).

Hope I could help out.

Cheers,

        Ancoron


On 01/29/2013 03:46 AM, Tang Yong wrote:
> Hi Sahoo
> CC Team
>
> I have a question about Java System Property Setting:
>
> [Background]
> I access internet behind a http proxy. I know that after starting
> glassfish domain, I can set jvm options(http proxy) by the following,
>
> asadmin create-jvm-options -Dhttp.proxyHost=XXXXX
> asadmin create-jvm-options -Dhttp.proxyPort=XXXXX
>
> Then, restarting domain will OK. However, imaging such a scene:
>
> If I want to access internet's resource while starting glassfish domain
> rather than after starting glassfish domain. For example, I have a
> bundle which is put into autostart directory and I want to access
> http://repo1.maven.org/maven2/... to generate OSGi OBR resources to meet
> some provisioning stories by the bundle. Then, current glassfish does
> not meet such a requirement because gf can not offer a way to set
> http.proxyHost and http.proxyPort while starting gf domain.
>
> I have tried to add these system properties into config/osgi.properties,
> however, this have not any effect.
>
> Noting that in [1] , the following is said:
>
> "These system properties can be set directly on the command line when
> starting the JVM using the standard "-D<prop>=<value>" syntax or you can
> put them in the lib/system.properties file of your Felix installation;
> see the next section on configuring Felix for more information."
>
> So, while launching felix, whether gf can offer some way to load system
> properties or not?
>
> [1]:
> http://felix.apache.org/site/apache-felix-framework-usage-documentation.html
>
> Thanks
> --Tang
>
>