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><!--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"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../../images/void.gif"></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> |
---|
4 | |
---|
5 | <p>The <strong>GlobalNamingResources</strong> element defines the global |
---|
6 | JNDI resources for the <a href="server.html">Server</a>.</p> |
---|
7 | |
---|
8 | <p>These resources are listed in the server's global JNDI resource context. |
---|
9 | This context is distinct from the per-web-application JNDI contexts |
---|
10 | described in |
---|
11 | the <a href="../../jndi-resources-howto.html">JNDI Resources HOW-TO</a>. |
---|
12 | The resources defined in this element are <strong>not</strong> visible in |
---|
13 | the per-web-application contexts unless you explicitly link them with |
---|
14 | <a href="context.html#Resource Links"><ResourceLink></a> elements. |
---|
15 | </p> |
---|
16 | |
---|
17 | </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> |
---|
18 | |
---|
19 | </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> |
---|
20 | |
---|
21 | </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> |
---|
22 | |
---|
23 | |
---|
24 | <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> |
---|
25 | |
---|
26 | <p>You can configure named values that will be made visible to all |
---|
27 | web applications as environment entry resources by nesting |
---|
28 | <code><Environment></code> entries inside this element. For |
---|
29 | example, you can create an environment entry like this:</p> |
---|
30 | <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> |
---|
31 | <GlobalNamingResources ...> |
---|
32 | ... |
---|
33 | <Environment name="maxExemptions" value="10" |
---|
34 | type="java.lang.Integer" override="false"/> |
---|
35 | ... |
---|
36 | </GlobalNamingResources> |
---|
37 | </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> |
---|
38 | |
---|
39 | <p>This is equivalent to the inclusion of the following element in the |
---|
40 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>): |
---|
41 | </p> |
---|
42 | <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> |
---|
43 | <env-entry> |
---|
44 | <env-entry-name>maxExemptions</env-entry-name> |
---|
45 | <env-entry-value>10</env-entry-value> |
---|
46 | <env-entry-type>java.lang.Integer</env-entry-type> |
---|
47 | </env-entry> |
---|
48 | </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> |
---|
49 | <p>but does <em>not</em> require modification of the deployment descriptor |
---|
50 | to customize this value.</p> |
---|
51 | |
---|
52 | <p>The valid attributes for an <code><Environment></code> element |
---|
53 | are as follows:</p> |
---|
54 | |
---|
55 | <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"> |
---|
56 | <p>Optional, human-readable description of this environment entry.</p> |
---|
57 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> |
---|
58 | <p>The name of the environment entry to be created, relative to the |
---|
59 | <code>java:comp/env</code> context.</p> |
---|
60 | </td></tr><tr><td valign="center" align="left"><code>override</code></td><td valign="center" align="left"> |
---|
61 | <p>Set this to <code>false</code> if you do <strong>not</strong> want |
---|
62 | an <code><env-entry></code> for the same environment entry name, |
---|
63 | found in the web application deployment descriptor, to override the |
---|
64 | value specified here. By default, overrides are allowed.</p> |
---|
65 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> |
---|
66 | <p>The fully qualified Java class name expected by the web application |
---|
67 | for this environment entry. Must be one of the legal values for |
---|
68 | <code><env-entry-type></code> in the web application deployment |
---|
69 | descriptor: <code>java.lang.Boolean</code>, |
---|
70 | <code>java.lang.Byte</code>, <code>java.lang.Character</code>, |
---|
71 | <code>java.lang.Double</code>, <code>java.lang.Float</code>, |
---|
72 | <code>java.lang.Integer</code>, <code>java.lang.Long</code>, |
---|
73 | <code>java.lang.Short</code>, or <code>java.lang.String</code>.</p> |
---|
74 | </td></tr><tr><td valign="center" align="left"><strong><code>value</code></strong></td><td valign="center" align="left"> |
---|
75 | <p>The parameter value that will be presented to the application |
---|
76 | when requested from the JNDI context. This value must be convertable |
---|
77 | to the Java type defined by the <code>type</code> attribute.</p> |
---|
78 | </td></tr></table> |
---|
79 | |
---|
80 | </blockquote></td></tr></table> |
---|
81 | |
---|
82 | |
---|
83 | <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> |
---|
84 | |
---|
85 | <p>You can declare the characteristics of resources |
---|
86 | to be returned for JNDI lookups of <code><resource-ref></code> and |
---|
87 | <code><resource-env-ref></code> elements in the web application |
---|
88 | deployment descriptor by defining them in this element and then linking |
---|
89 | them with <a href="context.html#Resource Links"><ResourceLink></a> |
---|
90 | elements |
---|
91 | in the <code><strong><Context></strong></code> element. |
---|
92 | |
---|
93 | You <strong>MUST</strong> also define any other needed parameters using |
---|
94 | attributes on the Resource element, to configure |
---|
95 | the object factory to be used (if not known to Tomcat already), and |
---|
96 | the properties used to configure that object factory.</p> |
---|
97 | |
---|
98 | <p>For example, you can create a resource definition like this:</p> |
---|
99 | <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> |
---|
100 | <GlobalNamingResources ...> |
---|
101 | ... |
---|
102 | <Resource name="jdbc/EmployeeDB" auth="Container" |
---|
103 | type="javax.sql.DataSource" |
---|
104 | description="Employees Database for HR Applications"/> |
---|
105 | ... |
---|
106 | </GlobalNamingResources> |
---|
107 | </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> |
---|
108 | |
---|
109 | <p>This is equivalent to the inclusion of the following element in the |
---|
110 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p> |
---|
111 | <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> |
---|
112 | <resource-ref> |
---|
113 | <description>Employees Database for HR Applications</description> |
---|
114 | <res-ref-name>jdbc/EmployeeDB</res-ref-name> |
---|
115 | <res-ref-type>javax.sql.DataSource</res-ref-type> |
---|
116 | <res-auth>Container</res-auth> |
---|
117 | </resource-ref> |
---|
118 | </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> |
---|
119 | |
---|
120 | <p>but does <em>not</em> require modification of the deployment |
---|
121 | descriptor to customize this value.</p> |
---|
122 | |
---|
123 | <p>The valid attriutes for a <code><Resource></code> element |
---|
124 | are as follows:</p> |
---|
125 | |
---|
126 | <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"> |
---|
127 | <p>Specify whether the web Application code signs on to the |
---|
128 | corresponding resource manager programatically, or whether the |
---|
129 | Container will sign on to the resource manager on behalf of the |
---|
130 | application. The value of this attribute must be |
---|
131 | <code>Application</code> or <code>Container</code>. This |
---|
132 | attribute is <strong>required</strong> if the web application |
---|
133 | will use a <code><resource-ref></code> element in the web |
---|
134 | application deployment descriptor, but is optional if the |
---|
135 | application uses a <code><resource-env-ref></code> instead.</p> |
---|
136 | </td></tr><tr><td valign="center" align="left"><code>description</code></td><td valign="center" align="left"> |
---|
137 | <p>Optional, human-readable description of this resource.</p> |
---|
138 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> |
---|
139 | <p>The name of the resource to be created, relative to the |
---|
140 | <code>java:comp/env</code> context.</p> |
---|
141 | </td></tr><tr><td valign="center" align="left"><code>scope</code></td><td valign="center" align="left"> |
---|
142 | <p>Specify whether connections obtained through this resource |
---|
143 | manager can be shared. The value of this attribute must be |
---|
144 | <code>Shareable</code> or <code>Unshareable</code>. By default, |
---|
145 | connections are assumed to be shareable.</p> |
---|
146 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> |
---|
147 | <p>The fully qualified Java class name expected by the web |
---|
148 | application when it performs a lookup for this resource.</p> |
---|
149 | </td></tr></table> |
---|
150 | |
---|
151 | |
---|
152 | </blockquote></td></tr></table> |
---|
153 | |
---|
154 | <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> |
---|
155 | <p>Use <a href="context.html#Resource Links"><ResourceLink></a> |
---|
156 | elements to link resources from the global context into |
---|
157 | per-web-application contexts. Here is an example of making a custom |
---|
158 | factory available to all applications in the server, based on the example |
---|
159 | definition in the |
---|
160 | <a href="../../jndi-resources-howto.html#Generic JavaBean Resources"> |
---|
161 | JNDI Resource HOW-TO</a>: |
---|
162 | </p> |
---|
163 | |
---|
164 | <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> |
---|
165 | |
---|
166 | <DefaultContext> |
---|
167 | <ResourceLink |
---|
168 | name="bean/MyBeanFactory" |
---|
169 | global="bean/MyBeanFactory" |
---|
170 | type="com.mycompany.MyBean" |
---|
171 | /> |
---|
172 | </DefaultContext> |
---|
173 | |
---|
174 | </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> |
---|
175 | |
---|
176 | </blockquote></td></tr></table> |
---|
177 | |
---|
178 | <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> |
---|
179 | |
---|
180 | <p>You can declare the characteristics of the UserTransaction |
---|
181 | to be returned for JNDI lookup for <code>java:comp/UserTransaction</code>. |
---|
182 | You <strong>MUST</strong> define an object factory class to instantiate |
---|
183 | this object as well as the needed resource parameters as attributes of the |
---|
184 | <code>Transaction</code> |
---|
185 | element, and the properties used to configure that object factory.</p> |
---|
186 | |
---|
187 | <p>The valid attributes for the <code><Transaction></code> element |
---|
188 | are as follows:</p> |
---|
189 | |
---|
190 | <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"> |
---|
191 | <p>The class name for the JNDI object factory.</p> |
---|
192 | </td></tr></table> |
---|
193 | |
---|
194 | </blockquote></td></tr></table> |
---|
195 | |
---|
196 | </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> |
---|
197 | Copyright © 1999-2008, Apache Software Foundation |
---|
198 | </em></font></div></td></tr></table></body></html> |
---|