Tomcat Installation

Installation Steps

  • Download and install Tomcat. It's usually as simple as unzipping it in a directory. Let's call this directory [TOMCAT_HOME].
  • Extract the XWiki WAR into a directory named xwiki/ in [TOMCAT_HOME]/webapps/. The reason you're expanding the WAR is because you'll need to modify one configuration file from inside the WAR later on when you configure the database access.
  • (optional) If you want to modify the port on which Tomcat will run, edit [TOMCAT_HOME]/conf/server.xml. Search for "8080" (sometimes 8180 if you are under Linux) and replace with the port value you wish to use.

Potential Issues

Out Of Memory Error

When you later run XWiki in Tomcat you may get an Out Of Memory error, especially if you're trying to import large files into your wiki. To solve this allocate more memory to the JVM. For Tomcat this can be done by setting the JAVA_OPTS environment property (on Windows to allocate 300MB you would set JAVA_OPTS to -Xmx300m). If you are running Tomcat as service then defining JAVA_OPTS will not help. There is a 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.

Java Security Manager

You need to be careful to turn off the Java Security Manager for the Tomcat JVM. The reason is that by default XWiki tries to write its log file (xwiki.log) in the directory where Tomcat is started. If Tomcat is running in Sandbox mode (Java Security Manager on) then it won't allow this and you'll get an exception. In order to turn off the Java Security Manager, edit the Tomcat startup script.

You might want to check your etc/init.d/tomcat file or etc/default/tomcat5.5. You should see the following in the file:

# Use the Java security manager? (yes/no)
TOMCAT5_SECURITY=

Make sure it is set to no.

Note that we have an issue logged regarding this

Version 1.26 last modified by Sergiu on 12/12/2007 at 12:49

Comments 5

amitjain44 | 17.01.2007 at 11:39 AM
Regarding memory options for Tomcat: If you are running tomcat as service then defining JAVA_OPTS does not help. There is a utility provided in "bin" folder of tomcat installation like for tomcat 5.x version it tomcat5w.exe. It is a GUI tool which can be used to set various options including heap size.

TomOehser | 05.03.2007 at 04:37 AM
You can get it to work with security, just futz with it, adding things like:

80fix.policy:grant codeBase "file:${catalina.home}/webapps/xwiki/WEB-INF/lib/-" { 80fix.policy: permission java.io.FilePermission "/var/log/tomcat55/xwiki.log", "read,write";

And messing with log4j.properties, and cetera...

Silly to say "You need to be careful to turn off the Java Security Manager", when all it takes is a few changes to the Tomcat policy files...

-Tom


VincentMassol | 05.03.2007 at 09:02 AM
Hi Tom,

You're right. Do you think you could provide a complete policy file that works? We can then use it in place of the current less-than-optimal strategy of turning off the security manager.

Thanks -Vincent


DavidTiselius | 17.08.2007 at 01:39 PM
I've got it (xwiki-web-standard-1.1-milestone-3-hsqldb.war) working on Ubuntu 7, tomcat5.5, java 1.6, using HSQLDb by adding the following to a policyfile in /etc/tomcat5.5/policy.d/:

// These permissions apply to xwiki // (thanks Fernando Lozano, // http://mail-archive.objectweb.org/xwiki-users/2007-07/msg00256.html)

grant codeBase "file:${catalina.base}/webapps/xwiki/-" { permission java.io.FilePermission "${catalina.base}/webapps/xwiki/-", "read,write,delete"; permission java.io.FilePermission "/var/log/tomcat5.5/-", "read,write"; permission java.io.FilePermission "/WEB-INF/xwiki.cfg", "read"; permission java.io.FilePermission "/WEB-INF/hibernate.cfg.xml", "read"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; permission java.util.PropertyPermission "user.name", "read"; };

and putting the full path to the database in hibernate.cfg.xml: … jdbc:hsqldb:file:/var/lib/tomcat5.5/webapps/xwiki/WEB-INF/database/xwiki_db;shutdown=true ...

and by putting a log4j.properties in WEB-INF/classes/ (as pointed out here: http://www.xwiki.org/xwiki/bin/view/AdminGuide/Logging) with a RollingFileAppender with the property log4j.appender.file.File also using a complete path (/var/log/tomcat5.5/xwiki.log)

If you want to use MySQL (on localhost) you also should add the line permission java.net.SocketPermission "127.0.0.1:3306", "connect,resolve"; to the policy file. I haven't tried this yet though.


AllenYan | 02.09.2007 at 04:03 PM
I got a problem. I installed the war to my tomcat,then I open the xwiki: http://localhost:8080/xwiki/bin/view/Main/ Everything seems OK! But when the page opened,I just saw some eorro,the string on the page was just some ????????? ?????

The source file of the page is: …

??

???????.

??? ?????? ???.
… I am from China.The default language for my OS is :zh-cn?

Is this because the local issue? How to fix it?thanks@!

Attachments 0

No attachments for this document

Creator: vmassol on 2006/12/11 20:49
This wiki is licensed under a Creative Commons license
1.3.2.9174