|
Replies:
12
-
Last Post:
Oct 19, 2007 10:11 AM
by: bouteill
|
|
|
|
|
|
|
How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Aug 29, 2007 4:19 PM
|
|
|
Hi, In v1, I edited the bin/startserv script to pass -Dprops to the server command line, which then could be interpreted in the domain.xml the same way as com.sun.aas.instanceRoot. It seems bin/startserv is not called by asadmin start-domain anymore though... How do you pass in startup java properties in glassfishv2?
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 5, 2007 5:33 PM
in response to: bouteill
|
|
|
Guess the timing of my post was not ideal over the long holiday week-end... Can someone on the glassfish team help me out with this v2 upgrade question?  Thank you.
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 5, 2007 6:23 PM
in response to: bouteill
|
|
|
Apologies.
I was on vacation.
You are absolutely right! The startserv script is NOT called asadmin start-domain. The reasons for this are detailed extensively at: http://wiki.glassfish.java.net/attach/GlassFishV2AdminRelatedOnePagers/admin-fs.html#pl
Now coming yo your question:
*In both V1 and V2*, you should be able to provide additional system properties to the server VM at the Java-config element in domain.xml. It is pretty straightforward. - use admin console. - use asadmin create-jvm-options command.
Both of these end up creating a jvm-options element that is passed to the server VM mostly as is.
Please let me know if this works.
Regards, Kedar
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 5, 2007 6:39 PM
in response to: km
|
|
|
Thanks Kedar! Unfortunately, I do not want to hardcode the value of my property in the <jvm-options> of domain.xml. In V1, I passed in the -Dmysysclasspath=... to startserv and then my domain.xml was configured with <java-config classpath-suffix="${mysysclasspath}"/> Is there anyway for me to pass dynamically a property like mysysclasspath when starting glassfishV2 server?
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 7, 2007 3:24 PM
in response to: bouteill
|
|
|
Interesting. I think you accidentally stepped on a side effect in launcher 
I don't think there is a way to do what you want without token support. See: http://blogs.sun.com/foo/entry/how_to_debug_clustered_appserver for details.
Is there a problem with having properties in domain.xml, however? Please explain.
Regards, Kedar
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 7, 2007 3:45 PM
in response to: km
|
|
|
Not sure it's a unintended side effect... The domain.xml already uses Sun dynamic properties like ${com.sun.aas.instanceRoot} and ${com.sun.aas.installRoot}. I'm just trying to extend that.  How are those properties value passed in to the glassfish JVM?
asadmin set property will work only after glassfish started, which is too late to affect the classpath-suffix and jvm-options.
I'm not sure I understand the question you're asking... You mean properties like ${com.sun.aas.instanceRoot}? No they're great! I just don't know how to set them anymore w/o the startserv script. Please advise how to do so.
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 7, 2007 4:45 PM
in response to: bouteill
|
|
|
Right, but ${com.sun.aas.installRoot} didn't have to be a Java System property. The current implementation (mostly wrongly) chose to do so. It is merely a token replacement.
I think you are confused about jvm-options and classpath-suffix. Let me explain with an example:
- Suppose you want the GlassFish Server to start with: -DFoo=Bar (So that when your application does System.getProperty("Foo"), "Bar" is returned) and with a jar like "myclasses.jar", so that you can find classes in that jar.
If that is the right use case, then you should: - modify domain.xml as such: <java-config classpath-suffix="path-to-myclasses.jar" ...> <jvm-options> -DFoo=Bar </jvm-options> ... </java-config>
Then, your GlassFish server is started thus:
java -Dcom.sun.aas.installRoot ...... -DFoo=Bar -Dcom.sun.aas.ClassPathSuffix=path-to-myclasses.jar -cp appserv-launch.jar com.sun.enterprise.server.PELaunch
So, in essence, your GlassFish Server VM has all the things you need.
Clear?
Or am I completely off-base?
- Kedar
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 7, 2007 5:13 PM
in response to: km
|
|
|
Hi Kedar, Is there a way to participate in this "token replacement" feature and provide our own tokens to domain.xml at startup?
The missing requirement in your use case, is that I need Bar to be dynamically provided @ server startup and not hardcoded in the domain.xml. Again, in glassfishV1, my domain.xml had <java-config classpath-suffix="${path-to-myjars}"> and I dynamically passed the value at startup through startserv with -Dpath-to-myjars=dynamic-classpath Does that make sense?
Please note I'm using asadmin start-domain and that's why I'm not sure how to supply a dynamic property now that startserv is not used in V2 anymore. Are you recommending I start glassfish by hand with a the java command you provided instead of asadmin? Won't it prompt me for a password then?
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 11, 2007 3:34 PM
in response to: bouteill
|
|
|
No, there is no way to do this if you don't want to hard-code the value in domain.xml.
But it beats me. Domain.xml is the file to store the actual configuration, not a pointer to them. So, I guess, I need to understand the actual use case where you want something else (e.g. startserv script) to actually store your system property. The whole point of domain.xml was to keep most of the configuration at one place and provide admin support for the same.
Regards, Kedar
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 12, 2007 3:35 PM
in response to: km
|
|
|
I think the original goal here is just how to extend dynamically the classpath of the appserver. If the path data is stored in a shell variable which value might be different depending where the appserver is running for instance, is there really no workaround available anymore to do this? How this value can be communicated to glassfish in the light of the previous postings?
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 12, 2007 4:06 PM
in response to: fmurialdo
|
|
|
No, I don't think there is a way to do what you describe.
There are other *documented* ways of dynamically extend the classpath of the server, but I don't think that is the intent of the original question which just said that domain.xml need not have actual system property. A system property is different from classpath being used by a server.
Regards, Kedar
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Sep 17, 2007 10:09 AM
in response to: km
|
|
|
Hi Kedar, that's ok. It was just how we were doing it in V1.  The utlimate goal is indeed to be able to dynamically extend the classpath of the server. What is the way to do this in V2? We've not found any documentation about how to do this, so we'd greatly appreciate if you could send us a link. Thanks!
|
|
|
|
|
|
|
|
Re: How to pass properties to glassfishv2 startup/domain.xml?
Posted:
Oct 19, 2007 10:11 AM
in response to: bouteill
|
|
|
Just to give an update in case people run into this issue, one way to do this in Glassfish V2 is to set the environment CLASSPATH variable and update domain.xml:/server/java-config.env-classpath-ignored=false This unfortunately doesn't work with 9.1 GA because of classloader changes. https://glassfish.dev.java.net/issues/show_bug.cgi?id=3785 You can get a patch from Sun which most likely will be rolled into V2-UR1.
|
|
|
|
|