geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell E Glaue <rgl...@cait.org>
Subject Re: GERONIMO_BASE vs. GERONIMO_HOME and org.apache.geronimo.base.dir
Date Tue, 05 Aug 2008 22:02:32 GMT
I diagnosed some of the Geronimo internals, and here is what I found:

First of all, what some Geronimo Modules expect:

(1)
buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo
buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/RunClientMojo
-
It creates a object of '(Java)createTask("java")'
It does not read server configured org.apache.geronimo.base.dir
but instead it sets this attribute in this object to whatever the 
server.getGeronimoHome() returns
Then it looks for the following resources:
  - <geronimoHome>/bin/server.jar
  - <geronimoHome>/bin/jpa.jar
  - <geronimoHome>/lib/endorsed
  - <geronimoHome>/lib/ext

So it does not look like it is a show stopper, but if the end-user is expecting 
their configured variable of org.apache.geronimo.base.dir to be used, they will 
be wrong.
And if the plugin requires anything you have located in the REAL server 
org.apache.geronimo.base.dir directory, it will not find it.
-

(2)
plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/AssemblyConfirmHandler.java
-
This expects org.apache.geronimo.home.dir to be the 'deployedPath' which I 
assume is the install path.
This seems okay.
-

(3)
plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSToolsCLI.java
-
This expects org.apache.geronimo.home.dir to be the location of the repositories.
This seems okay too.
-

(4)
plugins/monitoring/agent-jar/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotConfigXMLBuilder.java
plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java
-
This expects org.apache.geronimo.home.dir to be the location of the following 
resources:
  - /var/monitoring/snapshot-config.xml
  - /var/monitoring/
Should this be org.apache.geronimo.base.dir instead, like the previous two modules?
-

(5)
Then there is finally the system BasicServerInfo class which sets up the 
configuration on run-time.
-
framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
-
Here is what it does:
01) this.base = -Dorg.apache.geronimo.home.dir or 'defaultBaseDirectory'
02) if this.base NOT DEFINED
03)   this.base = DirectoryUtils.getGeronimoInstallDirectory();
04) if org.apache.geronimo.server.dir isAbsolute()
05)   this.baseServer = org.apache.geronimo.server.dir
06) if org.apache.geronimo.server.dir NOT isAbsolute()
07)   this.baseServer = this.base/org.apache.geronimo.server.dir
08) if org.apache.geronimo.server.dir NOT DEFINED
09)   this.baseServer = this.base/org.apache.geronimo.server.name
10) if org.apache.geronimo.server.name NOT DEFINED
11)   this.baseServer = this.base
12) set property: org.apache.geronimo.home.dir = this.base.getAbsolutePath()
13) set property: org.apache.geronimo.server.dir = this.baseServer.getAbsolutePath()

The variables org.apache.geronimo.server.dir and org.apache.geronimo.server.name 
can be used interchangeably, and appear to represent the same configuration 
property. The only difference is that org.apache.geronimo.server.dir can be 
either a relative or absolute path to your /var/... content. Whereas 
org.apache.geronimo.server.name can only be relative.
When it is relative, it is relative from the server base directory.

The server base directory is one of three determined items:
1) The installation Directory of Geronimo
2) If that cannot be determined, then it is the 'defaultBaseDirectory'
3) server configured property of org.apache.geronimo.home.dir
If you do not explicitly define org.apache.geronimo.home.dir in your server 
configuration, this value will default to #1 or #2 as stated above.
-


And my findings after the diagnoses?


(X)
What about GERONIMO_HOME vs. GERONIMO_BASE ??

After the script passes execution to java, GERONIMO_HOME value no longer exists. 
And that value is not passed into the java execution.

GERONIMO_BASE is passed into the java execution in bin/geronimo.sh, as the 
option -Dorg.apache.geronimo.base.dir . However, as you can see from the above 
modules, it does little in configuring your Geronimo install.
You can set GERONIMO_BASE to point at your var/... content, but then there are 
two problems resulting from that:
1) you cannot use org.apache.geronimo.server.name as documented in the wiki to 
configure multiple Geronimo instances, unless the value of this variable 
represents a relative path to your instance configuration from the Geronimo 
Installation directory (Not GERONIMO_HOME).
2) The modules in Geronimo may ignore your defined org.apache.geronimo.base.dir 
assuming they are located beneath the Geronimo Installation Directory (again Not 
GERONIMO_HOME)

(Y)
Q) So how do you have virtual Geronimo instances in which the var/... content is 
NOT relative to the Geronimo installation directory but relative to GERONIMO_HOME?
A) Set these variables in GERONIMO_OPTS:
  - -Dorg.apache.geronimo.home.dir=${GERONIMO_HOME}
  - -Dorg.apache.geronimo.server.name=${relative_path_to_instance}
or like this:
  - -Dorg.apache.geronimo.server.dir=${GERONIMO_HOME}/${relative_path_to_instance}
Q) How do you set it up as an absolute instance:
A) Just us this option:
  - -Dorg.apache.geronimo.server.dir=${absolute_path_to_instance}
But you need to mind the previously discussed items.

Also note, that in Geronimo 1.1.1, it was not advised to configure these options.
http://cwiki.apache.org/GMOxDOC11/release-notes-111txt.html
-
Works In Progress
-----------------

* Geronimo has two system properties that should not be modified by the user
   even though they are visible in some property files.  They are:
     org.apache.geronimo.server.dir
     org.apache.geronimo.server.name

   These are subject to change and will be documented in a future release

* The GERONIMO_HOME environment variable in the startup scripts is not
   currently used and is subject to change in a future release.
-

It would seem GERONIMO_HOME is still not used inside Geronimo as of 2.1.1.

-RG




Russell E Glaue wrote:
> 
> My summarized question:
> 
> What is "GERONIMO_BASE" is <GERONIMO_HOME>/bin/geronimo.sh startup 
> script intended to reference?
> 
> 
> 
> According to the documentation in that file, GERONIMO_BASE is supposed 
> to point at the base directory in which dynamic content is found.
> 
> I interpret dynamic content as content that is created or manipulated 
> for the purpose and use of the run-time geronimo process.
> 
> Dynamic content would include:
>  1) run-time configuration files
>  2) log files
>  3) temporary directories
>  4) possibly web applications
> 
> 
> GERONIMO_BASE vs. GERONIMO_HOME
> If I were to break down Geronimo 2.1.1 file structure into GERONIMO_HOME 
> and GERONIMO_BASE, would this break-down be correct?
>  - GERONIMO_HOME/bin
>  - GERONIMO_HOME/etc
>  - GERONIMO_HOME/lib
>  - GERONIMO_HOME/master-repository
>  - GERONIMO_HOME/cluster-repository
>  - GERONIMO_BASE/var
>  - GERONIMO_BASE/schema
> 
> 
> After separating that out, what is the 
> -Dorg.apache.geronimo.base.dir=<dir> supposed to be pointing at?  My 
> assumption would be GERONIMO_BASE, as everything from GERONIMO_HOME 
> should be referred to on the command line, or loaded into environment 
> variables before or during execution of the geronimo server... 
> $GERONIMO_HOME/bin/server.jar
> 
> 
> 
> Point to knowing about this:
> 
> Let's say I wanted a server specific configuration stored in /etc/, say 
> as : /etc/geronimo-servers/default-server
> I would want GERONIMO_BASE=/etc/geronimo-servers/default-server while 
> GERONIMO_HOME points to everything as I have above.
> 
> And yes, I realize GERONIMO_BASE has the temp and logs directory. 
> Sparing me the convenience of keeping this example brief, how do I 
> achieve this simple split of the GERONIMO_HOME and GERONIMO_BASE files?
> 
> The <GERONIMO_HOME>/bin/geronimo.sh script does not allow the separation 
> of GERONIMO_HOME and GERONIMO_BASE as it is currently written. It looks 
> like the liberty of both vairables pointing to the same directory has 
> been widely accepted, thus seemingly invalidating the reason for having 
> both variables to begin with.
> 
> 
> A possible patch:
> So assuming all my above asumptions are correct, this would be the patch 
> to geronimo to fix this issue:
> 
> -----SNIP-SNIP-----PATCH-----SNIP-SNIP-----
> 
> Index: assemblies/geronimo-boilerplate/src/main/underlay/bin/geronimo.sh
> ===================================================================
> --- assemblies/geronimo-boilerplate/src/main/underlay/bin/geronimo.sh 
> (revision 682467)
> +++ assemblies/geronimo-boilerplate/src/main/underlay/bin/geronimo.sh   
> (working copy)
> @@ -235,11 +235,11 @@
>    GERONIMO_HOME=`cygpath --absolute --windows "$GERONIMO_HOME"`
>    GERONIMO_BASE=`cygpath --absolute --windows "$GERONIMO_BASE"`
>    GERONIMO_TMPDIR=`cygpath --windows "$GERONIMO_TMPDIR"`
> -  EXT_DIRS="$GERONIMO_BASE/lib/ext;$JRE_HOME/lib/ext"
> -  ENDORSED_DIRS="$GERONIMO_BASE/lib/endorsed;$JRE_HOME/lib/endorsed"
> +  EXT_DIRS="$GERONIMO_HOME/lib/ext;$JRE_HOME/lib/ext"
> +  ENDORSED_DIRS="$GERONIMO_HOME/lib/endorsed;$JRE_HOME/lib/endorsed"
>  else
> -  EXT_DIRS="$GERONIMO_BASE/lib/ext:$JRE_HOME/lib/ext"
> -  ENDORSED_DIRS="$GERONIMO_BASE/lib/endorsed:$JRE_HOME/lib/endorsed"
> +  EXT_DIRS="$GERONIMO_HOME/lib/ext:$JRE_HOME/lib/ext"
> +  ENDORSED_DIRS="$GERONIMO_HOME/lib/endorsed:$JRE_HOME/lib/endorsed"
>  fi
> 
>  # ----- Execute The Requested Command 
> -----------------------------------------
> @@ -284,7 +284,7 @@
>  fi
> 
>  # Setup the Java programming language agent
> -JAVA_AGENT_JAR="$GERONIMO_BASE/bin/jpa.jar"
> +JAVA_AGENT_JAR="$GERONIMO_HOME/bin/jpa.jar"
>  if [ -f "$JAVA_AGENT_JAR" ]; then
>      JAVA_AGENT_OPTS="-javaagent:$JAVA_AGENT_JAR"
>  else
> 
> -----SNIP-SNIP-----END-PATCH-----SNIP-SNIP-----
> 
> 
> Discussion???
> 
> -RG


Mime
View raw message