1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference - The GlobalNamingResources Component</title><meta value="Remy Maucherat" name="author"><meta value="remm@apache.org" name="email"><meta value="Yoav Shapira" name="author"><meta value="yoavs@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" |
---|
2 | The Apache Tomcat Servlet/JSP Container |
---|
3 | " align="right" src="../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--LEFT SIDE NAVIGATION--><td nowrap="true" valign="top" width="20%"><p><strong>Links</strong></p><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li></ul><p><strong>Top Level Elements</strong></p><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul><p><strong>Executors</strong></p><ul><li><a href="executor.html">Executor</a></li></ul><p><strong>Connectors</strong></p><ul><li><a href="http.html">HTTP</a></li><li><a href="ajp.html">AJP</a></li></ul><p><strong>Containers</strong></p><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul><p><strong>Nested Components</strong></p><ul><li><a href="globalresources.html">Global Resources</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="valve.html">Valve</a></li></ul><p><strong>Cluster Elements</strong></p><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul><p><strong>Global Settings</strong></p><ul><li><a href="systemprops.html">System properties</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat Configuration Reference</h1><h2>The GlobalNamingResources Component</h2></td><td nowrap="true" valign="top" align="right"><small><a href="printer/globalresources.html"><img alt="Printer Friendly Version" border="0" src="../images/printer.gif"><br>print-friendly<br>version |
---|
4 | </a></small></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> |
---|
5 | |
---|
6 | <p>The <strong>GlobalNamingResources</strong> element defines the global |
---|
7 | JNDI resources for the <a href="server.html">Server</a>.</p> |
---|
8 | |
---|
9 | <p>These resources are listed in the server's global JNDI resource context. |
---|
10 | This context is distinct from the per-web-application JNDI contexts |
---|
11 | described in |
---|
12 | the <a href="../jndi-resources-howto.html">JNDI Resources HOW-TO</a>. |
---|
13 | The resources defined in this element are <strong>not</strong> visible in |
---|
14 | the per-web-application contexts unless you explicitly link them with |
---|
15 | <a href="context.html#Resource Links"><ResourceLink></a> elements. |
---|
16 | </p> |
---|
17 | |
---|
18 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote> |
---|
19 | |
---|
20 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Nested Components"><strong>Nested Components</strong></a></font></td></tr><tr><td><blockquote> |
---|
21 | |
---|
22 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Special Features"><strong>Special Features</strong></a></font></td></tr><tr><td><blockquote> |
---|
23 | |
---|
24 | |
---|
25 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Environment Entries"><strong>Environment Entries</strong></a></font></td></tr><tr><td><blockquote> |
---|
26 | |
---|
27 | <p>You can configure named values that will be made visible to all |
---|
28 | web applications as environment entry resources by nesting |
---|
29 | <code><Environment></code> entries inside this element. For |
---|
30 | example, you can create an environment entry like this:</p> |
---|
31 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
32 | <GlobalNamingResources ...> |
---|
33 | ... |
---|
34 | <Environment name="maxExemptions" value="10" |
---|
35 | type="java.lang.Integer" override="false"/> |
---|
36 | ... |
---|
37 | </GlobalNamingResources> |
---|
38 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr></table></div> |
---|
39 | |
---|
40 | <p>This is equivalent to the inclusion of the following element in the |
---|
41 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>): |
---|
42 | </p> |
---|
43 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
44 | <env-entry> |
---|
45 | <env-entry-name>maxExemptions</env-entry-name> |
---|
46 | <env-entry-value>10</env-entry-value> |
---|
47 | <env-entry-type>java.lang.Integer</env-entry-type> |
---|
48 | </env-entry> |
---|
49 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr></table></div> |
---|
50 | <p>but does <em>not</em> require modification of the deployment descriptor |
---|
51 | to customize this value.</p> |
---|
52 | |
---|
53 | <p>The valid attributes for an <code><Environment></code> element |
---|
54 | are as follows:</p> |
---|
55 | |
---|
56 | <table cellpadding="5" border="1"><tr><th bgcolor="#023264" width="15%"><font color="#ffffff">Attribute</font></th><th bgcolor="#023264" width="85%"><font color="#ffffff">Description</font></th></tr><tr><td valign="center" align="left"><code>description</code></td><td valign="center" align="left"> |
---|
57 | <p>Optional, human-readable description of this environment entry.</p> |
---|
58 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> |
---|
59 | <p>The name of the environment entry to be created, relative to the |
---|
60 | <code>java:comp/env</code> context.</p> |
---|
61 | </td></tr><tr><td valign="center" align="left"><code>override</code></td><td valign="center" align="left"> |
---|
62 | <p>Set this to <code>false</code> if you do <strong>not</strong> want |
---|
63 | an <code><env-entry></code> for the same environment entry name, |
---|
64 | found in the web application deployment descriptor, to override the |
---|
65 | value specified here. By default, overrides are allowed.</p> |
---|
66 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> |
---|
67 | <p>The fully qualified Java class name expected by the web application |
---|
68 | for this environment entry. Must be one of the legal values for |
---|
69 | <code><env-entry-type></code> in the web application deployment |
---|
70 | descriptor: <code>java.lang.Boolean</code>, |
---|
71 | <code>java.lang.Byte</code>, <code>java.lang.Character</code>, |
---|
72 | <code>java.lang.Double</code>, <code>java.lang.Float</code>, |
---|
73 | <code>java.lang.Integer</code>, <code>java.lang.Long</code>, |
---|
74 | <code>java.lang.Short</code>, or <code>java.lang.String</code>.</p> |
---|
75 | </td></tr><tr><td valign="center" align="left"><strong><code>value</code></strong></td><td valign="center" align="left"> |
---|
76 | <p>The parameter value that will be presented to the application |
---|
77 | when requested from the JNDI context. This value must be convertable |
---|
78 | to the Java type defined by the <code>type</code> attribute.</p> |
---|
79 | </td></tr></table> |
---|
80 | |
---|
81 | </blockquote></td></tr></table> |
---|
82 | |
---|
83 | |
---|
84 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Resource Definitions"><strong>Resource Definitions</strong></a></font></td></tr><tr><td><blockquote> |
---|
85 | |
---|
86 | <p>You can declare the characteristics of resources |
---|
87 | to be returned for JNDI lookups of <code><resource-ref></code> and |
---|
88 | <code><resource-env-ref></code> elements in the web application |
---|
89 | deployment descriptor by defining them in this element and then linking |
---|
90 | them with <a href="context.html#Resource Links"><ResourceLink></a> |
---|
91 | elements |
---|
92 | in the <code><strong><Context></strong></code> element. |
---|
93 | |
---|
94 | You <strong>MUST</strong> also define any other needed parameters using |
---|
95 | attributes on the Resource element, to configure |
---|
96 | the object factory to be used (if not known to Tomcat already), and |
---|
97 | the properties used to configure that object factory.</p> |
---|
98 | |
---|
99 | <p>For example, you can create a resource definition like this:</p> |
---|
100 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
101 | <GlobalNamingResources ...> |
---|
102 | ... |
---|
103 | <Resource name="jdbc/EmployeeDB" auth="Container" |
---|
104 | type="javax.sql.DataSource" |
---|
105 | description="Employees Database for HR Applications"/> |
---|
106 | ... |
---|
107 | </GlobalNamingResources> |
---|
108 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr></table></div> |
---|
109 | |
---|
110 | <p>This is equivalent to the inclusion of the following element in the |
---|
111 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p> |
---|
112 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
113 | <resource-ref> |
---|
114 | <description>Employees Database for HR Applications</description> |
---|
115 | <res-ref-name>jdbc/EmployeeDB</res-ref-name> |
---|
116 | <res-ref-type>javax.sql.DataSource</res-ref-type> |
---|
117 | <res-auth>Container</res-auth> |
---|
118 | </resource-ref> |
---|
119 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr></table></div> |
---|
120 | |
---|
121 | <p>but does <em>not</em> require modification of the deployment |
---|
122 | descriptor to customize this value.</p> |
---|
123 | |
---|
124 | <p>The valid attriutes for a <code><Resource></code> element |
---|
125 | are as follows:</p> |
---|
126 | |
---|
127 | <table cellpadding="5" border="1"><tr><th bgcolor="#023264" width="15%"><font color="#ffffff">Attribute</font></th><th bgcolor="#023264" width="85%"><font color="#ffffff">Description</font></th></tr><tr><td valign="center" align="left"><code>auth</code></td><td valign="center" align="left"> |
---|
128 | <p>Specify whether the web Application code signs on to the |
---|
129 | corresponding resource manager programatically, or whether the |
---|
130 | Container will sign on to the resource manager on behalf of the |
---|
131 | application. The value of this attribute must be |
---|
132 | <code>Application</code> or <code>Container</code>. This |
---|
133 | attribute is <strong>required</strong> if the web application |
---|
134 | will use a <code><resource-ref></code> element in the web |
---|
135 | application deployment descriptor, but is optional if the |
---|
136 | application uses a <code><resource-env-ref></code> instead.</p> |
---|
137 | </td></tr><tr><td valign="center" align="left"><code>description</code></td><td valign="center" align="left"> |
---|
138 | <p>Optional, human-readable description of this resource.</p> |
---|
139 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> |
---|
140 | <p>The name of the resource to be created, relative to the |
---|
141 | <code>java:comp/env</code> context.</p> |
---|
142 | </td></tr><tr><td valign="center" align="left"><code>scope</code></td><td valign="center" align="left"> |
---|
143 | <p>Specify whether connections obtained through this resource |
---|
144 | manager can be shared. The value of this attribute must be |
---|
145 | <code>Shareable</code> or <code>Unshareable</code>. By default, |
---|
146 | connections are assumed to be shareable.</p> |
---|
147 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> |
---|
148 | <p>The fully qualified Java class name expected by the web |
---|
149 | application when it performs a lookup for this resource.</p> |
---|
150 | </td></tr></table> |
---|
151 | |
---|
152 | |
---|
153 | </blockquote></td></tr></table> |
---|
154 | |
---|
155 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Resource Links"><strong>Resource Links</strong></a></font></td></tr><tr><td><blockquote> |
---|
156 | <p>Use <a href="context.html#Resource Links"><ResourceLink></a> |
---|
157 | elements to link resources from the global context into |
---|
158 | per-web-application contexts. Here is an example of making a custom |
---|
159 | factory available to all applications in the server, based on the example |
---|
160 | definition in the |
---|
161 | <a href="../jndi-resources-howto.html#Generic JavaBean Resources"> |
---|
162 | JNDI Resource HOW-TO</a>: |
---|
163 | </p> |
---|
164 | |
---|
165 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
166 | |
---|
167 | <DefaultContext> |
---|
168 | <ResourceLink |
---|
169 | name="bean/MyBeanFactory" |
---|
170 | global="bean/MyBeanFactory" |
---|
171 | type="com.mycompany.MyBean" |
---|
172 | /> |
---|
173 | </DefaultContext> |
---|
174 | |
---|
175 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"></td></tr></table></div> |
---|
176 | |
---|
177 | </blockquote></td></tr></table> |
---|
178 | |
---|
179 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Transaction"><strong>Transaction</strong></a></font></td></tr><tr><td><blockquote> |
---|
180 | |
---|
181 | <p>You can declare the characteristics of the UserTransaction |
---|
182 | to be returned for JNDI lookup for <code>java:comp/UserTransaction</code>. |
---|
183 | You <strong>MUST</strong> define an object factory class to instantiate |
---|
184 | this object as well as the needed resource parameters as attributes of the |
---|
185 | <code>Transaction</code> |
---|
186 | element, and the properties used to configure that object factory.</p> |
---|
187 | |
---|
188 | <p>The valid attributes for the <code><Transaction></code> element |
---|
189 | are as follows:</p> |
---|
190 | |
---|
191 | <table cellpadding="5" border="1"><tr><th bgcolor="#023264" width="15%"><font color="#ffffff">Attribute</font></th><th bgcolor="#023264" width="85%"><font color="#ffffff">Description</font></th></tr><tr><td valign="center" align="left"><strong><code>factory</code></strong></td><td valign="center" align="left"> |
---|
192 | <p>The class name for the JNDI object factory.</p> |
---|
193 | </td></tr></table> |
---|
194 | |
---|
195 | </blockquote></td></tr></table> |
---|
196 | |
---|
197 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> |
---|
198 | Copyright © 1999-2008, Apache Software Foundation |
---|
199 | </em></font></div></td></tr></table></body></html> |
---|