Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{span:style=font-size:2em;font-weight:bold} JAX-RS : Deployment {span}

{toc}

This page provides the tips on how to deploy CXF JAX-RS applications packaged as WAR archives or OSGI bundles into Java EE application servers and OSGI containers.  

h1. Application Servers
h2. Glassfish

*Verified with Glassfish Server Open Source Edition 3.1.1*

-1. Make sure a cxf-rt-transport-http-jetty dependency is excluded during the war build
-2. If a custom JAX-RS [Application|http://jsr311.java.net/nonav/releases/1.1/index.html] is included then
  use a [CXFNonSpringJaxrsServlet|http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring] to reference the Application implementation class and disableeither 
 2.1 Disable the Jersey scanning the custom web applications (TODO: specify how this actually can be disableddone) or 
 2.2 Remove jersey-gf-server.jar from $GLASSFISH_HOME/glassfish/modules

h2. JBoss

*Verified with JBoss AS 7.1.0.CR1b*

-1. If a custom JAX-RS [Application|http://jsr311.java.net/nonav/releases/1.1/index.html] is included then
  use a [CXFNonSpringJaxrsServlet|http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring] to reference the Application implementation class and disable either 
 2.1 Disable the RestEasy scanning the custom web applications (TODO: specify how this actually can be disableddone)
 2.2 Remove RestEasy jar(s) from the libs 

h2. WebLogic

*Verified with WebLogic Server 12c (12.1.1)*

h3. Specifying a WebLogic specific JSP servlet

If you configure CXFServlet to redirect to custom JSP pages then you need to add the following declaration to web.xml:
{code:xml}
<servlet>
 <servlet-name>jsp</servlet-name>
 <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
</servlet> 
{code}
 
h3. Selecting Woodstox as the default parser

WebLogic requires the following update to the proprietary deployment descriptor weblogic.xml:
{code:xml}
  <container-descriptor>
   <!-- SNIP -->
   <prefer-web-inf-classes>true</prefer-web-inf-classes>
  </container-descriptor>
{code}

This instructs WebLogic's classloaders to look FIRST in the JARS from the application's WEB-INF/lib directory for Service Provider Implementations (in this case, to find META-INF/services/javax.xml.stream.XMLInputFactory in the Woodstox JAR) rather than to the system classloader.
Please see this [thread|https://forums.oracle.com/forums/message.jspa?messageID=9953045] for more information.