In this post I describe an end-to-end setup for TomEE+ and my application on a vanilla linux (Debian) server.
This is just one of the many possible configurations. Be advised that changes done to system(s) or configuration(s) might be useful in some cases while in other cases not. Although I have put an effort in explaining why I perform these or those changes, errors and omissions are likely. That’s why I cannot take any responsibility for the loss of data or damage to your systems. Always use your own brain and question stuff you read here at all times.
One more disclaimer – information in this post is mainly credited by other people in numerous publications in internet. I just aggregated, structured and adapted it to my needs. If some of you recognize own material (or that of your friend) please let me know and I will gladly add the credit. I am not doing this right away since this article is a result of days and days of research and I just can’t remember the sources I got this information from.
- 64bit Debian Server
- LAMP (Linux Apache MySql PHP)
1. Install Java JDK 1.7
I am installing oracle jdk and yes it has to be jdk (as in no – jre is NOT sufficient). OpenJDK had some issue (with either TomEE or, more likely, my own web application) I unfortunately cannot remember.
- get Java 1.7 here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
- move Java to the “right” location
- set symlink (so that later java updates get propagated)
- activate java
- open profile file, set JAVA_HOME, save it and exit
- refresh environment
2. Configure apache2
So why do we need apache2 at all? I had two reasons, the reason one being this article on stackoverflow and the sconed reason being apache2 already pre-installed by my server provider as part of LAMP.
- get mod_jk
- change two lines in /etc/libapache2-mod-jk/workers.properties
- create and fill /etc/apache2/conf.d/mod-jk.conf
- create your virtual Host in /etc/apache2/sites-available/ic.remasoft.com
- activate vHost and restart apache2
3. Install TomEE
If at this point you still don’t know what TomEE is please leave a comment explaining why the heck did you read this article up to this point! 🙂 Seriously tho, here’s good starting point.
- get TomEE Plus here: http://tomee.apache.org/downloads.html
- move TomEE to the “right” location
- add tomee user
- create init file for tomee
- add following text to tomee’s init file and save it
- set rights for the init file
- set autostart
4. Configure TomEE
Now TomEE runs out-of-the-box, so this part is required only if you have explicit configuration needs related to your specific application. I have an application that uses MySql and have couple of special needs regarding logging and application deployment.
- configure lib dir of TomEE
- get mysql connector here : http://www.mysql.com/downloads/connector/j/mysql-connector-java-x.x.xx-bin.jar and copy it to tomee’s lib dir
- get log4j-1.2.17.jar and copy it to tomee’s lib dir
- get slf4j-log4j12-1.7.1.jar and copy it tom tomee’s lib dir
- remove slf4j-jdk14-1.7.2.jar from lib dir to avoid slf4j init conflicts
- add log4j config directly in lib folder and add configuration
- remove standard log
- adjust Engine and Host tag in /usr/local/tomee/conf/server.xml to
- replace all Resource tags in /usr/local/tomee/conf/tomee.xml with this
- change welcome-file-list in /usr/local/tomee/conf/web.xml to
- adjust properties in /usr/local/tomee/conf/system.properties
- remove the default ROOT webapp
5. Install iC
- get iC *.war files and move them to TomEEs webapps dir
6. Configure MySql
- create iC database
- add ic tables
- add data
- set tomee as owner of tomee dir
- execute as super user
Finally, call your application (I did it by calling http://ic.remasoft.com).
You have set up a TomEE instance on a linux system, congratulations!