TomEE HSQLDB in memory Datasource

Just add the following to your _tomee_/conf/tomee.xml file to get a hsqldb datasource with an in memory datasource which you can use as jta-datasource named exampleDS:

<Resource id=”exampleDS” type=”DataSource”>
JdbcDriver org.hsqldb.jdbcDriver
JdbcUrl jdbc:hsqldb:mem:exampledb;DB_CLOSE_DELAY=-1;
UserName sa
JtaManaged true

TomEE Logging Configuration

Because TomEE comes with a java.util.Logging Logger which I really dislike, I decided to change the logger to log4j through slf4j. Here are the steps to achieve this:

  • Create a folder _tomee_/bin/log and place the following libraries in it: jul-to-slf4j-1.7.5.jar, log4j-1.2.17.jar, slf4j-api-1.7.5.jar, slf4j-log4j12-1.7.5.jar
  • Remove slf4j-*jdk*.jar and slf4j-*api*.jar from _tomee_/lib
  • Create a file in _tomee_/bin/log/config
  • Create a file named in _tomee_/bin and place the following code in it:


  • Replace the content of _tomee_/conf/ with the following

handlers = org.slf4j.bridge.SLF4JBridgeHandler

  • Now you can run TomEE from shell with log4j logger. But you can’t start it from eclipse anymore.
  • To get it working in eclipse add the 4 jars and the config folder to the server classpath (External Jars / Advanced => External Folder)
  • Eclipse ignores the file of TomEE so you have to add the following to VM arguments of the server: