Install Apache TomEE 8 on CentOS 7 - CentLinux


Tuesday, 5 March 2019

Install Apache TomEE 8 on CentOS 7

Install Apache TomEE 8 on CentOS 7

Apache TomEE (pronounced “Tommy”) is the Java Enterprise Edition of Apache Tomcat. Apache TomEE combines several Java enterprise projects including Apache OpenEJB, Apache OpenWebBeans, Apache OpenJPA, Apache MyFaces, etc. In comparison with Apache Tomcat, Apache TomEE is loaded with more technology support. According to Wikipedia, TomEE = Tomcat + JavaEE.

In this article, we will install Apache TomEE 8 on CentOS 7 server and configure Application Manager.


Table of Contents:


System Specification:

We have provision a CentOS 7 virtual machine with following specifications.

  • Hostname -
  • IP Address -
  • Operating System - CentOS 7.6
  • Apache TomEE - 8


Installing OpenJDK 8 on CentOS 7:

Apache TomEE requires Java 8 (or above) runtime environment. Therefore, we are installing OpenJDK 8 on our CentOS 7 server.

[root@tomee-01 ~]# yum install -y java-1.8.0-openjdk-devel ... Installed: java-1.8.0-openjdk-devel.x86_64 1: Dependency Installed: copy-jdk-configs.noarch 0:3.3-10.el7_5 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 giflib.x86_64 0:4.1.6-9.el7 java-1.8.0-openjdk.x86_64 1: java-1.8.0-openjdk-headless.x86_64 1: javapackages-tools.noarch 0:3.4.1-11.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.5-2.el7 libX11-common.noarch 0:1.6.5-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXcomposite.x86_64 0:0.4.4-4.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXi.x86_64 0:1.7.9-1.el7 libXrender.x86_64 0:0.9.10-1.el7 libXtst.x86_64 0:1.2.3-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libjpeg-turbo.x86_64 0:1.2.90-6.el7 libxcb.x86_64 0:1.13-1.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 python-javapackages.noarch 0:3.4.1-11.el7 python-lxml.x86_64 0:3.2.1-4.el7 ttmkfdir.x86_64 0:3.0.9-42.el7 tzdata-java.noarch 0:2018i-1.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7 xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 Complete!

Java executables have been automatically added to PATH environment variable. Therefore, we are only required to set the JAVA_HOME environment variable.

[root@tomee-01 ~]# echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-" >> /etc/profile [root@tomee-01 ~]# . /etc/profile [root@tomee-01 ~]# env | grep JAVA_HOME JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-

Verify Java version.

[root@tomee-01 ~]# java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

OpenJDK 8 has been installed on our CentOS 7 server.


Installing Apache TomEE 8 on CentOS 7:

Create a user to own Apache TomEE software.

[root@tomee-01 ~]# useradd -s /sbin/nologin tomcat

Go to Apache TomEE website to download it.

There are many distributions of Apache TomEE are available. Download your required Apache TomEE distribution from this page.

We are downloading Apache TomEE webprofile. But the installation steps are exactly same for other distributions like Apache TomEE plus, Apache TomEE plume, etc.

Note: There is a good comparison of Apache TomEE distributions is available on their website, that will help you selection of your required Apache TomEE distribution.

[root@tomee-01 ~]# wget --2019-03-04 23:00:23-- Resolving (, 2a01:4f9:2a:185f::2 Connecting to (||:443... connected. HTTP request sent, awaiting response... 200 OK Length: 41727556 (40M) [application/x-gzip] Saving to: âapache-tomee-8.0.0-M2-webprofile.tar.gzâ 100%[======================================>] 41,727,556 234KB/s in 3m 0s 2019-03-04 23:03:23 (226 KB/s) - âapache-tomee-8.0.0-M2-webprofile.tar.gzâ saved [41727556/41727556]

Extract downloaded file.

[root@tomee-01 ~]# tar xvf apache-tomee-8.0.0-M2-webprofile.tar.gz ... apache-tomee-webprofile-8.0.0-M2/bin/startup.bat apache-tomee-webprofile-8.0.0-M2/bin/ apache-tomee-webprofile-8.0.0-M2/bin/tomcat-juli.jar apache-tomee-webprofile-8.0.0-M2/bin/tomcat-native.tar.gz apache-tomee-webprofile-8.0.0-M2/bin/tool-wrapper.bat apache-tomee-webprofile-8.0.0-M2/bin/ apache-tomee-webprofile-8.0.0-M2/bin/version.bat apache-tomee-webprofile-8.0.0-M2/bin/

Move extracted directory to /opt/tomee/.

[root@tomee-01 ~]# mkdir /opt/tomee [root@tomee-01 ~]# mv apache-tomee-webprofile-8.0.0-M2/ /opt/tomee/

Change ownership of /opt/tomee directory.

[root@tomee-01 ~]# chown -R tomcat:tomcat /opt/tomee/

We will create a soft link latest for /opt/tomee/apache-tomee-webprofile-8.0.0-M2 directory. So, we can upgrade/downgrade Apache TomEE conveniently.

[root@tomee-01 ~]# ln -s /opt/tomee/apache-tomee-webprofile-8.0.0-M2 /opt/tomee/latest

Create a systemd unit file to define a service for Apache TomEE 8 server.

[root@tomee-01 ~]# vi /usr/lib/systemd/system/tomee.service

and add following lines therein.

[Unit] Description=TomEE 8 servlet container [Service] Type=forking User=tomcat Group=tomcat Environment="JAVA_HOME=/usr/lib/jvm/jre" Environment="" Environment="CATALINA_BASE=/opt/tomee/latest" Environment="CATALINA_HOME=/opt/tomee/latest" Environment="CATALINA_PID=/opt/tomee/latest/temp/" Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" ExecStart=/opt/tomee/latest/bin/ ExecStop=/opt/tomee/latest/bin/ [Install]

Execute following command to notify systemd that we have created a new unit file.

[root@tomee-01 ~]# systemctl daemon-reload

Start and enable Apache TomEE service.

[root@tomee-01 ~]# systemctl enable tomee.service Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/tomee.service. [root@tomee-01 ~]# systemctl start tomee.service

Allow Apache TomEE service port in Linux firewall.

[root@tomee-01 ~]# firewall-cmd --permanent --add-port=8080/tcp success [root@tomee-01 ~]# firewall-cmd --reload success

Browse URL in a client's browser.

Apache TomEE Homepage

Apache TomEE 8 has been installed on CentOS 7.


Configure Apache TomEE Application Manager on CentOS 7:

Application Manager provides Web UI to easily manage, deploy, start and stop Java applications running on Apache TomEE 8 server. It is installed with Apache TomEE but requires some necessary settings prior to use.

Define users and roles to access Apache TomEE 8 Manager Web UI.

[root@tomee-01 ~]# vi /opt/tomee/latest/conf/tomcat-users.xml

Add following lines just before </tomcat-usersgt; tag.

<role rolename="admin-gui"/> <role rolename="manager-gui"/> <user username="admin" password="admin" roles="admin-gui,manager-gui"/> <user username="ahmer" password="123" roles="admin-gui,manager-gui"/>

By default Application Manager is allowed to be accessed from localhost only.

We must edit the following files to let us access it from other machines.

[root@tomee-01 ~]# vi /opt/tomee/latest/webapps/manager/META-INF/context.xml

Find following lines of code and add the IP address of the client system, that you are using for Apache TomEE administration.

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

Our client's IP address is Therefore, after adding it in the above file, the final code is looks like following.

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|" />

Similarly, repeat the above step for following file.

[root@tomee-01 ~]# vi /opt/tomee/latest/webapps/host-manager/META-INF/context.xml

Restart Apache TomEE 8 service to apply changes.

[root@tomee-01 ~]# systemctl restart tomee.service

Browse URL using a client's browser.

Apache TomEE Homepage

Click on Server Status.

Apache TomEE Server Status

Go back and click on Manager App.

Apache TomEE Application Manager

Go back and click on Host Manager.

Apache TomEE Virtual Host Manager

Application Manager has been configured on Apache TomEE 8 running on CentOS 7 server.


  1. this message was given when i tried to start the service.
    Job for tomee.service failed because the control process exited with error code.
    See "systemctl status tomee.service" and "journalctl -xe" for details.

    1. Hi, this is a generic error. You have to look into error logs (as advised in the error message) to find the cause of this error.

  2. tomee.service: Failed to execute command: Permission denied

    1. It is a generic error. You may find the actual cause of the problem in system/service logs.