JAX-RS/JAX-WS configuration for TomEE 1.5.0

JAX-RS endpoint configuration was not possible (or not easy at all) in last TomEE release. The brand new one makes it possible.

It is important to be able to add custom providers, custom (cxf) interceptors or features…

The idea is to put the configuration in openejb-jar.xml file. If you have an EJB put it in ejb-deployment properties. If it is a pojo (= not an EJB) we copied the same pattern: create a pojo-deployment tag with a nested properties tag.

<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
  <ejb-deployment ejb-name="CalculatorBean">
      <!-- here goes the config -->

  <pojo-deployment class-name="org.foo.bar.DummyEndpoint">
      <!-- here goes the config -->

Then use the following keys in properties tag prefixed by either cxf.jaxrs. or cxf.jaxws. depending which endpoint you want to configure (the SOAP one or the REST one):

  • properties
  • features
  • in-interceptors
  • out-interceptors
  • in-fault-interceptors
  • out-fault-interceptors
  • databinding
  • providers (only for rest endpoint)

Properties value should match the id of a service in resources.xml file. Then properties of this service will be used as endpoint properties.

For features and interceptors the rule is the same: value is a list comma separated. Each value of the list is either a qualified class name or an id of a service in resources.xml.

Databinding is simply either a qualified name or a service id in resources.xml.

Here is a sample:


<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
  <ejb-deployment ejb-name="CalculatorBean">
      cxf.jaxws.in-interceptors = wss4j


  <Service id="wss4j" class-name="org.apache.openejb.server.cxf.config.WSS4JInInterceptorFactory" factory-name="create">
    action = UsernameToken
    passwordType = PasswordText
    passwordCallbackClass = org.superbiz.ws.security.PasswordCallbackHandler

2 thoughts on “JAX-RS/JAX-WS configuration for TomEE 1.5.0

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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