Create a TomEE accessible through SSH with TomEE Maven Plugin

I already blogged about the way to connect to TomEE through SSH.

The idea of this post is to do the same but more easily using the tomee-maven-plugin.

The steps are the following ones:
* add the tomee-maven-plugin
* add openejb-ssh librairies in TomEE lib/ folder
* configure your LoginModule
* add the JAAS system property to specify your LoginModule (

So in your pom you should get something like:

    <systemVariables> <!-- where is our JAAS configuration -->
    <libs> <!-- we need the ssh library -->
    <zip>false</zip> <!-- set true if you want to create a zip and attach it to your build -->

Now you just need the configuration files. We’ll use the place used by default by tomee-maven-plugin: src/main/tomee/conf.

For the demo we’ll simply use the properties LoginModule but you can use whatever you want (think to override the domain property in conf/conf.d/ if you don’t use PropertiesLogin name):

PropertiesLogin { required

This login module needs a and a files we add in src/main/tomee/conf too:

admin = tomee
tomee = tomee

Finally we need to specify the realm in our server.xml:

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.tomee.catalina.ServerListener" />
  <Listener className="" />

  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" />
    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.JAASRealm" appName="PropertiesLogin"
             roleClassNames="" />

      <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true" />

Here we are, now simply run:

mvn tomee:build

And you’ll get in target/apache-tomee a TomEE enriched by a SSH server.

Note: to make it ready to use without tomee-maven-plugin simply add a in src/main/tomee/bin with the something like (use setenv.bat for windows):

if [ -n "${CATALINA_BASE}" ] ; then 
export CATALINA_OPTS="$DIR/conf/login.config $CATALINA_OPTS"

We are now ready to use it. In development you can simply start your TomEE using:

mvn tomee:run

By default the SSH port used is 4222 (use conf/conf.d/ to override it) so simply connect with:

ssh tomee@localhost -p 4222

Enter the password “tomee” and you should see the TomEE SSH console.

Bonus: add in tomee-maven-plugn the library:


And you should be able to deploy application from maven:

tomee @ localhost> deploy mvn:org.superbiz/foo/1.0/war

2 thoughts on “Create a TomEE accessible through SSH with TomEE Maven Plugin


    Hey there. I was considering adding a hyperlink back to
    your website since both of our web sites are based around the same niche.
    Would you prefer I link to you using your site address: http:
    // or website
    title: Create a TomEE accessible through SSH with TomEE Maven Plugin | RManniBucau.
    blog(). Be sure to let me know at your earliest convenience.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s