geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > Configuring multiple repositories
Date Tue, 28 Feb 2012 15:59:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configuring+multiple+repositories">Configuring
multiple repositories</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~rglaue">Russell
E Glaue</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Updating this doc per the fixes and findings in GERONIMO-6284<br />
    </div>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" ># Deploy the {{repo2.xml}} from the
command prompt: <br>*{{deploy(.bat|.sh) deploy &lt;Geronimo_HOME&gt;/repo2/repo2.xml}}*
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">
</span> <span class="diff-added-words"style="background-color: #dfd;">.</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >To verify that the repository is successfully
deployed, you can list the targets on the current server with the command: <br>*{{deploy(.bat|.sh)
list-targets}}*, and you can see the following information: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  org.example.configs/myrepo/2.2/car?ServiceModule=org.example.configs/myrepo/2.2/car,j2eeType=ConfigurationStore,name=Local2
<br>{noformat} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">#
Update the {{etc/org.ops4j.pax.url.mvn.cfg}} file, add the new second repository to the {{org.ops4j.pax.url.mvn.defaultRepositories}}
property <br>The property {{org.ops4j.pax.url.mvn.defaultRepositories}} maintains a
comma-delimited list of repositories that are used by the run-time server. <br>The format
is: {{file:}} &lt; _/absolute/path/to/repo2_ &gt; {{@snapshots}} <br>And if
a variable it used, the new repository just deployed would be defined as: <br>{code}file:${org.apache.geronimo.server.dir}/repo2@snapshots{code}
<br>And the resulting property would be set to something that looks like this: <br>{code}org.ops4j.pax.url.mvn.defaultRepositories=file:${karaf.home}/repository@snapshots,file:${org.apache.geronimo.server.dir}/repo2@snapshots{code}
<br>The first defined repository is the default and primary GERONIMO_HOME/repository,
the second one is the new *repo2* repository just created. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{note}
<br>In Geronimo 3.0, there is a minor bug that exists when creating additional repositories
for Geronimo instances. The files {{GERONIMO_HOME/var/config/config.xml}} and {{GERONIMO_HOME/var/config/config-substitutions.properties}}
must exist even though they are never used, otherwise Geronimo will fail complaining that
they do not exist. Simply create these files, or copy them from {{GERONIMO_SERVER/var/config/...}}
to work around this issue. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">See
[GERONIMO-6284|https://issues.apache.org/jira/browse/GERONIMO-6284] for details. <br>{note}
<br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2.Deploying an application to the
repository <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC30/Configuring+JMS+resources"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC30/Configuring+JMS+resources">Configuring
JMS resources</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC30/Configuring+services"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC30/Configuring+services">Configuring services</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;</td></tr></table></div>

<p>The advantage of having multiple repositories is that they can reside on different
server instances. You can create multiple repositories on different server instances, deploy
a single repository on a single server instance, and deploy applications on multiple repositories
on a single server instance.</p>

<p>This topic includes the following information:</p>
<div>
<ul>
    <li><a href='#Configuringmultiplerepositories-Creatingmultiplerepositoriesonasingleserverinstance'>Creating
multiple repositories on a single server instance</a></li>
<ul>
    <li><a href='#Configuringmultiplerepositories-Creatingarepositorybesidesthedefaultrepository'>Creating
a repository besides the default repository</a></li>
    <li><a href='#Configuringmultiplerepositories-Deployinganapplicationtotherepository'>Deploying
an application to the repository</a></li>
</ul>
    <li><a href='#Configuringmultiplerepositories-Creatingmultiplerepositoriesonmultipleserverinstances'>Creating
multiple repositories on multiple server instances</a></li>
<ul>
    <li><a href='#Configuringmultiplerepositories-Creatingarepositoryforserverinstance2'>Creating
a repository for server instance2</a></li>
    <li><a href='#Configuringmultiplerepositories-Deployingasampleapplicationtoandundeployingitfromtherepository'>Deploying
a sample application to and undeploying it from the repository</a></li>
</ul>
</ul></div>

<p>As an alternative to the steps in this section, a <b>server-repo</b>
plugin is available to perform this configuration for you. Visit the <a href="/confluence/display/GMOxDOC30/Samples"
title="Samples">Samples</a> section for further details.</p>

<h1><a name="Configuringmultiplerepositories-Creatingmultiplerepositoriesonasingleserverinstance"></a>Creating
multiple repositories on a single server instance</h1>

<p>You can create multiple repositories on Geronimo. You can add a second repository
to deploy your applications and leave Geronimo in its default repository.</p>

<h2><a name="Configuringmultiplerepositories-Creatingarepositorybesidesthedefaultrepository"></a>Creating
a repository besides the default repository</h2>

<p>To add a second repository besides the default repository, take the following steps:</p>

<ol>
	<li>Start Geronimo.</li>
	<li>Create a directory repo2 under <tt>&lt;geronimo_home&gt;</tt>,
for example, <tt>&lt;geronimo_home&gt;/repo2</tt>.</li>
	<li>Create a file <tt>repo2.xml</tt> under the <tt>&lt;geronimo_home&gt;/repo2</tt>
directory, for example:
<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>repo2.xml</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;module xmlns=<span class="code-quote">"http:<span class="code-comment">//geronimo.apache.org/xml/ns/deployment-1.2"</span>&gt;
</span> &lt;environment&gt;
  &lt;moduleId&gt;
   &lt;groupId&gt;org.example.configs&lt;/groupId&gt;
    &lt;artifactId&gt;myrepo&lt;/artifactId&gt;
    &lt;version&gt;2.2&lt;/version&gt;
    &lt;type&gt;car&lt;/type&gt;
  &lt;/moduleId&gt;
  &lt;dependencies&gt;
   &lt;dependency&gt;
    &lt;groupId&gt;org.apache.geronimo.framework&lt;/groupId&gt;
    &lt;artifactId&gt;j2ee-system&lt;/artifactId&gt;
    &lt;type&gt;car&lt;/type&gt;
   &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;hidden-classes/&gt;
  &lt;non-overridable-classes/&gt;
 &lt;/environment&gt;
 &lt;gbean name=<span class="code-quote">"Repo2"</span> class=<span class="code-quote">"org.apache.geronimo.system.repository.Maven2Repository"</span>&gt;
   &lt;attribute name=<span class="code-quote">"root"</span>&gt;repo2/&lt;/attribute&gt;
   &lt;attribute name=<span class="code-quote">"resolveToServer"</span>&gt;<span
class="code-keyword">false</span>&lt;/attribute&gt;
   &lt;reference name=<span class="code-quote">"ServerInfo"</span>&gt;
    &lt;name&gt;ServerInfo&lt;/name&gt;
   &lt;/reference&gt;
 &lt;/gbean&gt;
 &lt;gbean name=<span class="code-quote">"Local2"</span> class=<span class="code-quote">"org.apache.geronimo.system.configuration.RepositoryConfigurationStore"</span>&gt;
  &lt;reference name=<span class="code-quote">"Repository"</span>&gt;
   &lt;name&gt;Repo2&lt;/name&gt;
  &lt;/reference&gt;
 &lt;/gbean&gt;
&lt;/module&gt;
</pre>
</div></div></li>
	<li>Deploy the <tt>repo2.xml</tt> from the command prompt:<br/>
<b><tt>deploy(.bat|.sh) deploy &lt;Geronimo_HOME&gt;/repo2/repo2.xml</tt></b><br/>
.<br/>
To verify that the repository is successfully deployed, you can list the targets on the current
server with the command:<br/>
<b><tt>deploy(.bat|.sh) list-targets</tt></b>, and you can see the
following information:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>Available Targets:
  org.apache.geronimo.framework/j2ee-system/2.2/car?ServiceModule=org.apache.geronimo.framework/j2ee-system/2.2/car,j2eeType=ConfigurationStore,name=Local
  org.example.configs/myrepo/2.2/car?ServiceModule=org.example.configs/myrepo/2.2/car,j2eeType=ConfigurationStore,name=Local2
</pre>
</div></div></li>
	<li>Update the <tt>etc/org.ops4j.pax.url.mvn.cfg</tt> file, add the new
second repository to the <tt>org.ops4j.pax.url.mvn.defaultRepositories</tt> property<br/>
The property <tt>org.ops4j.pax.url.mvn.defaultRepositories</tt> maintains a comma-delimited
list of repositories that are used by the run-time server.<br/>
The format is: <tt>file:</tt> &lt; <em>/absolute/path/to/repo2</em>
&gt; <tt>@snapshots</tt><br/>
And if a variable it used, the new repository just deployed would be defined as:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">file:${org.apache.geronimo.server.dir}/repo2@snapshots</pre>
</div></div>
<p>And the resulting property would be set to something that looks like this:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">org.ops4j.pax.url.mvn.defaultRepositories=file:${karaf.home}/repository@snapshots,file:${org.apache.geronimo.server.dir}/repo2@snapshots</pre>
</div></div>
<p>The first defined repository is the default and primary GERONIMO_HOME/repository,
the second one is the new <b>repo2</b> repository just created.</p></li>
</ol>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>In Geronimo 3.0, there is a minor
bug that exists when creating additional repositories for Geronimo instances. The files <tt>GERONIMO_HOME/var/config/config.xml</tt>
and <tt>GERONIMO_HOME/var/config/config-substitutions.properties</tt> must exist
even though they are never used, otherwise Geronimo will fail complaining that they do not
exist. Simply create these files, or copy them from <tt>GERONIMO_SERVER/var/config/...</tt>
to work around this issue.

<p>See <a href="https://issues.apache.org/jira/browse/GERONIMO-6284" class="external-link"
rel="nofollow">GERONIMO-6284</a> for details.</p></td></tr></table></div>


<h2><a name="Configuringmultiplerepositories-Deployinganapplicationtotherepository"></a>Deploying
an application to the repository</h2>

<p>Here is an example of deploying a sample jsp application to the repository repo2.</p>

<ol>
	<li>List the targets on the current server via the command: <b><tt>deploy(.bat|.sh)
list-targets</tt></b>, and you can see the following information:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>Available Targets:
org.example.configs/myrepo/2.2/car?ServiceModule=org.example.configs/myrepo/2.2/car,j2eeType=ConfigurationStore,name=Local2
org.apache.geronimo.configs/j2ee-system/2.2/car?ServiceModule=org.apache.geronimo.configs/j2ee-system/2.2/car,j2eeType=ConfigurationStore,name=Local
</pre>
</div></div></li>
	<li>Set the environment variable REPO2:<br/>
On a Windows system <b>set REPO2=org.example.configs/myrepo/2.2/car?ServiceModule=org.example.configs/myrepo/2.2/car,j2eeType=ConfigurationStore,name=Local2</b>
         <br/>
On  a non-Windows system <b>export REPO2=org.example.configs/myrepo/2.2/car?ServiceModule=org.example.configs/myrepo/2.2/car,j2eeType=ConfigurationStore,name=Local2</b>
  </li>
	<li>Deploy the application to the repository repo2 with the following deploy (.bat
or .sh) command:<br/>
On a Windows system <b>deploy.bat deploy --targets %REPO2% &lt;SAMPLE_HOME&gt;/applications/geronimo-jsp-examples/target/geronimo-jsp-examples-2.2.war</b><br/>
On  a non-Windows system <b>deploy.sh deploy --targets $REPO2 &lt;SAMPLE_HOME&gt;/applications/geronimo-jsp-examples/target/geronimo-jsp-examples-2.2.war</b><br/>
where &lt;SAMPLE_HOME&gt; is the directory of your samples. Then, the jsp example
is deployed to the new repository repo2. The following message is displayed:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>Deployed
org.apache.geronimo.applications.examples/geronimo-jsp-examples/2.2/war
@ /jsp-examples</pre>
</div></div></li>
	<li>Access the application at http://<em>host</em>:<em>port</em>/jsp-examples.</li>
</ol>


<p>To undeploy the application from the repository repo2, run the following deploy (.bat
or .sh) command:<br/>
On a Windows system <b>deploy.bat undeploy "%REPO2%|org.apache.geronimo.applications.examples/geronimo-jsp-examples/2.2/war"</b><br/>
On  a non-Windows system <b>deploy.sh undeploy "$REPO2|org.apache.geronimo.applications.examples/geronimo-jsp-examples/2.2/war"</b></p>


<h1><a name="Configuringmultiplerepositories-Creatingmultiplerepositoriesonmultipleserverinstances"></a>Creating
multiple repositories on multiple server instances</h1>

<p>Create several server instances, and start the server instances. For information
about creating server instances, see <a href="/confluence/display/GMOxDOC30/Running+multiple+Geronimo+instances"
title="Running multiple Geronimo instances">Running multiple Geronimo instances</a>.
Then you need to create several repositories on these server instances. You can test the repositories
by deploying an application to these server instances and undeploying the application from
these server instances.</p>


<h2><a name="Configuringmultiplerepositories-Creatingarepositoryforserverinstance2"></a>Creating
a repository for server instance2</h2>

<p>After you create more than one server instance, you can create repositories and deploy
the repositories to different server instances. For information about how to create and deploy
a repository on a server instance, see the following example that creates repo22 and deploys
it on server2:</p>
<ol>
	<li>Create a directory repo22 under <tt>&lt;geronimo_home&gt;</tt>,
for example, <tt>&lt;geronimo_home&gt;/repo22</tt>.</li>
	<li>Create a file <tt>repo22.xml</tt> under the <tt>&lt;geronimo_home&gt;/repo22</tt>
directory. For detailed information about the file, see <a href="#Configuringmultiplerepositories-Creatingmultiplerepositoriesonasingleserverinstance"
title="creating multiple repositories">creating multiple repositories</a>.</li>
	<li>Deploy the <tt>repo22.xml</tt> by running the following command from
the command prompt:<br/>
<b><tt>deploy(.bat|.sh) -port <em>instance2_RMI_port</em> deploy &lt;geronimo_home&gt;/server2/repo22/repo22.xml</tt></b></li>
</ol>


<p>You can follow the same steps to create repositories for server instance3.</p>

<h2><a name="Configuringmultiplerepositories-Deployingasampleapplicationtoandundeployingitfromtherepository"></a>Deploying
a sample application to and undeploying it from the repository</h2>

<p>To test the repository that you create, you can deploy a sample application to and
undeploying it from the repository.</p>

<ol>
	<li>Set the environment variable repo22 for the repository repo22 that you have previously
created.</li>
	<li>Deploy the application to the repository repo2 with the following deploy (.bat
or .sh) command:<br/>
On a Windows system <b>deploy.bat -port <em>instance2_RMI_port</em> deploy
--targets %repo22% &lt;SAMPLE_HOME&gt;/applications/geronimo-jsp-examples/target/geronimo-jsp-examples-2.2.war</b><br/>
On  a non-Windows system <b>deploy.sh -port <em>instance2_RMI_port</em>
deploy --targets $repo22 &lt;SAMPLE_HOME&gt;/applications/geronimo-jsp-examples/target/geronimo-jsp-examples-2.2.war</b></li>
	<li>Undeploy the jsp application from repo22 repository with the following command:<br/>
On a Windows system  <b>deploy.bat -port <em>instance2_RMI_port</em> undeploy
%repo22%|org.apache.geronimo.applications.examples/geronimo-jsp-examples/2.2/war</b>
<br/>
On  a non-Windows system  <b>deploy.sh -port <em>instance2_RMI_port</em>
undeploy $repo22|org.apache.geronimo.applications.examples/geronimo-jsp-examples/2.2/war</b></li>
</ol>


<p>You can follow the same steps to deploy applications to and undeploy applications
from repositories on server instance3.</p>


    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configuring+multiple+repositories">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=20645461&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configuring+multiple+repositories?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message