| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> |
| <meta charset="utf-8"> |
| <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"> |
| <meta content="Asciidoctor 0.1.4" name="generator"> |
| <meta content="RefCard" name="description"> |
| <meta content="refcard" name="keywords"> |
| <title>Apache TomEE Reference Card</title> |
| <link href="css/style.css" rel="stylesheet"> |
| <link href="css/github.min.css" rel="stylesheet"> |
| <link href="css/refcard.css" media="print, screen" rel="stylesheet" type="text/css"> |
| <script src="js/jquery.min.js"></script> |
| <script src="js/modernizr.custom.2.6.2.js"></script> |
| <script src="js/highlight.min.js"></script> |
| <script src="js/refcard.js"></script> |
| </head> |
| <body class="article"> |
| <header> |
| <div class="mid"> |
| <img id="logo" src="images/tomee.png"> |
| <h1> |
| TomEE RefCard |
| </h1> |
| </div> |
| </header> |
| <div class="main"> |
| <div class="mid"> |
| <div class="page" id="page"> |
| <div id="preamble"> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p><strong>Apache TomEE is a JavaEE 6 application server.</strong></p> |
| </div> |
| <div class="paragraph"> |
| <p>This RefCard tries to sum up basic things to know.</p> |
| </div> |
| <div class="horizontal-block" id="Overview"> |
| <div class="col c2-1 c3-1 c4-1 c5-1 c6-1"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE Philosophy</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>Apache TomEE, pronounced "Tommy", is an all-Apache Java EE 6 Web Profile |
| certified stack where Tomcat is top dog. Apache TomEE is assembled from |
| a vanilla Apache Tomcat zip file. We start with Tomcat, add our jars and zip |
| up the rest. The result is Tomcat with added EE features - TomEE.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Its core values are:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>Be Tomcat</p> |
| </li> |
| <li> |
| <p>Be certified</p> |
| </li> |
| <li> |
| <p>Be small</p> |
| </li> |
| </ul> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE Links</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="ulist"> |
| <ul> |
| <li> |
| <p>TomEE Website: <a href="http://tomee.apache.org">http://tomee.apache.org</a></p> |
| </li> |
| <li> |
| <p>TomEE Examples: <a href="http://tomee.apache.org/examples-trunk/index.html">http://tomee.apache.org/examples-trunk/index.html</a></p> |
| </li> |
| </ul> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-2 c4-2 c5-2 c6-2"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE ClassLoading</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code>bootstrap ($JAVA_HOME/jre/lib/ext) |
| | |
| system (bin/boostrap.jar:bin/tomcat-juli.jar) |
| | |
| common (lib/*.jar) |
| / \ |
| webapp1 webapp2</code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>Classloading configuration (properties):</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><code>openejb.classloader.forced-load=<comma separated list of class name prefixes></code>: classes to load from the webapp first |
| whatever is in the container</p> |
| </li> |
| <li> |
| <p><code>openejb.classloader.forced-skip=<idem></code>: classes to load from the container |
| whatever is in the application</p> |
| </li> |
| </ul> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-1 c3-3 c4-3 c5-3 c6-3"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 50%"> |
| <col style="width: 50%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top" colspan="2">TomEE Basic Operation</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">Start and wait Ctrl+C</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>./bin/catalina.sh run</code></p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">Start and forget</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>./bin/catalina.sh start</code></p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">Stop</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>./bin/catalina.sh stop</code></p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">Deploy manually a webapp</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>copy war over webapps/</code></p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">Redeploy manually a webapp</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>delete exploded war then deploy</code></p></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE Distributions</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="ulist"> |
| <ul> |
| <li> |
| <p>TomEE Web Profile: JavaEE 6 Web profile sever (certified)</p> |
| </li> |
| <li> |
| <p>TomEE JAX-RS: previous one + JAX-RS (certified)</p> |
| </li> |
| <li> |
| <p>TomEE+: previous one + JAXWS + JMS + Connectors</p> |
| </li> |
| </ul> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-1 c4-4 c5-4 c6-4"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 33%"> |
| <col style="width: 66%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top" colspan="2">TomEE Directory Layout</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>bin</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">contains script to manage (start/stop/…) TomEE</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>conf</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">server global configuration</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>endorsed</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">override JVM API because too old for JavaEE</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>lib</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">server libraries</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>logs</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">logs directory (using default configuration)</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>temp</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">default tmp directory</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>webapps</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">default folder which aims to contain webapps</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><code>work</code></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">folder used by Tomcat to store "work" binaries (compiled jsp…)</p></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| </div> |
| <div class="horizontal-block" id="Configuration"> |
| <div class="col c2-1 c3-1 c4-1 c5-1 c6-1"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Scanning/Loader configuration, conf/catalina.properties</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="ini"># the main server classloader configuration, |
| # JDBC drivers go here in general |
| common.loader=${catalina.base}/lib,\ |
| ${catalina.base}/lib/*.jar,\ |
| ${catalina.home}/lib,${catalina.home}/lib/*.jar |
| |
| # other defaults are generally fine</code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE system properties, conf/system.properties</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="ini"># handle global configuration |
| # this file is an alternative |
| # to JVM system properties -Dxxxx=yyyy |
| |
| # check libraries |
| openejb.check.classloader = false |
| |
| # deploy internal application |
| # only relevant in dev |
| openejb.system.apps = true |
| |
| # deactivate JMX |
| openejb.jmx.active = false |
| |
| # where to find the TomEE config file |
| openejb.conf.file = conf/tomee.xml |
| |
| # force inclusion/exclusion of packages during classloading |
| openejb.classloader.forced-load = my.pack1,my.pack2 |
| openejb.classloader.forced-skip = my.pack3,my.pack4 |
| |
| # app ones |
| my.system.property.config = my value |
| |
| # more on http://tomee.apache.org/properties-listing.html</code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Logging configuration, conf/logging.properties</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="ini"># available handlers for logging: console, file... |
| handlers = 5tomee.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler |
| |
| # file handler configuration |
| # 3 main items: level of the handler, where to log, with wich prefix |
| 5tomee.org.apache.juli.FileHandler.level = FINEST |
| 5tomee.org.apache.juli.FileHandler.directory = ${catalina.base}/logs |
| 5tomee.org.apache.juli.FileHandler.prefix = tomee. |
| |
| # each category can be configured (ex: OpenEJB) |
| ## level: FINEST > FINE > INFO > WARNING > SEVERE |
| OpenEJB.level = WARNING |
| |
| ## handler |
| OpenEJB.handlers = 5tomee.org.apache.juli.FileHandler,\ |
| java.util.logging.ConsoleHandler |
| |
| # more on tomcat website: |
| # http://tomcat.apache.org/tomcat-7.0-doc/logging.html</code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Daemons configuration, conf/conf.d/*.properties</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>OpenEJB and TomEE rely on daemons for extensibility.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Typically JAXWS and JAXRS uses this feature to be |
| added to the server.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Each daemon can get configuration.</p> |
| </div> |
| <div class="paragraph"> |
| <p>It is configurable through:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>system properties: <code><daemon name.<attribute>=value</code></p> |
| </li> |
| <li> |
| <p>conf/conf.d/<daemon name>.properties</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>All daemons have a property <code>disabled</code> which can be set to true |
| to deactivate it.</p> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-2 c4-2 c5-2 c6-2"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Server configuration, conf/server.xml</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version='1.0' encoding='utf-8'?> |
| <Server port="8005" shutdown="SHUTDOWN"> |
| <!-- TomEE integration with Tomcat --> |
| <Listener className="org.apache.tomee.catalina.ServerListener" /> |
| |
| <Service name="Catalina"> |
| |
| <!-- Connectors are entry points (HTTP, AJP...) --> |
| <Connector port="8080" protocol="HTTP/1.1" /> |
| |
| <Engine name="Catalina" defaultHost="localhost"> |
| <!-- |
| folder webapps will scanned for webapps |
| and webapps will be deployed on localhost |
| --> |
| <Host name="localhost" appBase="webapps" /> |
| </Engine> |
| </Service> |
| </Server></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">JAXWS WS Security configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>It basically relies on openejb-jar.xml (in META-INF or WEB-INF):</p> |
| </div> |
| <div class="paragraph"> |
| <p>A complete example can be found within TomEE examples: <code>webservice-ws-security</code>.</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="UTF-8"?> |
| <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> |
| <ejb-deployment ejb-name="CalculatorImpl"> |
| <properties> |
| # webservice.security.realm |
| # webservice.security.securityRealm |
| # webservice.security.transportGarantee = NONE |
| webservice.security.authMethod = WS-SECURITY |
| |
| wss4j.in.action = UsernameToken |
| wss4j.in.passwordType = PasswordText |
| wss4j.in.passwordCallbackClass = org.superbiz.MyPwdHandler |
| |
| # automatically added |
| wss4j.in.validator |
| .{http://docs.oasis-open.org/wss/2004/01/oasis-200401 |
| -wss-wssecurity-secext-1.0.xsd}UsernameToken = |
| org.apache.openejb.server.cxf.OpenEJBLoginValidator |
| </properties> |
| </ejb-deployment> |
| </openejb-jar></code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p><code>wss4j.out.*</code> properties exist too.</p> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Scanning configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>Scanning is used to find EE classes (EJB, CDI beans…).</p> |
| </div> |
| <div class="paragraph"> |
| <p>It is common to not scan <em>utility libraries</em> like commons-lang for instance.</p> |
| </div> |
| <div class="paragraph"> |
| <p>TomEE/OpenEJB support two main configurations regarding the scanning:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><code>exclusions.list</code>: can be in WEB-INF or in <code><tomee>/conf/</code>: each line is a jar prefix |
| which will not be included in the scanning. Defaults are in <code>openejb-core/!default.exclusions</code>. |
| If you want to simply add your own exclusion you can use <code>default-list</code> which means the whole content of the default file.</p> |
| </li> |
| <li> |
| <p><code>scan.xml</code>: in META-INF or WEB-INF it lists the classes/packages to scan. here is a sample:</p> |
| </li> |
| </ul> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0"?> |
| <scan> |
| <packages> |
| <package>org.foo1</package> |
| <package>org.foo2</package> |
| </packages> |
| <classes> |
| <class>org.bar.Bar1</class> |
| <class>org.anotherbar.Bar2</class> |
| </classes> |
| </scan></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-1 c3-3 c4-3 c5-3 c6-3"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE application configuration, WEB-INF/resources.xml</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="utf-8"?> |
| <resources> |
| <!-- |
| mainly a tomee.xml embed in the application |
| (META-INF or WEB-INF) |
| --> |
| <Resource id="name" type="DataSource"> |
| JdbcUrl = jdbc:hsqldb:mem:my-ds |
| </Resource> |
| </resources></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">JAXRS configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>It basically relies on openejb-jar.xml (in META-INF or WEB-INF):</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="UTF-8"?> |
| <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> |
| <!-- |
| class-name has to be the JAXRS application name |
| or this one if no Application is defined |
| --> |
| <pojo-deployment class-name="jaxrs-application"> |
| <properties> |
| cxf.jaxrs.providers = org.foo.BarProvider, id1 |
| </properties> |
| </pojo-deployment> |
| </openejb-jar></code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>Values are either a class which will be instantiated (through <code>new</code>) |
| or an id which will match a <code>Service</code> in a <code>resources.xml</code> file:</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="utf-8"?> |
| <resources> |
| <Service id="json" class-name="org.foo.bar"> |
| Attribute1 = Value1 |
| Attribute2 = Value2 |
| </Resource> |
| </resources></code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>Here is the full list of available properties configurable in <code>openejb-jar.xml</code> |
| with the prefix <code>cxf.jaxrs</code>:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>properties</p> |
| </li> |
| <li> |
| <p>features</p> |
| </li> |
| <li> |
| <p>in-interceptors</p> |
| </li> |
| <li> |
| <p>out-interceptors</p> |
| </li> |
| <li> |
| <p>in-fault-interceptors</p> |
| </li> |
| <li> |
| <p>out-fault-interceptors</p> |
| </li> |
| <li> |
| <p>databinding</p> |
| </li> |
| <li> |
| <p>providers</p> |
| </li> |
| </ul> |
| </div> |
| <div class="admonitionblock note"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <div class="title">Note</div> |
| </td> |
| <td class="content"> |
| excepted providers configuration all these configuration are available for CXF endpoints (including JAXWS ones). |
| </td> |
| </tr> |
| </table> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-2 c4-4 c5-4 c6-4"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE main configuration, conf/tomee.xml</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="utf-8"?> |
| <tomee> |
| <!-- |
| resources can be declared here |
| To lookup it directly just use openejb:Resource/<id> name |
| --> |
| <Resource id="name" type="DataSource> |
| # here comes the configuration in properties like format |
| JdbcUrl = jdbc:hsqldb:mem:my-ds |
| UserName = SA |
| </Resource> |
| |
| <!-- resource can be any class available in the container loader --> |
| <Resource id="foo" class-name="org.foo.MyPojo"> |
| pojoAttr1 = value2 |
| </Resource> |
| |
| <!-- |
| if you want to deploy ear/jar, |
| declare it + put the file in apps folder |
| --> |
| <Deployments dir="apps" /> |
| |
| <!-- more on http://tomee.apache.org/containers-and-resources.html --> |
| </tomee></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Activating JAAS</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="admonitionblock note"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <div class="title">Note</div> |
| </td> |
| <td class="content"> |
| in the snippets <code>o.a.o</code> means <code>org.apache.openejb</code> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>Basic JAAS configuration needs:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>the system property:</p> |
| </li> |
| </ul> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code>-Djava.security.auth.login.config=<path to login.config></code></pre> |
| </div> |
| </div> |
| |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>the login.config file (see below)</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>Here is a sample JAAS config file using PropertiesLoginModule:</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code>PropertiesLoginModule { |
| o.a.o.core.security.jaas.PropertiesLoginModule |
| required |
| Debug=false |
| UsersFile="users.properties" |
| GroupsFile="groups.properties"; |
| };</code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>This login module needs 2 properties files, one for group and one for users.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Here is a <code>users.properties</code> file (should be in <code>conf/</code>):</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="ini">user1=pwd1 |
| user3=pwd2 |
| user3=pwd3</code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>Here is a <code>groups.properties</code> file (should be in <code>conf/</code>):</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="ini">group1=user1 |
| group2=user2, user3</code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>To integrate JAAS with Tomcat just add/replace the default tomcat realm with:</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><Realm className="org.apache.catalina.realm.JAASRealm" |
| appName="PropertiesLoginModule" |
| userClassNames="o.a.o.core.security.jaas.UserPrincipal" |
| roleClassNames="o.a.o.core.security.jaas.GroupPrincipal" /></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| </div> |
| <div class="horizontal-block" id="Maven"> |
| <div class="col c2-2 c3-1 c4-1 c5-1 c6-1"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">OpenEJB dependencies</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><!-- core: embedded cdi, ejb, EJBContainer... --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>openejb-core</artifactId> |
| <version>${openejb.version}</version> |
| </dependency> |
| |
| <!-- for JAXWS webservices --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>openejb-cxf</artifactId> |
| <version>${openejb.version}</version> |
| </dependency> |
| |
| <!-- for JAXRS webservices --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>openejb-cxf-rs</artifactId> |
| <version>${openejb.version}</version> |
| </dependency> |
| |
| <!-- embedded arquillian adapter --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>arquillian-openejb-embedded-4</artifactId> |
| <version>${openejb.version}</version> |
| </dependency></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-2 c4-2 c5-2 c6-2"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE dependencies</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><!-- tomee zip --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>apache-tomee</artifactId> |
| <version>${tomee.version}</version> |
| <type>zip</type> |
| </dependency> |
| |
| <!-- tomee arquillian adapter --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>arquillian-tomee-remote</artifactId> |
| <version>${tomee.version}</version> |
| </dependency></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE Embedded dependencies</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><!-- tomee zip --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>tomee-embedded</artifactId> |
| <version>${tomee.version}</version> |
| <type>zip</type> |
| </dependency> |
| |
| <!-- tomee embedded arquillian adapter --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>arquillian-tomee-embedded</artifactId> |
| <version>${tomee.version}</version> |
| </dependency> |
| |
| <!-- tomee jaxrs --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>tomee-jaxrs</artifactId> |
| <version>${tomee.version}</version> |
| </dependency> |
| |
| <!-- tomee jaxws --> |
| <dependency> |
| <groupId>org.apache.openejb</groupId> |
| <artifactId>tomee-webservices</artifactId> |
| <version>${tomee.version}</version> |
| </dependency></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-1 c3-3 c4-3 c5-3 c6-3"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE maven plugin configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="admonitionblock note"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <div class="title">Note</div> |
| </td> |
| <td class="content"> |
| Configuration block is optional all attributes have defaul values. |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><plugin> |
| <groupId>org.apache.openejb.maven</groupId> |
| <artifactId>tomee-maven-plugin</artifactId> |
| <version>${tmp.version}</version> |
| <configuration> <!-- all is optional --> |
| <tomeeVersion>1.5.0</tomeeVersion> |
| <tomeeClassifier>plus</tomeeClassifier> <!-- webprofile, jaxrs --> |
| |
| <!-- remote debugging --> |
| <debug>false</debug> |
| <debugPort>5005</debugPort> |
| |
| <!-- http port - same exists for ajp and https --> |
| <tomeeHttpPort>8080</tomeeHttpPort> |
| |
| <!-- remove default tomee webapp --> |
| <removeDefaultWebapps>true</removeDefaultWebapps> |
| <!-- remove even tomee webapp - if you don't use it --> |
| <removeTomeeWebapp>true</removeTomeeWebapp> |
| |
| <!-- add some libs to the server --> |
| <libs> |
| <lib>mysql:mysql-connector-java:5.1.20</lib> |
| </libs> |
| |
| <!-- deploy another webapp, same exists for ear with <apps /> --> |
| <webapps> |
| <webapp>org.superbiz:my-simple-webapp:1.0.0</webapp> |
| </webapps> |
| |
| <!-- auto update of the app --> |
| </configuration> |
| <!-- can the app be redeployed after update --> |
| <reloadOnUpdate>true</reloadOnUpdate> |
| <synchronization> |
| <!-- extensions updating and redeploying --> |
| <extensions> |
| <extension>.class<extension> |
| </extensions> |
| <!-- extensions updating without redeploy --> |
| <updateOnlyExtensions> |
| <updateOnlyExtension>.html<updateOnlyExtension> |
| <updateOnlyExtension>.js<updateOnlyExtension> |
| <updateOnlyExtension>.jcss<updateOnlyExtension> |
| </updateOnlyExtensions> |
| </synchronization> |
| <!-- <synchronizations/> exist to handle multiple source/target --> |
| </configuration> |
| </configuration> |
| </plugin></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-1 c3-2 c4-4 c5-4 c6-4"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE maven plugin information</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>Compatibility matrix:</p> |
| </div> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 50%"> |
| <col style="width: 50%"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>TomEE</strong></p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Maven plugin</strong></p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">1.0.0</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">1.0-alpha-1</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">1.5.0</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">1.0.0</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">1.5.1</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">1.0.1</p></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">>= 1.5.2</p></td> |
| <td class="tableblock halign-left valign-top"><p class="tableblock">same as TomEE</p></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <div class="paragraph"> |
| <p>Main goals:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>tomee:run: run and wait for the server</p> |
| </li> |
| <li> |
| <p>tomee:debug: run in debug mode and wait for the server (alias of run)</p> |
| </li> |
| <li> |
| <p>tomee:start: run the server</p> |
| </li> |
| <li> |
| <p>tomee:stop: stop the server (to use with start)</p> |
| </li> |
| <li> |
| <p>tomee:configtest: run configtest tomcat command</p> |
| </li> |
| <li> |
| <p>tomee:deploy <path>: deploy path archive</p> |
| </li> |
| <li> |
| <p>tomee:undeploy <path>: undeploy path archive. Note it should be the same path than the one used in deploy command</p> |
| </li> |
| <li> |
| <p>tomee:list: list ejbs deployed</p> |
| </li> |
| <li> |
| <p>tomee:build: build tomee but does not start it</p> |
| </li> |
| <li> |
| <p>tomee:help: this</p> |
| </li> |
| </ul> |
| </div> |
| <div class="admonitionblock note"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <div class="title">Note</div> |
| </td> |
| <td class="content"> |
| almost all properties can be set as maven system properties prefixed by <code>tomee-plugin.</code>. |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="admonitionblock tip"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <div class="title">Tip</div> |
| </td> |
| <td class="content"> |
| to debug use <code>mvn tomee:debug</code> instead of <code>mvn tomee:run</code>. |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>Doc is on <a href="http://tomee.apache.org/tomee-maven-plugin.html">http://tomee.apache.org/tomee-maven-plugin.html</a>.</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| </div> |
| <div class="horizontal-block" id="Arquillian"> |
| <div class="col c2-1 c3-1 c4-1 c5-1 c6-1"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">OpenEJB embedded adapter configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="UTF-8"?> |
| <arquillian |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation=" |
| http://jboss.org/schema/arquillian |
| http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> |
| <container qualifier="openejb" default="true"> |
| <configuration> |
| <!-- container properties (~ conf/system.properties) --> |
| <property name="properties"> |
| # you can declare a resource, container... |
| db1 = new://Resource?type=DataSource |
| db1.JdbcUrl = jdbc:hsqldb:mem:db1 |
| |
| # special hook based on ShrinkWrap |
| # to predeployed some archives at startup |
| # (instead of by test) |
| # |
| # syntax is comma separated list |
| # and multiple archives in the same package |
| # can be aggregated: package.[A1|A2] |
| openejb.arquillian.predeploy-archives = org.foo.SimpleArchive |
| </property> |
| </configuration> |
| </container> |
| </arquillian></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE Arquillian Adapters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div class="paragraph"> |
| <p>TomEE arquillian adapters support the system property <code>openejb.arquillian.adapter</code> |
| to select which adapter to use if multiple are at the classpath (Arquillian tolerate a single |
| one by default).</p> |
| </div> |
| <div class="paragraph"> |
| <p>This way you can run your test against several OpenEJB/TomEE adapters in the same build (no need |
| of any maven profile). A complete sample can be found here: |
| <a href="http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/multiple-arquillian-adapters/">http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/multiple-arquillian-adapters/</a>).</p> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Simple Arquillian test</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="java">@RunWith(Arquillian.class) |
| public class SimpleArquillianTest { |
| @Deployment(name = "archive") |
| public static WebArchive war() { |
| return ShrinkWrap.create(WebArchive.class, "test.war") |
| .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") |
| .addClasses(MyBean.class); |
| } |
| |
| @Inject |
| private MyBean bean; |
| |
| @Test |
| public void testRunningInDep1() { |
| assertEquals("foo", bean.foo()); |
| } |
| }</code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-2 c4-2 c5-2 c6-2"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE embedded adapter configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="UTF-8"?> |
| <arquillian |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation=" |
| http://jboss.org/schema/arquillian |
| http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> |
| <container qualifier="tomee" default="true"> |
| <configuration> |
| <property name="serverXml">conf/server.xml</property> |
| |
| <!-- port = -1 means random --> |
| <property name="httpPort">-1</property> |
| <property name="stopPort">-1</property> |
| |
| <!-- ssl --> |
| <property name="httpsPort">-1</property> |
| <property name="ssl">false</property> |
| <property name="keystoreFile">keystore-path</property> |
| <property name="keystorePass">changeit</property> |
| <property name="keystoreType">JKS</property> |
| <property name="clientAuth">false</property> |
| <property name="keyAlias">alias</property> |
| <property name="sslProtocol">protocol</property> |
| |
| <!-- where to create TomEE files --> |
| <property name="dir">target/tomee-embedded</property> |
| |
| <!-- where to dump on disk applications to deploy --> |
| <property name="appWorkingDir">target/working-dir</property> |
| |
| <!-- optional - limit the port allowed when random --> |
| <property name="portRange">20001-30000</property> |
| |
| <!-- container config --> |
| <property name="properties"> |
| # same as embedded case |
| </property> |
| |
| <!-- Deployer config --> |
| <property name="deployerProperties"> |
| # openejb.deployer.binaries.use=true |
| # openejb.deployer.forced.appId=[name] |
| # openejb.deployer.save-deployments=false |
| </property> |
| </configuration> |
| </container> |
| </arquillian></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-1 c3-3 c4-3 c5-3 c6-3"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">TomEE remote adapter configuration</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="UTF-8"?> |
| <arquillian |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation=" |
| http://jboss.org/schema/arquillian |
| http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> |
| <container qualifier="tomee" default="true"> |
| <configuration> |
| <property name="serverXml">conf/server.xml</property> |
| |
| <!-- tomee zip to use --> |
| <property name="groupId">org.apache.openejb</property> |
| <property name="artifactId">apache-tomee</property> |
| <property name="version">LATEST</property> |
| <property name="type">zip</property> |
| |
| <!-- tomee provided files, ignored by default --> |
| <property name="bin">src/test/tomee/bin</property> |
| <property name="conf">src/test/tomee/conf</property> |
| <property name="lib">src/test/tomee/lib</property> |
| |
| <!-- |
| remote debugging, |
| -Dopenejb.server.debug can activate it too |
| --> |
| <property name="debug">false</property> |
| <property name="debugPort">5005</property> |
| |
| <!-- nice one line logging --> |
| <property name="simpleLog">true</property> |
| |
| <!-- jvm config --> |
| <property name="catalina_opts">-XX:-UseParallelGC</property> |
| |
| <!-- remove if exist --> |
| <property name="cleanOnStartUp">true</property> |
| |
| <!-- remove default webapps --> |
| <property name="removeunusedWebapps">true</property> |
| |
| <!-- port = -1 means random --> |
| <property name="httpPort">-1</property> |
| <property name="stopPort">-1</property> |
| |
| <!-- where to create TomEE --> |
| <property name="dir">target/apache-tomee</property> |
| |
| <!-- where to dump on disk applications to deploy --> |
| <property name="appWorkingDir">target/working-dir</property> |
| |
| <!-- optional - limit the port allowed when random --> |
| <property name="portRange">20001-30000</property> |
| |
| <!-- container config --> |
| <property name="properties"> |
| # same as embedded case |
| </property> |
| |
| <!-- Deployer config --> |
| <property name="deployerProperties"> |
| # openejb.deployer.binaries.use=true |
| # openejb.deployer.forced.appId=[name] |
| # openejb.deployer.save-deployments=false |
| </property> |
| |
| </configuration> |
| </container> |
| </arquillian></code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| |
| <div class="col c2-2 c3-2 c4-4 c5-4 c6-4"><div class="blk"> |
| <table class="tableblock frame-all grid-all" style="width: 100%"> |
| <colgroup> |
| <col style="width: 100%"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top">Multiple TomEE with Arquillian</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div><div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="xml"><?xml version="1.0" encoding="UTF-8"?> |
| <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation=" |
| http://jboss.org/schema/arquillian |
| http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> |
| <group qualifier="tomee-cluster"> |
| <container qualifier="tomee-1"> |
| <configuration> |
| <property name="httpPort">-1</property> |
| <property name="stopPort">-1</property> |
| <property name="ajpPort">-1</property> |
| <property name="dir">target/tomee1</property> |
| <property name="appWorkingDir">target/wd1</property> |
| </configuration> |
| </container> |
| <container qualifier="tomee-2"> |
| <configuration> |
| <property name="httpPort">-1</property> |
| <property name="stopPort">-1</property> |
| <property name="ajpPort">-1</property> |
| <property name="dir">target/tomee2</property> |
| <property name="appWorkingDir">target/wd2</property> |
| </configuration> |
| </container> |
| </group> |
| </arquillian></code></pre> |
| </div> |
| </div> |
| |
| <div class="paragraph"> |
| <p>Then in java just declare "as usual" multiple deployments and match them in your test methods:</p> |
| </div> |
| <div> |
| <div class="content monospaced"> |
| <pre class="highlight"><code class="java">@RunWith(Arquillian.class) |
| public class MultipleTomEETest { |
| @Deployment(name = "war1", testable = false) |
| @TargetsContainer("tomee-1") |
| public static WebArchive war1() { |
| return /* ... */; |
| } |
| |
| @Deployment(name = "war2", testable = false) |
| @TargetsContainer("tomee-2") |
| public static WebArchive war2() { |
| return /* ... */; |
| } |
| |
| @Test |
| @OperateOnDeployment("war1") |
| public void testRunningInDep1( |
| @ArquillianResource URL url) { |
| // test on tomee 1, url is contextual |
| } |
| |
| @Test |
| @OperateOnDeployment("war2") |
| public void testRunningInDep1( |
| @ArquillianResource URL url) { |
| // test on tomee 1, url is contextual |
| } |
| }</code></pre> |
| </div> |
| </div> |
| </div></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| </div></div> |
| </div> |
| </div> |
| </div> |
| <div style="clear: both;"></div> |
| <hr> |
| |
| </div> |
| <div id="clearing-div" style="clear:both;"></div> |
| </div> |
| </div> |
| <footer> |
| <div class="mid"> |
| TomEE RefCard - revision 1-SNAPSHOT - 20140311-1059 |
| </div> |
| </footer> |
| </body> |
| </html> |