OpenCMS 9.0 with TomEE 1.6 Web Profile#

OpenCms Home | General OpenCms Wiki | OpenCMS Development | OpenCms 9.0.1 Upgrade | OpenCms 10.0.1 Upgrade


  • My task was to create a website where the content can be edited by non-technical authors. Therefore I searched for a content management system (CMS). The most public ones like Wordpress, Joomla and Typo3 are certainly a good choice, but I prefer Java (and a JavaEE stack) over PHP. Additionally I have some other WebApps which I wanted to integrate in the same web server. My choice was OpenCMS due to good reputations and nice looking reference sites.
  • Though I may do in future I don't wanted to dive into development (templates), but wanted to create a website quickly. So my first approach, which I describe here, is a quick and dirty solution!
  • MySQL is up and running (apt-get install mysql-server)


  • Login: http://localhost:8080/opencms/opencms/system/login/
  • Site: http://localhost:8080/opencms/opencms/<sitename> (/sites/default/ will be omitted !!!)
  • Workplace: http://localhost:8080/opencms/opencms/system/workplace/views/workplace.jsp

See also general infos about TomEE.

1. Update Java JDK#

Option 1 (Ubuntu 10): Install via package manager - DID NOT WORK FOR ME, see Option 2! (this is just as reference)
  • Show installed Java packages
> update-java-alternatives -l
  • Check 32 or 64bit System?
> uname -m 
==> output example: x86_64
  • Additionally you may want to check linux Version
> uname -a 
==> output example: Linux euve2798 2.6.18-028stab107.2 #1 SMP Mon Jul 1 21:48:35 MSD 2013 x86_64 GNU/Linux (Ubuntu 10.04 minimal )
  • Delete old Version 6
> apt-get purge openjdk-6-*
  • Add special repository source
> add-apt-repository ppa:openjdk/ppa
  • Update package cache
> apt-get update
  • Check new package is in list
> apt-cache search openjdk-7*
  • Install
> apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib
=> Results in problem with dependencies, which I could not solve (?)

Option 2: Install manually

  • Download JDK
  • Configure (example for jdk-7u45-linux-x64.tar.gz):
> tar -xzvf jdk-7u45-linux-x64.tar.gz
> mkdir /usr/java
> cp -r jdk1.7.0_45 /usr/java
> ln -s /usr/java/jdk1.7.0_45 /usr/java/jdkx
> ln -s /usr/java/jdkx /usr/java/latest
> ln -s /usr/java/latest /usr/java/default
> ln -s /usr/java/default/bin/java /usr/bin/java
> ln -s /usr/java/default/bin/javac /usr/bin/javac
> ln -s /usr/java/default/bin/javah /usr/bin/javah
> ln -s /usr/java/default/bin/javadoc /usr/bin/javadoc
> ln -s /usr/java/default/bin/javaws /usr/bin/javaws
  • Set java home
JAVA_HOME=/usr/java/jdk1.7.0_45;export JAVA_HOME
  • Reboot necessary !

/markus/tomee/bin/ line 392: /usr/java/jdk1.7.0_45/bin/java: No such file or directory

Option 3 with Ubuntu 12.04

apt-get install openjdk-7-jre-headless
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64;export JAVA_HOME
  • Check
java -version
==> output example
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

2. Install TomEE#

> wget
> gunzip
> tar xvf *

3. Configure TomEE#

  • Edit port in <tomee_home>/conf/server.xml
<Connector port="80" protocol="HTTP/1.1"
               redirectPort="8443" />
  • Edit <tomee_home>/conf/tomcat-users.xml to enable services
  <role rolename="tomcat"/>
  <role rolename="admin-gui"/>
  <role rolename="admin-script"/>  
  <role rolename="manager-gui"/>
  <role rolename="manager-status"/>
  <role rolename="tomee-admin"/> 
  <user username="youruser" password="your_long_password" 
  • Edit <tomee_home>/webapps/manager/WEB-INF/web.xml to enable deployment of large war files (like OpenCMS). Otherwise you get this error:
the request was rejected because its size (119990388) exceeds the configured maximum (52428800)
Default is 52428800 = 50 MB * 1024 * 1024.
Change to 125829120 = 120 MB:
  <!-- 120MB max -->

4a. Prepare OpenCMS#

See OpenCms installation
> wget
> unzip
  • Enhance TomEE JAVA settings
Message="-Djava.awt.headless=true JVM parameter or X-Server may be missing. Please note: On Linux systems, Tomcat's JVM has to be started with the command line argument -Djava.awt.headless=true." (compare Oracle Java options

Hint: Check memory usage under Tomcat Startpage > Server Status > JVM

==> example output:
Free memory: 138.30 MB Total memory: 912.75 MB Max memory: 1776.00 MB

Edit bin/
You may either extend JAVA_OPTS or CATALINA_OPTS.
Here are some example settings

JAVA_OPTS="$JAVA_OPTS -server -Xms1024m -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true -Dfile.encoding=UTF-8"

JAVA_OPTS="$JAVA_OPTS -server -Xms1536m -Xmx1536m -XX:MaxPermSize=256m -Djava.awt.headless=true -Dfile.encoding=UTF-8"

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m -Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"

export JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m"

CATALINA_OPTS="-server -Xss1G -Xms2G -Xmx2G -XX:NewSize=1G -Xincgc $CATALINA_OPTS"
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

JAVA_OPTS=”-Xms128m -Xmx256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000?

-Xmx2048M -Xmx6144M -XX:PermSize=128m -XX:MaxPermSize=256m
  • Enhance MySql
Important: You will have to increase the MySQL configuration variable max_allowed_packet located in the MySQL configuration file (usually called my.ini).
For OpenCms, the limit should be as high as possible, a setting of max_allowed_packet=32M is recommended.
Edit /etc/mysql/my.cnf
In Windows edit one of those
C:\Users\All Users\MySQL\MySQL Server 5.6\my.ini
<mysql_home>\MySQL Server 5.6\my.ini

4b Fix logging problem in OpenCMS#

When you deploy OpenCMS like in Step 5 you get this error (see logs/catalina.out):
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/opencms]] in state [STARTING_PREP]
	at org.apache.catalina.util.LifecycleBase.invalidTransition(
SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/opencms]
org.apache.openejb.OpenEJBException: Creating application failed: /markus/tomee/webapps/opencms: org/apache/log4j/Priority
    at org.apache.openejb.assembler.classic.Assembler.createApplication(
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
    at org.apache.openjpa.lib.log.Log4JLogFactory.newLogAdapter(
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
So somehow log4j is needed for deployment (and later for setup also)
So add log4j to <tomee_home>\lib

5. Start TomEE#

  • Add JAVA_HOME to <tomee_home>/bin/
# Markus set javapath
# old: JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk;export JAVA_HOME
JAVA_HOME=/usr/java/jdk1.7.0_45;export JAVA_HOME
Start/Stop with
Hint: Install a mail server also, see Postfix Installation

6. Deploy OpenCMS#

  • Deploy war file with TomEE App Manager (
Context Path= /opencms
War= /markus/opencms/opencms.war

7. Fix OpenCMS setup error#

27:	Shutdown completed, total uptime was 00:04:42.
26:	Shutting down OpenCms, version 9.0.0 in web application "opencms"
23:		at
22:		at org.opencms.setup.CmsSetupWorkplaceImportThread.kill(
21:		at org.opencms.main.CmsShell.exit(
20:	java.lang.NullPointerException
19:		at
18:		at org.opencms.main.CmsShell.start(
17:		at org.opencms.main.CmsShell.executeCommands(
16:		at org.opencms.main.CmsShell.executeCommand(
15:	${user}@${project}>java.lang.NullPointerException
14:	${user}@${project}># Turn echo on
13:		at
12:		at org.opencms.main.CmsShell.<init>(
11:		at org.opencms.main.OpenCmsCore.upgradeRunlevel(
10:		at org.opencms.main.OpenCmsCore.initConfiguration(
9:		at org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(
8:		at org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(
7:		at org.opencms.configuration.CmsWorkplaceConfiguration.addXmlDigesterRules(
6:		at org.apache.commons.digester.Digester.addRule(
5:		at org.opencms.configuration.CmsSetNextRule.setDigester(
4:	java.lang.LinkageError: loader constraint violation: when resolving 
method "org.apache.commons.digester.Digester.setLogger(Lorg/apache/commons/logging/Log;)V" 
the class loader (instance of org/apache/tomee/catalina/LazyStopWebappClassLoader) of the current class, 
org/opencms/configuration/CmsSetNextRule, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/apache/commons/digester/Digester, have different Class objects for the type ns/logging/Log;)V used in the signature
2:	OpenCms property file: "/markus/tomee/tomee_wp16/webapps/opencms/WEB-INF/config/".
1:	OpenCms WEB-INF path:  "/markus/tomee/tomee_wp16/webapps/opencms/WEB-INF/". 
  • Delete commons-logging-1.1.1.jar from webapps/opencms/WEB-INF/lib
  • Optional: replace commons-logging-1.1.1.jar with commons-logging-1.1.3.jar in <tomee_home>\lib folder

Hint: If you need to run OpenCMS setup again (see below)then change /webapps/opencms/WEB-INF/config/


8. Setup OpenCMS#

NOTE: Check capter 10 if you have an instance already!!!
Enter the URL of your Alkacon OpenCms sitehttp://your-domain.deThe OpenCms site URL: Alkacon OpenCms is capable of managing multiple sites. However, the OpenCms Workplace must always be accessed through one specific URL. The site URL you enter here will be used both as URL to access the Workplace, and as URL for the default site. In case you want to add other sites, or if you want to use different URLs for default site and Workplace, you must manually edit the opencms-system.xml file after the installation.
Enter a name for your Alkacon OpenCms serverOpenCmsServerThis server name will be used for various log messages in OpenCms. This can be handy if you have to compare logfiles from a couple of different servers.

Finally: http://<>/opencms/opencms

9. OpenCMS Security#

Change the Admin user password
  • Login http://<>/opencms/opencms/system/login
  • Maybe reload of page is necessary (Strg+R or F5)
  • Menu > Workplace > View=Administration > Account Management > User Management

10. Optional: Install a second instance of OpenCMS #

You can use that one as reference and play around in the first one.
  • Deploy it again in another context, but with adjusting Otherwise you overide the database of your first instance! In this example we use "OpenCMSOrig" instead of "OpenCMS".
  • Deploy WAR file again (compare previous steps)
Context Path (required): /opencmsOrig
WAR or Directory URL: D:\lang\cms\opencms-9.0.0\opencms.war
  • Shutdown tomee
  • Delete again webapps\opencmsOrig\WEB-INF\lib\commons-logging-1.1.1.jar
  • Edit webapps\opencmsOrig\WEB-INF\config\
# the URL to make the JDBC DriverManager return connections from the DBCP pool



  • Restart tomee
  • Setup again
  • Choose databasename = openCmsOrig

11. Adjust Workplace settings#

Change admin language and list options
Menu > Workplace > Preferences > Workplace Tab > Language
Menu > Workplace > Preferences > Explorer Tab > Dateien pro Seite = Unbegrenzt

12. Switch start page for the web server#

Change/replace <tomee_home>/webapps/ROOT/index.html


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">
  <meta http-equiv="Refresh" content="0;URL=/opencms/<site>" />
  <h3>Einen Augenblick bitte ...</h3>
  <h3>One moment please ...</h3>

13 Own icon at the Url (Favicon)#

You can upload an icon under Workplace: Verwaltungsansicht > Webseiten Verwaltung > "F" column.
This will put the uploaded image under the site root as image file with the name favicon.ico.


  • Firefox and Chrome do not show any favicons anymore next to the URL, but in the tab only !
  • IE and Safari do show it next to URL and tab !

?: just place the favicon.ico file in the top level folder in your war file

? Add the following code in the <head> to your index.html in you webapp/projectName/

<link rel="shortcut icon" href="" type="image/x-icon" />
<link rel="icon" href="" type="image/x-icon">

? There are several websites (use google) that generate .ico files from pictures (gif / jpeg etc)

<link rel="icon" type="image/gif" href="/img/image.gif">

14. Change locale from en to de (switch language)#

Note: Testing mode !

Changing languages, edit <opencms>/WEB-INF/config/opencms-system.xml


  <localehandler class="org.opencms.i18n.CmsDefaultLocaleHandler"/>

Adding language:


To set another default language, put it to the top under <localesdefault>

Do not remove "en" in <localesconfigured> and <localesdefault> !

Copy content
Workplace > View=Administration > Content Werkzeuge > Sprachknoten kopieren
Ressource= /ebel/yoursite
Lösche den Quellsprachknoten = X
Qelle = Englisch
Ziel = Deutsch

Switch site locale\ Right-Click Subsitemap Folder > Properties > All properties Tab
locale = de
=> Publish

15. Skinndriva#

How to integrate and use skinndriva for OpenCms

Note: -- Incomplete and not tested ---

  • Read nice presentation at slideshare
  • Download SkinnDriva
  • Unzip and get three zip files:
Import these three modules
  • Workplace > View=Administration > Modul Verwaltung > Modul per HTTP importieren
  • Choose zip file from disk > OK
  • Check in View=Explorer > Path/system/modules for a/m packages

16. Removing "/opencms/opencms" prefix#

The general solutions is to use a url rewrite library, that redirect you internally to the right url. There is one for Apache (httpd), but you can use UrlReqriteFilter with Tomcat alone, see here.

Generally the URL looks like


To remove the servlet part (opencms/) inside, you can do the following:
a. Download urlrewritefilter-4.0.3.jar and put it into <tomcat>\lib
b. Add to <opencms>/WEB-INF/web.xml:


Note: "REQUEST" is used for general url requests, "FORWARD" is used when a rule was processed (outcome) or when a page is reloaded (Ctrl+R or F5).
c) Edit <opencms>\WEB-INF\config\opencms-importexport.xml and remove /opencms (/$SERVLET_NAME}) in vfs-prefix
  <!--OLD: <vfs-prefix>${CONTEXT_NAME}/${SERVLET_NAME}</vfs-prefix>-->

d) Create <opencms>\WEB-INF\urlrewrite.xml and add rule to add /opencms internally again (see UrlRewriteUrl Docu)

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-// UrlRewrite 4.0//EN"
    Configuration file for UrlRewriteFilter

    <name>Add "opencms/" internally again</name>
    <condition type="request-uri" operator="notequal">^/opencmsPlay/export/.*$</condition>
    <condition type="request-uri" operator="notequal">^/opencmsPlay/resources/.*$</condition>
    <condition type="request-uri" operator="notequal">^/opencmsPlay/opencms-errorhandler/.*$</condition>
    <condition type="request-uri" operator="notequal">^/opencmsPlay/webdav/.*$</condition>
    <condition type="request-uri" operator="notequal">^/opencmsPlay/opencms/.*$</condition>
    <to last="true" type="forward">/opencms/$1</to>
Note 1: <from> and <to> exclude the context
Note 2: each part separated with slash in <from> can be used as parameter $1, $2 in <to> ...

e) Optional: For debugging you can add several additional parameters to <opencms>\WEB-INF\web.xml inside the <filter> tag

    <!-- set the amount of seconds the conf file will be checked for reload
	can be a valid integer (0 denotes check every time, -1 denotes no reload check, default -1) -->
    <!-- sets up log level (will be logged to context log)
	can be: slf4j, TRACE, DEBUG, INFO (default), WARN, ERROR, FATAL,
	sysout:{level} (ie, sysout:DEBUG)
	if you are having trouble using normal levels use sysout:DEBUG
	(default WARN) -->

Note 1: To remove also the context you may install opencms under the ROOT context of the web server.
Note 2: To use multiple sites with different webnames you can also use UrlRedirectFilter to forward/redirect to the proper site in your opencms setup.

17. Bootstrap Demo Color Theme#

There is a variable "" set in

<c:set var="colortheme"><cms:property name="" file="search" default="blue" /></c:set>
<c:set var="pagelayout"><cms:property name="" file="search" default="9" /></c:set>
<link rel="stylesheet" href="<cms:link>/system/modules/com.alkacon.bootstrap.formatters/resources/css/themes/${colortheme}.css</cms:link>">
<link rel="stylesheet" href="<cms:link>/system/modules/com.alkacon.bootstrap.formatters/resources/css/themes/headers/header1-${colortheme}.css</cms:link>">
<link rel="stylesheet" href="<cms:link>%(link.weak:/system/modules/com.alkacon.bootstrap.formatters/resources/css/page.css:52f716c6-20f8-11e3-b4d8-000c297c001d)</cms:link>">
This refers to
- headers
- blue.css
- default.css
- light.css
- orange.css
- red.css

18. org.opencms.file.CmsVfsResourceNotFoundException#

When you have selected site = "/" (root) then you get this error. Select your real site. Then you do not get this error anymore. I prefer navigating in the root folder, then I use a two browsers (Firefox + Chrome). One for the workplace and the other for viewing and editing directly.

19. Edit tips#

  • Do NOT delete any content from the system folder!

20. Reset password#


Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-) was last changed on 29-Sep-2018 19:57 by Administrator