Wiki source code of Tomcat Installation

Version 86.1 by Thomas Mortagne on 2023/10/10

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 = Installation Steps =
6
7 * Download and install [[Tomcat 8+>>http://tomcat.apache.org/]]. There are plenty of ways to install Tomcat, refer to the Tomcat site for more information. Let's call ##TOMCAT_HOME## the directory where it's installed.(((
8 {{warning}}
9 * Using Tomcat 10 is not possible right now since it moved to the incompatible Jakarta EE 9 API. See [[Apache Tomcat migration tool for Jakarta EE>>https://github.com/apache/tomcat-jakartaee-migration]] for mode details.
10 * Tomcat 9.0.70 has some bugs that make it fail with XWiki. See:
11 ** -- https://jira.xwiki.org/browse/XWIKI-20470 -- (A Tomcat regression now fixed in Tomcat 9.0.71+)
12 ** https://jira.xwiki.org/browse/XWIKI-20476 (A Tomcat behavior change, that will require some fix in XWiki)
13 {{/warning}}
14 )))
15 * Make sure you [[give enough memory to Java>>Documentation.AdminGuide.InstallationTomcat#HOutOfMemoryError]] since by default Tomcat is not configured with enough memory for XWiki.
16 * Extract the [[XWiki WAR>>xwiki:Main.Download]] into a directory named ##xwiki## in ##TOMCAT_HOME/webapps/##
17 * Open ##TOMCAT_HOME/webapps/xwiki/WEB-INF/xwiki.properties## files and [[configure a permanent directory>>Documentation.AdminGuide.Configuration#HConfiguringDirectories]]
18 * Start Tomcat
19 * When Tomcat has opened go to your wiki by accessing [[http:~~/~~/localhost:8080/xwiki/bin/view/Main/>>http://localhost:8080/xwiki/bin/view/Main/]]
20 * NOTE - if you have issues with maximum cache size - In your ##$CATALINA_BASE/conf/context.xml## add the following content before ##</Context>##:(((
21 {{code language="none"}}
22 <Resources cachingAllowed="true" cacheMaxSize="100000" ></Resources>
23 {{/code}}
24 )))
25
26 == Activate headless mode ==
27
28 If you're operating XWiki on a Linux server with no X11 libraries installed you have to enable headless mode for your Tomcat installation. Sometimes this is also needed on Windows platforms. Typical exceptions are:
29
30 * ##Exception: Could not initialize class sun.awt.X11.XToolkit##
31 * ##java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable##
32 * ##Error number 0 in 11: Uncaught exception##
33 * ##java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE##
34
35 * On Linux create a file ##///TOMCAT_HOME///bin/setenv.sh## and insert the following code:(((
36 {{code language="none"}}
37 #!/bin/sh
38 export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"
39 {{/code}}
40 )))
41 * On Windows create a file ##///TOMCAT_HOME///bin/setenv.bat## and insert the following code:(((
42 {{code language="none"}}
43 set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true
44 {{/code}}
45 )))
46 * When running as a Windows service the ##setenv.bat## is not working. See registry ##HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\//FOOBAR//\Parameters\Java## for similar settings.
47
48 == Optional configuration ==
49
50 * To enable gzip compression the connector property in the ##server.xml## file needs to be modified. The location of the ##server.xml## file is found at:
51 - On Linux: ##/etc/tomcat[version]/server.xml##
52 - On Windows: ##//TOMCAT_HOME///conf/server.xml##(((
53 {{code language="none"}}
54 <Connector port="8080"
55 ...
56 compression="on"
57 compressionMinSize="2048"
58 compressibleMimeType="text/html,text/xml,text/css,text/javascript,application/x-javascript">
59 </Connector>
60 {{/code}}
61 )))
62 * To modify the port on which Tomcat will run, search in ##server.xml## for all instances of {{code}}8080{{/code}} (in Linux this can also be {{code}}8180{{/code}}) and replace this with the port value you wish to use.
63 * It is possible to setup a Tomcat Java Server as a UNIX Daemon - JSVC. Just follow [[these instructions>>http://www.malisphoto.com/tips/tomcatonosx.html?#Anchor-JSVC||rel="noopener noreferrer" target="new"]].
64 The only reason to make Tomcat a daemon is to make it runnable on port 80, which can be replaced by using a proxy server (such as NginX or Apache) on port 80 and then forwarding to Tomcat on port 8080.
65
66 == Policy configuration ==
67
68 For those who activate the security manager for Tomcat, add this portion of code to the end of your ##conf/catalina.policy## file from your Tomcat installation. You can adapt the code for the available installations of OpenOffice/LibreOffice on your server and for different databases :
69
70 {{code language="none"}}
71 grant codeBase "file:${catalina.base}/webapps/xwiki/WEB-INF/lib/-" {
72 // for mySQL connection
73 permission java.net.SocketPermission "127.0.0.1:3306", "connect,resolve";
74
75 // XWiki must have access to all properties in read/write
76 permission java.util.PropertyPermission "*", "read, write";
77
78 // Generic detected permissions
79 permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
80 permission java.lang.RuntimePermission "createClassLoader";
81 permission java.lang.RuntimePermission "setContextClassLoader";
82 permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.loader";
83 permission java.lang.RuntimePermission "accessDeclaredMembers";
84 permission java.lang.RuntimePermission "getenv.ProgramFiles";
85 permission java.lang.RuntimePermission "getenv.APPDATA";
86 permission java.lang.RuntimePermission "accessClassInPackage.sun.reflect";
87 permission java.lang.RuntimePermission "getClassLoader";
88 permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.connector";
89 permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.threads";
90 permission java.lang.RuntimePermission "reflectionFactoryAccess";
91 permission java.lang.RuntimePermission "accessClassInPackage.com.sun.jmx.interceptor";
92 permission java.lang.RuntimePermission "accessClassInPackage.com.sun.jmx.mbeanserver";
93 permission java.lang.RuntimePermission "modifyThread";
94 permission java.lang.RuntimePermission "getProtectionDomain";
95
96 // JAXB permissions
97 permission javax.xml.bind.JAXBPermission "setDatatypeConverter";
98
99 // Serialization related permissions
100 permission java.io.SerializablePermission "allowSerializationReflection";
101 permission java.io.SerializablePermission "creator";
102 permission java.io.SerializablePermission "enableSubclassImplementation";
103
104 // Internal resources access permissions
105 permission java.io.FilePermission "synonyms.txt", "read";
106 permission java.io.FilePermission "lang/synonyms_en.txt", "read";
107 permission java.io.FilePermission "quartz.properties", "read";
108 permission java.io.FilePermission "/templates/-", "read";
109 permission java.io.FilePermission "/skins/-", "read";
110 permission java.io.FilePermission "/resources/-", "read";
111
112 // MBean related permissions
113 permission javax.management.MBeanServerPermission "createMBeanServer";
114 permission javax.management.MBeanPermission "*", "registerMBean";
115 permission javax.management.MBeanPermission "*", "unregisterMBean";
116 permission javax.management.MBeanTrustPermission "register";
117 permission javax.management.MBeanPermission "-#-[-]", "queryNames";
118 permission javax.management.MBeanServerPermission "findMBeanServer";
119
120 // LibreOffice/OpenOffice related permissions
121 permission java.io.FilePermission "/opt/openoffice.org3/program/soffice.bin", "read";
122 permission java.io.FilePermission "/opt/libreoffice/program/soffice.bin", "read";
123 permission java.io.FilePermission "/usr/lib/openoffice/program/soffice.bin", "read";
124 permission java.io.FilePermission "/usr/lib/libreoffice/program/soffice.bin", "read";
125
126 // Allow file storage directory reading - for directory and everything underneath
127 // This is dependent on the setting of environment.permanentDirectory in xwiki.properties
128 permission java.io.FilePermission "${catalina.base}${file.separator}xwikidata${file.separator}", "read,write,delete";
129 permission java.io.FilePermission "${catalina.base}${file.separator}xwikidata${file.separator}-", "read,write,delete";
130
131 // Allow file storage directory reading - temporary directory and everything underneath
132 // This is dependent on the setting of environment.temporaryDirectory in xwiki.properties.
133 permission java.io.FilePermission "${catalina.base}${file.separator}temp${file.separator}", "read,write,delete";
134 permission java.io.FilePermission "${catalina.base}${file.separator}temp${file.separator}-", "read,write,delete";
135 };
136 {{/code}}
137
138 Please note that this policy configuration file has been tested on CentOS 5.9 with Sun JDK 1.7.0u21 on Tomcat 7.0.40 with XWiki 5.0.1 installed.
139
140 == Using Nginx as a reverse-proxy for Tomcat (http/https) ==
141
142 For a [[variety of reasons>>https://en.wikipedia.org/wiki/Reverse_proxy||rel="__blank"]], it is not ideal to allow users to connect directly to tomcat. A popular choice for a reverse-proxy web server is [[Nginx>>http://wiki.nginx.org/Main||rel="__blank"]]. These instructions will walk through a very basic deployment of nginx acting as a reverse-proxy for the tomcat XWiki application.
143
144 After a typical XWiki installation XWiki will be running on ##http:~/~/localhost:8080/xwiki##. Ultimately we will want to access XWiki via ##http:~/~/mydomain.com## on a standard http (80) or https (443) port. To accomplish this for unsecure http traffic, the following basic config file gets us started.
145
146 === Http (unsecure) ===
147
148 * create this file ##/etc/nginx/conf.d/tomcat.conf##
149 * put the following code inside:(((
150 {{code language="none"}}
151 server {
152 listen 80;
153 server_name mydomain.com;
154
155 # Normally root should not be accessed, however, root should not serve files that might compromise the security of your server.
156 root /var/www/html;
157
158 # Configuration to avoid Request Entity too large error 413
159 client_max_body_size 0;
160
161 location / {
162 # All "root" requests will have /xwiki appended AND redirected to mydomain.com
163 rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
164 }
165
166 location ^~ /xwiki {
167 # If path starts with /xwiki - then redirect to backend: XWiki application in Tomcat
168 # Read more about proxy_pass: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
169 proxy_pass http://localhost:8080;
170 proxy_set_header X-Real-IP $remote_addr;
171 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
172 proxy_set_header Host $http_host;
173 proxy_set_header X-Forwarded-Proto $scheme;
174 }
175 }
176 {{/code}}
177 )))
178 * restart nginx
179
180 Now all ##http:~/~/mydomain.com/*## requests will lead to the XWiki application. Please note that these settings are basic. For more flexible solutions please refer to [[the Nginx documentation>>http://wiki.nginx.org/Main||rel="__blank"]].
181
182 === Https (secure) ===
183
184 There are many guides on how to create a secure configuration of nginx. To get started:
185
186 * [[Strong SSL Security on nginx>>https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html||rel="__blank"]]
187 * [[How To Secure Nginx With LetsEncrypt on Ubuntu 16.04>>https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04||rel="__blank"]]
188
189 The following config assumes you are using LetsEncrypt and that your XWiki is hosted on ##http:~/~/localhost:8080/##. This config will redirect all unsecure requests to https:~/~/ and set the correct proxy headers for a secure nginx+tomcat setup.
190
191 First, you will need to add the following config to tomcat's ##server.xml##. The first line should already be in the file, I include it to give you something to search for (that line is located on line 108 in the Ubuntu 16.04 tomcat8 package). This will help tomcat find your proxy headers.
192
193 (((
194 {{code language="none"}}
195 <Engine name="Catalina" defaultHost="localhost">
196 <Valve className="org.apache.catalina.valves.RemoteIpValve"
197 internalProxies="127\.0\.[0-1]\.1"
198 remoteIpHeader="x-forwarded-for"
199 requestAttributesEnabled="true"
200 protocolHeader="x-forwarded-proto"
201 protocolHeaderHttpsValue="https"></Valve>
202 {{/code}}
203 )))
204
205 Next, add the following nginx config file to your nginx config folder, replacing ##wiki.yourdomain.com## with your actual domain info:
206
207 (((
208 {{code language="none"}}
209 server {
210 listen 80;
211 server_name wiki.yourdomain.com;
212
213 location ~ /.well-known {
214 allow all;
215 }
216
217 rewrite ^ https://$server_name$request_uri? permanent;
218
219 access_log /var/log/nginx-xwiki/access.log;
220 error_log /var/log/nginx-xwiki/error.log;
221
222 }
223
224 server {
225 listen 443;
226 server_name wiki.yourdomain.com;
227
228 root /var/www/html;
229
230 # Configuration to avoid Request Entity too large error 413
231 client_max_body_size 0;
232
233 ssl on;
234 ssl_certificate /etc/letsencrypt/live/wiki.yourdomain.com/fullchain.pem;
235 ssl_certificate_key /etc/letsencrypt/live/wiki.yourdomain.com/privkey.pem;
236
237 access_log /var/log/nginx-xwiki/access_ssl.log;
238 error_log /var/log/nginx-xwiki/error_ssl.log;
239
240 location / {
241 proxy_set_header Host $http_host;
242 proxy_set_header X-Real-IP $remote_addr;
243 proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
244 proxy_set_header X-Forwarded-Proto $scheme;
245 proxy_set_header X-Scheme $scheme;
246 proxy_redirect off;
247 if (!-f $request_filename) {
248 proxy_pass http://127.0.0.1:8080;
249 break;
250 }
251 }
252
253 location ~ /.well-known {
254 allow all;
255 }
256 }
257 {{/code}}
258 )))
259
260 For more background on this config, see the discussion on this ticket: [[XWIKI-13963>>http://jira.xwiki.org/browse/XWIKI-13963||rel="__blank"]].
261
262 === Proxying and tunnels ===
263
264 This proxy methods brings remote connections to local connection. This is complementary to SSH-tunneling which is easily done on port 8080 and can be used to test development servers.
265
266 For example, if you are running an XWiki on port 80 on your laptop while running the NGinx (or Apache) on a server where it is accessible as ##https://wiki.yourdomain.com##, you can make your XWiki acessible with this URL:##
267
268 * First make sure that the port 8080 is not in use: You can proof this with ##{{{ssh server wget -O - https://127.0.0.1:8080/}}}## which should display the error message //Connection refused//. If not, something is running there and it should be stopped.
269 * You can then create the tunnel with the following ##ssh -R8080:127.0.0.1:8080 server##. This tells the server that incoming ("R"emote) connections on port 8080 on the server are to be tunnelled to the local (laptop) port 8080. This method has the advantage that the laptop (typically using a dynamic address) invokes the SSH where as a proxy configured on the server to proxy to the laptop would need to know the address of the laptop.
270
271 == Configuring tomcat for https ==
272
273 Although allowing users to directly connect to tomcat is not recommended, for a variety of reasons it may be desirable to configure tomcat to serve pages over an https connection. Since urls are generated from relative path (##/xwiki/bin/show/Space/Page##), Tomcat has to know which protocol to use, otherwise JSON requests with redirect fails such as in attachment uploads, extension updating, etc.
274
275 If you are using another server as a HTTPS proxy (such as Nginx, Apache httpd or HAProxy), follow the instructions below to avoid unexpected errors (such as "failed to lock page").
276
277 * Modify the connector property in ##server.xml## to set the correct https attributes(((
278 {{code language="none"}}
279 <Connector port="8080"
280 ...
281 secure="true"
282 scheme="https">
283 </Connector>
284 {{/code}}
285 )))
286 * Modify the host property in ##server.xml## to add the Remote Ip Valve(((
287 {{code language="none"}}
288 <Valve className="org.apache.catalina.valves.RemoteIpValve"
289 remoteIpHeader="x-forwarded-for"
290 protocolHeader="x-forwarded-proto">
291 </Valve>
292 {{/code}}
293 )))
294
295 {{info}}
296 **Important**
297 Remember to set ##X-Forwarded-For## and ##X-Forwarded-Proto## headers on HTTPS guard server (on which Apache httpd or Nginx runs)
298 {{/info}}
299
300 = Recommendations =
301
302 == Default encoding ==
303
304 XWiki strives to not be impacted by the default encoding, but it's still possible to have bugs or simply mistakes in extensions or tools used by XWiki (database connectors, etc.) so it's highly recommended to make sure Tomcat is started with utf8 as default encoding. If you use a Linux package of Tomcat this is generally set by default, but it might not always be the case. For that, make sure you have ##-Dfile.encoding=utf8## in the Java command line which starts Tomcat.
305
306 = Troubleshooting =
307
308 == Out Of Memory Error ==
309
310 === General Memory Settings ===
311
312 When you run XWiki in Tomcat with the default settings, you'll probably get an ##Out Of Memory## error (##java.lang.OutOfMemoryError: Java heap space## or ##java.lang.OutOfMemoryError: PermGen space##) since the default Tomcat memory settings are not enough for [[XWiki Memory Requirements>>Documentation.AdminGuide.Performances#HMemory]]. You'll need to allocate more memory to the JVM.
313
314 One easy solution to configure Tomcat's memory is to create a ##setenv.sh## file (or ##setenv.bat## on Windows) in ##[TOMCAT_HOME]/bin/## (where ##[TOMCAT_HOME]## is where you've installed Tomcat) and inside this file add the following (adjust the memory values according to the [[XWiki Memory Requirements>>Documentation.AdminGuide.Performances#HMemory]]). For example:
315
316 {{code language="none"}}
317 CATALINA_OPTS="-Xmx1024m -XX:MaxPermSize=192m"
318 {{/code}}
319
320 On most Linux distributions, this can also be achieved in ##/etc/tomcat//X///tomcat//X//.conf## or ##/etc/conf.d/tomcat//X//.conf## (where //X// is the version of Tomcat installed).
321
322 On Windows, if you are running Tomcat as a service then defining ##CATALINA_OPTS## will not help. There is an utility provided in the ##bin## folder of your Tomcat installation (for example for Tomcat 5.x on Windows it's called tomcat5w.exe). It's a GUI tool which can be used to set various options including the heap size.
323
324 === Max number of threads ===
325
326 On some Debian 10 installations there can be a limitation of the max number of threads for services started with ##systemd## (and ##tomcat9## is such a service), what can force problems with OOM Errors: ##Out Of Memory## error (##java.lang.OutOfMemoryError: unable to create native thread##)
327
328 If you have such messages in the ##catalina.out## check your default limitations of the ##systemd## with the command
329
330 {{code language="none"}}
331 > systemctl show --property DefaultTasksMax
332 {{/code}}
333
334 For XWiki a value of about 100 is too low. Depending on the number of parallel users and sub wikis, this value should be larger. A value of about 512 should be sufficient.
335
336 Changing the parameter ##DefaultTasksMax## in ##/etc/systemd/system.conf## to a larger value, restarting the ##system-daemon## and ##tomcat9##, should solve the problem.
337
338 {{code language="none"}}
339 > systemctl daemon-reload
340 > systemctl restart tomcat9
341 {{/code}}
342
343 If the problem is not fixed with these changes, check the number of currently used threads by tomcat9 with the command
344
345 {{code language="none"}}
346 > ps -elfT | grep tomcat9| wc -l
347 {{/code}}
348
349 If the value is very near to the configured ##DefaultTasksMax##, you can try to increase it to an appropriate value.
350
351 == Java Security Manager ==
352
353 By default Tomcat is configured to have the Java Security Manager turned on. See the [[sample policy file>>Documentation.AdminGuide.InstallationWAR#HInstallandconfigureaServletContainer]] for more details.
354
355 If you want to turn off the Java Security Manager for Tomcat, edit the Tomcat startup script. You might also want to check your ##/etc/init.d/tomcat## file or ##/etc/default/tomcat5.5##. You should see the following code:
356
357 {{code language="none"}}
358 # Use the Java security manager? (yes/no)
359 TOMCAT5_SECURITY=
360 {{/code}}
361
362 Set it to ##no## to turn off the Security Manager.
363
364 == Allowing "/" and "\" in page names ==
365
366 Tomcat completely freaks out when there's a ##%2F## or ##%5C## in URLs and it's not something that can be changed in XWiki. See [[this note>>http://tomcat.apache.org/security-6.html#Fixed_in_Apache_Tomcat_6.0.10]] for more information.
367
368 You can configure Tomcat to allow "/", by setting the ##org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH## system property to ##true##, as in:
369
370 {{code language="none"}}
371 -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
372 {{/code}}
373
374 And by setting the ##org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH## system property to ##true## to allow "\", as in:
375
376 {{code language="none"}}
377 -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true
378 {{/code}}
379
380 To have both properties permanently enabled on your Tomcat instance, add the lines below to your ##CATALINA_OPTS## environment variable. How to achieve this depends on your operating system, Tomcat distribution and single/multi-instance setup.
381
382 {{code language="none"}}
383 -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
384 -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true
385 {{/code}}
386
387 === Apache front-end server ===
388
389 Note that if you're using the Apache web server as a front-end, you also need to [[configure Apache to allow encoded / and \>>https://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes]] (##AllowEncodedSlashes NoDecode##) and also make sure to use ##nocanon## on the [[ProxyPass line used>>https://httpd.apache.org/docs/2.4/mod/mod_proxy.html]].
390
391 == NotSerializableException ==
392
393 If you get the following:
394
395 {{code language="none"}}
396 SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.xwiki.model.internal.reference.LocalStringEntityReferenceSerializer
397 java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.xwiki.model.internal.reference.LocalStringEntityReferenceSerializer
398 at java.io.ObjectInputStream.readObject0(Unknown Source)
399 at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
400 {{/code}}
401
402 This means that on startup Tomcat tries to load saved Sessions and fails to do so. In this case it fails because some non-serializable object was put in the Servlet Session. To work around the issue [[you can tell Tomcat to not save sessions>>http://dev-answers.blogspot.fr/2007/03/how-to-turn-off-tomcat-session.html]].
403
404 == SEVERE: Error listenerStart ==
405
406 If you get this error in your Tomcat logs then you'll need to enable finer-grained logging configuration to see what's the problem. This involves copying the following content in a ##WEB-INF/classes/logging.properties## file:
407
408 {{code language="none"}}
409 org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
410 org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
411 {{/code}}
412
413 == Parameter count exceeded allowed maximum ==
414
415 If you get an error such as the following it means you reached the limit of parameters you can send in a form.
416
417 {{code language="none"}}
418 java.lang.IllegalStateException: Parameter count exceeded allowed maximum: 512
419 {{/code}}
420
421 You can set the value you want by setting the following in your Tomcat ##server.xml## file:
422
423 {{code language="none"}}
424 <Connector port=... maxParameterCount="10000" ></Connector>
425 {{/code}}
426
427 == ThreadLocal Errors ==
428
429 When you stop XWiki you may see the following type of errors in the Tomcat logs. This is a [[known limitation of XWiki in cleaning up some ThreadLocal variables>>https://jira.xwiki.org/browse/XWIKI-9055]]. To be safe, we recommend that you stop XWiki by stopping Tomcat (i.e. stopping the Tomcat JVM). This ensures that there won't be any memory leak related to these ThreadLocal variables. If you use the Tomcat Manager to stop the XWiki webapp (by undeploying it), then we recommend to not do that and instead to stop Tomcat and restart it.
430
431 {{code language="none"}}
432 SEVERE [Thread-794] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [...] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1125fc78]) and a value of type [...] (value [...]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
433 {{/code}}
434
435 = Old Instructions =
436
437 Note that [[Tomat 7 is no longer supported>>dev:Community.SupportStrategy.ServletContainerSupportStrategy.WebHome]].
438
439 {{error}}
440 The Tomcat project has brought a change in the [[way they handle ##RequestDispatcher##>>https://bz.apache.org/bugzilla/show_bug.cgi?id=59317]] which has caused [[regressions in XWiki>>https://jira.xwiki.org/browse/XWIKI-13556]] for some versions of Tomcat. Thus you should **not** use the following Tomcat versions:
441
442 * >= 9.0.0.M5 and < 9.0.0.M10 for the 9.0.x branch (fixed in 9.0.0.M10)
443 * >= 8.5.1 and < 8.5.5 for the 8.5.x branch (fixed in 8.5.5)
444 * >= 8.0.34 and < 8.0.37 for the 8.0.x branch (fixed in 8.0.37)
445 * >= 7.0.70 and < 7.0.71 for the 7.0.x branch (fixed in 7.0.71)
446
447 There is an important Classloader related bug in 8.0.32 which makes impossible to use the code macro or write Python scripts so you should avoid this version if possible. See https://bz.apache.org/bugzilla/show_bug.cgi?id=58999.
448 {{/error}}
449
450 * XWiki 12.0+ requires a Tomcat version >= 8 since it requires Servlet 3.1+
451 * Older versions of XWiki require a Tomcat version >= 7 since it requires Servlet 3.0+
452 * Tomcat 7 is not using URF-8 by default. Edit the ##conf/server.xml## file to set the UTF-8 encoding:(((
453 {{code language="none"}}
454 <Connector port="8080"
455 ...
456 URIEncoding="UTF-8">
457 </Connector>
458 {{/code}}
459 )))

Get Connected