blob: 2b9c84a50ac99ec0befb4334bd6a069b5feb6369 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<link type="text/css" rel="stylesheet" href="/resources/site.css">
<script src='/resources/space.js'></script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
<meta name="description" content="Apache CXF, Services Framework - Application Server Specific Configuration Guide">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shCoreCXF.css">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- Application Server Specific Configuration Guide
</title>
</head>
<body onload="init()">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td id="cell-0-0" colspan="2">&nbsp;</td>
<td id="cell-0-1">&nbsp;</td>
<td id="cell-0-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-1-0">&nbsp;</td>
<td id="cell-1-1">&nbsp;</td>
<td id="cell-1-2">
<!-- Banner -->
<div class="banner" id="banner"><div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
<a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
</td><td align="right" colspan="1" nowrap>
<a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
</td></tr></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>
<div align="left">
<!-- Breadcrumbs -->
<a href="index.html">Index</a>&nbsp;&gt;&nbsp;<a href="deployment.html">Deployment</a>&nbsp;&gt;&nbsp;<a href="application-server-specific-configuration-guide.html">Application Server Specific Configuration Guide</a>
<!-- Breadcrumbs -->
</div>
</td>
<td>
<div align="right">
<!-- Quicklinks -->
<div id="quicklinks"><p><a shape="rect" href="http://cxf.apache.org/download.html">Download</a> | <a shape="rect" href="http://cxf.apache.org/docs/index.html">Documentation</a></p></div>
<!-- Quicklinks -->
</div>
</td>
</tr>
</table>
</div>
</td>
<td id="cell-1-3">&nbsp;</td>
<td id="cell-1-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-2-0" colspan="2">&nbsp;</td>
<td id="cell-2-1">
<table>
<tr valign="top">
<td height="100%">
<div id="wrapper-menu-page-right">
<div id="wrapper-menu-page-top">
<div id="wrapper-menu-page-bottom">
<div id="menu-page">
<!-- NavigationBar -->
<div id="navigation"><ul class="alternate"><li><a shape="rect" href="overview.html">Overview</a></li><li><a shape="rect" href="how-tos.html">How-Tos</a></li><li><a shape="rect" href="frontends.html">Frontends</a></li><li><a shape="rect" href="databindings.html">DataBindings</a></li><li><a shape="rect" href="transports.html">Transports</a></li><li><a shape="rect" href="configuration.html">Configuration</a></li><li><a shape="rect" href="debugging-and-logging.html">Debugging and Logging</a></li><li><a shape="rect" href="tools.html">Tools</a></li><li><a shape="rect" href="restful-services.html">RESTful Services</a></li><li><a shape="rect" href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect" href="service-routing.html">Service Routing</a></li><li><a shape="rect" href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect" href="ws-support.html">WS-* Support</a></li><li><a shape="rect" href="advanced-integration.html">Advanced Integration</a></li><li><a shape="rect" href="deployment.html">Deployment</a></li><li><a shape="rect" href="schemas-and-namespaces.html">Use of Schemas and Namespaces</a></li></ul><hr><ul class="alternate"><li><p>Search</p></li></ul><form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="002890367768291051730:o99qiwa09y4">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" size="21">
<input type="submit" name="sa" value="Search">
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script><hr><ul class="alternate"><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest/">API 3.2.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF Website</a></li></ul><p>&#160;</p><p><a shape="rect" class="external-link" href="http://www.apache.org/events/current-event.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.apache.org/events/current-event-125x125.png" data-image-src="http://www.apache.org/events/current-event-125x125.png"></span></a></p></div>
<!-- NavigationBar -->
</div>
</div>
</div>
</div>
</td>
<td height="100%">
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p>This document provides app server-specific configuration information for running Apache CXF.</p><p><style type="text/css">/*<![CDATA[*/
div.rbtoc1636141543905 {padding: 0px;}
div.rbtoc1636141543905 ul {list-style: disc;margin-left: 0px;padding-left: 20px;}
div.rbtoc1636141543905 li {margin-left: 0px;padding-left: 0px;}
/*]]>*/</style></p><div class="toc-macro rbtoc1636141543905">
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-JBossApplicationServer">JBoss Application Server</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-SpringBoot">SpringBoot</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-WebLogic">WebLogic</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Putjarsinendorsedfolder">Put jars in endorsed folder</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Packwarinanear,deploytheearwithweblogic-application.xml">Pack war in an ear, deploy the ear with weblogic-application.xml</a></li></ul>
</li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Websphere">Websphere</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-ForWebSphereVersions&lt;6.1.0.29">For WebSphere Versions &lt; 6.1.0.29</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-NoWebServicesFeaturePackforWebSphereinstalled">No Web Services Feature Pack for WebSphere installed</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-putjarintheendorsedfolder">put jar in the endorsed folder</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Addyourownclassloader">Add your own class loader</a></li></ul>
</li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-WebServicesFeaturePackforWebSphereInstalled">Web Services Feature Pack for WebSphere Installed</a></li></ul>
</li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-ForWebSphere6.1.0.29+,V7andV8">For WebSphere 6.1.0.29+, V7 and V8</a></li></ul>
</li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Glassfish">Glassfish</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-OC4J">OC4J</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Disclaimer">Disclaimer</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Background">Background</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Configurationoverview">Configuration overview</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-OracleOC4Jclassloading">Oracle OC4J class loading</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Neededcomponents">Needed components</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Preparingstax-api">Preparing stax-api</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-ReplacetheOracleXMLparserwithXerces">Replace the Oracle XML parser with Xerces</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-GetridofOC4JJAX-WSlibraries">Get rid of OC4J JAX-WS libraries</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-swappingOraclewsdl.jarwithwsdl4j.jarandjaxb.jarAPIwithjaxb-api-2.0.jar">swapping Oracle wsdl.jar with wsdl4j.jar and jaxb.jar API with jaxb-api-2.0.jar</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Deployingapplications">Deploying applications</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-OracleFAQ">Oracle FAQ</a>
<ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-I'mgettingjava.lang.ClassCastException:org.apache.xerces.jaxp.DocumentBuilderFactoryImpl">I'm getting java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-IcannotgetWSDL(gettingHTTP500accesingmyCXFserviceWSDLwithhttp://myshot/myservice?wsdl)">I cannot get WSDL (getting HTTP 500 accesing my CXF service WSDL with http://myshot/myservice?wsdl)</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-I'mgettingjava.lang.NoSuchMethodException:oracle.j2ee.ws.wsdl.extensions.soap.SOAPBodyImpl.getElementType()">I'm getting java.lang.NoSuchMethodException: oracle.j2ee.ws.wsdl.extensions.soap.SOAPBodyImpl.getElementType()</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Icannotgetittoworkstill">I cannot get it to work still</a></li></ul>
</li></ul>
</li></ul>
</li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-IntegrationwithApplicationServerFAQ">Integration with Application Server FAQ</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Resources">Resources</a></li></ul>
</div><h2 id="ApplicationServerSpecificConfigurationGuide-JBossApplicationServer">JBoss Application Server</h2><p>JBoss Application Server (JBoss AS) comes with its own webservices stack (JBossWS) in order for providing full JavaEE support.<br clear="none"> Starting from JBoss AS 6 M4, the default webservices stack is internally based on Apache CXF; as a consequence users might experiment classloading issues with classes from both the CXF libraries and its dependencies if included in deployments and not properly isolated. Please refer to the relevant JBoss AS documentation for details on how to turn on classloading isolation on the application server version in use.</p><p>In particular, when willing to run Apache CXF based applications on top of JBoss AS 7 series, users have basically two options:</p><ul><li><p>use JBoss AS as if it was a servlet container with no WS functionalities: this basically implies disabling the webservices subsystem for the user deployment, hence preventing the AS webservices stack from processing the ws endpoint deployment and letting the CXF libs included in the archive deal with any WS invocations when CXFServlet is hit; the webservices subsystem is turned off by adding a jboss-deployment-structure.xml as follows to the ws endpoint deployment:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"&gt;
&lt;deployment&gt;
&lt;exclude-subsystems&gt;
&lt;subsystem name="webservices" /&gt;
&lt;/exclude-subsystems&gt;
&lt;/deployment&gt;
&lt;/jboss-deployment-structure&gt;
</pre>
</div></div><p>this approach offers the fastest route to deploying CXF apps on JBoss AS; the drawback is that no special ws integration with JBoss AS internals is available</p></li></ul><ul><li>rely on JBossWS integration and the Apache CXF libraries included in the application server (<a shape="rect" class="external-link" href="https://docs.jboss.org/author/display/AS71/Webservices+reference+guide" rel="nofollow">documentation</a>): this implies removing any Apache CXF libs from the ws deployment as well as any other dependencies which is already included in JBoss AS (including any Java EE API jar); if included, the optional web.xml descriptor is to be rewritten according to JBossWS convention (see <a shape="rect" class="external-link" href="https://docs.jboss.org/author/display/AS71/JAX-WS+User+Guide" rel="nofollow">documentation</a>); the Spring support is optional in JBoss AS and Spring based endpoint declaration is not the default/preferred configuration approach for ws endpoints, hence users willing to declare endpoints using Spring needs to create a org.springframework.spring module and put their endpoint declarations in a jbossws-cxf.xml descriptor; if the user application makes use of any lib besides tha JavaEE api, proper module <a shape="rect" class="external-link" href="https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7" rel="nofollow">dependencies</a> are to be declared either using the jboss-deployment-structure.xml descriptor or the archive MANIFEST.MF (few directions on ws modules available <a shape="rect" class="external-link" href="https://docs.jboss.org/author/display/AS71/JBoss+Modules+and+WS+applications" rel="nofollow">here</a>)</li></ul><p>The second approach allows leveraging the full JavaEE 6 stack (including e.g. JSR-109) as well as specific ws integration with JBoss AS internals.</p><h2 id="ApplicationServerSpecificConfigurationGuide-SpringBoot">SpringBoot</h2><p>Please see CXF <a shape="rect" href="springboot.html">SpringBoot</a> documentation.</p><p>JAX-WS: see&#160;<a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jaxws_spring_boot" rel="nofollow">JAX-WS Spring Boot</a>&#160;demo.</p><p>JAX-RS: &#160;see&#160;<a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot" rel="nofollow">JAX-RS Spring Boot</a>&#160;and&#160;<a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan" rel="nofollow">JAX-RS Spring Boot Scan</a>&#160;demos.</p><h2 id="ApplicationServerSpecificConfigurationGuide-WebLogic">WebLogic</h2><p>There are two ways to deploy a CXF WAR archive in WebLogic. (<strong>Note: This has been validated on WebLogic9.2.</strong>)</p><h4 id="ApplicationServerSpecificConfigurationGuide-Putjarsinendorsedfolder">Put jars in endorsed folder</h4><ul><li>Put the geronimo-ws-metadata_2.0_spec-1.1.1.jar in the $Weblogic_Home/jdk_../jre/lib/endorsed folder.</li><li>Deploy the CXF war in weblogic.<br clear="none"> (This way is not recommended, since it might break the application server itself. The method below is preferred, as it impacts a single module only.)</li></ul><h4 id="ApplicationServerSpecificConfigurationGuide-Packwarinanear,deploytheearwithweblogic-application.xml">Pack war in an ear, deploy the ear with weblogic-application.xml</h4><ul><li><p>Create a standard J2EE application.xml file in the META-INF folder. (Take $CXF_HOME/samples/java_first_spring_support for example)</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE application PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd"&gt;
&lt;application&gt;
&lt;display-name&gt;spring_http&lt;/display-name&gt;
&lt;module&gt;
&lt;web&gt;
&lt;web-uri&gt;spring_http.war&lt;/web-uri&gt;
&lt;context-root&gt;spring&lt;/context-root&gt;
&lt;/web&gt;
&lt;/module&gt;
&lt;/application&gt;
</pre>
</div></div></li></ul><ul><li><p>Create a weblogic-application.xml (Weblogic specific) in the META-INF folder.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;weblogic-application xmlns="http://www.bea.com/ns/weblogic/90"&gt;
&lt;application-param&gt;
&lt;param-name&gt;webapp.encoding.default&lt;/param-name&gt;
&lt;param-value&gt;UTF-8&lt;/param-value&gt;
&lt;/application-param&gt;
&lt;prefer-application-packages&gt;
&lt;package-name&gt;javax.jws.*&lt;/package-name&gt;
&lt;/prefer-application-packages&gt;
&lt;/weblogic-application&gt;
</pre>
</div></div></li></ul><p>The prefer-application-packages element you see above sets up WebLogic's <a shape="rect" class="external-link" href="http://e-docs.bea.com/wls/docs100/programming/classloading.html#wp1097187" rel="nofollow">Filtering Classloader</a>. Each class whose package matches one of the package-name elements listed will be searched for first within the EAR before relying on the WebLogic system classloader's version. If a package for a particular class is not listed here, WebLogic will try to load its own (possibly older) version first, so if you are getting deployment errors due to any particular class you might wish to add its package here.</p><p>Also note you can, and may need to, specify other options in the weblogic-application.xml file such as XML processing factories as shown <a shape="rect" class="external-link" href="http://cxf.547215.n5.nabble.com/Getting-error-while-deploying-on-weblogic-9-2-but-able-to-do-in-tomcat-td554060.html#a554061" rel="nofollow">here</a>. See the WebLogic <a shape="rect" class="external-link" href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/app_xml.html#wp1064995" rel="nofollow">guide</a> for more information.</p><ul><li>Run "jar cvf ..." command to create the ear and then deploy it. Alternatively, this <a shape="rect" class="external-link" href="http://www.jroller.com/gmazza/entry/deploying_webservices_on_weblogic" rel="nofollow">blog entry</a> provides a Mavenized method of building the EAR.</li></ul><h2 id="ApplicationServerSpecificConfigurationGuide-Websphere">Websphere</h2><h3 id="ApplicationServerSpecificConfigurationGuide-ForWebSphereVersions&lt;6.1.0.29">For WebSphere Versions &lt; 6.1.0.29</h3><p>Adding jars to the 'endorsed' folder appears to be the main solution:</p><h4 id="ApplicationServerSpecificConfigurationGuide-NoWebServicesFeaturePackforWebSphereinstalled">No Web Services Feature Pack for WebSphere installed</h4><h5 id="ApplicationServerSpecificConfigurationGuide-putjarintheendorsedfolder">put jar in the endorsed folder</h5><ul><li>put the wsdl4j-1.6.1.jar in the $WebSphere_HOME/java/jre/lib/endorsed folder.</li><li>In the WebSphere console, find the specific enterprise application, click the "Class loading and update detection".<ul><li>Mark the "Classes loaded with application class loader first" selected.</li><li>Mark the "Class loader for each war file in application" selected.</li></ul></li></ul><p>And then restart the Websphere server. (Because we changed the endorsed folder, we need to restart it to make it take effect).</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Please make sure your classpath doesn't have the servlet-2.5 library, since WebSphere6.1 is servlet-2.4 compliant!</p></div></div><h5 id="ApplicationServerSpecificConfigurationGuide-Addyourownclassloader">Add your own class loader</h5><p>If you put your wsdl4j-1.6.1 jar in $WAS_HOME/java/jre/lib/endorsed, all your applications will depend on your version of wsdl4j. Another solution is to create a new class loader in your server which loads before parent class loader, create a shared library with your version of wsdl4j, and add this shared library to your new class loader. This version of wsdl4j will only be available for your specific server and not affect applications running in other servers.</p><p><strong>Step by step</strong></p><ol><li>In the WAS console navigate to <strong>Environment &gt; Shared Libraries</strong></li><li>Select the scope you wish your library should be visible in</li><li>Click <strong>New</strong> and set values ex: <code>name=MYAPP_SHARED_LIB, classpath=PATH_TO/wsdl4j-1.6.2.jar</code> and <strong>Save</strong></li><li>Navigate to <strong>Application servers &gt; [your server name]</strong> <strong>&gt; Java and Process Management &gt; Class loader &gt; New</strong></li><li>Select <strong>Classes loaded with application class loader first</strong> and <strong>Save</strong></li><li>Select your new class loader and click <strong>Shared library references</strong></li><li>Add your shared library (MYAPP_SHARED_LIB) <strong>Save</strong> and restart your server.</li></ol><p>Tested in WAS 6.1 only but should work in earlier versions as well.</p><p>Another user running WS6.1 FP 23 without the web services feature pack came up with this solution that seemed to work for them:</p><blockquote><p>Create a shared library with the following jars:<br clear="none"> jsr173_api-1.0.jar<br clear="none"> jaxp-ri-1.4.2.jar<br clear="none"> saaj-impl-1.3.2.jar<br clear="none"> wsdl4j-1.6.2.jar</p><p>Create a new parent-first classloader and have it reference the shared library you just created. Restart everything and it should work.</p></blockquote><h4 id="ApplicationServerSpecificConfigurationGuide-WebServicesFeaturePackforWebSphereInstalled">Web Services Feature Pack for WebSphere Installed</h4><p>Things are way more complicated if the Web Services Feature Pack for WebSphere is installed. With this feature pack installed, it is impossible to deploy an application using CXF, because the WebSphere Web Services engine starts parsing the JAX-WS annotations of the services and tries to deploy the services.</p><p>Up to fixpack 27 (6.1.0.27) there was no possibility to disable the WebSphere Web Services engine.</p><h3 id="ApplicationServerSpecificConfigurationGuide-ForWebSphere6.1.0.29+,V7andV8">For WebSphere 6.1.0.29+, V7 and V8</h3><p>Follow the PDF download given within this IBM developerWorks article:<a shape="rect" class="external-link" href="http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html" rel="nofollow">http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html</a></p><p>As described in the PDF, you'll need to change the Classloader order to "Classes loaded with local class loader first (parent last)" and to disable the IBM web services engine, either for the JVM as a whole or for the particular module.</p><p>To disable for the whole JVM, set the JVM property</p><p>com.ibm.websphere.webservices.DisableIBMJAXWSEngine=true</p><p>or to disable the engine just for a specific module by adding</p><p>DisableIBMJAXWSEngine: true</p><p>to WAR/META-INF/MANIFEST.MF.</p><p>Another issue that comes up with certain versions of WebSphere is an incompatibility with the SAAJ implementation. It is recommended to use the org.apache.servicemix.bundles.saaj-impl-1.3.18_1.jar saaj impl available from <a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.saaj-impl/1.3.18_1/" rel="nofollow">http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.saaj-impl/1.3.18_1/</a> as that contains a recent version of SAAJ along with it's required DOM implementation which will work on the IBM JDK.</p><p>One user has reported that he was able to get CXF working on WebSphere with a minimal set of CXF jars by following the above<br clear="none"> procedures and using the list of jars:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">FastInfoset-1.2.9.jar
aopalliance-1.0.jar
commons-logging-1.1.1.jar
cxf-2.5.2.jar
geronimo-activation_1.1_spec-1.1.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-javamail_1.4_spec-1.7.1.jar
geronimo-jaxws_2.2_spec-1.1.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.3.jar
jars_in_war.txt
jaxb-api-2.2.3.jar
jaxb-impl-2.2.4-1.jar
neethi-3.0.1.jar
org.apache.servicemix.bundles.saaj-impl-1.3.18_1.jar
spring-aop-3.0.6.RELEASE.jar
spring-asm-3.0.6.RELEASE.jar
spring-beans-3.0.6.RELEASE.jar
spring-context-3.0.6.RELEASE.jar
spring-core-3.0.6.RELEASE.jar
spring-expression-3.0.6.RELEASE.jar
spring-web-3.0.6.RELEASE.jar
stax2-api-3.1.1.jar
woodstox-core-asl-4.1.1.jar
wsdl4j-1.6.2.jar
xmlschema-core-2.0.1.jar
</pre>
</div></div><h2 id="ApplicationServerSpecificConfigurationGuide-Glassfish">Glassfish</h2><p>CXF Interceptors will not work in Glassfish without this sun-web.xml file to configure the classloader. By default, Glassfish will use Metro for JAX-WS services so the classloader needs to be configured to allow CXF libraries to provide JAX-WS services. The following sun-web.xml xml source was added to /WEB-INF to resolve this issue:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD
Application Server 9.0 Servlet 2.5//EN'
'http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd'&gt;
&lt;sun-web-app&gt;
&lt;class-loader delegate="false"/&gt;
&lt;/sun-web-app&gt;
</pre>
</div></div><h2 id="ApplicationServerSpecificConfigurationGuide-OC4J">OC4J</h2><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This guide requires heavy customization of the OC4J configuration. Bear in mind that some of steps presented below are either undocumented or unsupported. We strongly advice you to perform those steps in a separate container, dedicated exclusively for CXF.</p></div></div><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Also see: <a shape="rect" class="external-link" href="http://chadthedeveloper.blogspot.com/2008/06/cxf-vs-oc4j-round-1.html" rel="nofollow">http://chadthedeveloper.blogspot.com/2008/06/cxf-vs-oc4j-round-1.html</a> for other suggestions on how to configure OC4J.</p></div></div><h3 id="ApplicationServerSpecificConfigurationGuide-Disclaimer">Disclaimer</h3><p>This guide covers only 10.1.3.X.X version of OC4J. Note that OC4J 10.1.2 is not JSE 1.5 certified server. OC4J 11_g_ is <a shape="rect" class="external-link" href="http://java.sun.com/javaee/overview/compatibility.jsp" rel="nofollow">fully JEE 5.0 certified stack</a> and comes with their own JAX-WS implementation.</p><h3 id="ApplicationServerSpecificConfigurationGuide-Background">Background</h3><p>Oracle OC4J comes with highly customized XML stack by Oracle including SAX, StAX, JAXP, JAX-WS, SAAJ, WSDL and few others. All of those frameworks are Oracle proprietary implementations in the OC4J distribution. This gives Oracle really good interoperability between their products but it makes it rather hard to introduce something which needs different implementation of above APIs (like CXF).</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p><span class="confluence-anchor-link" id="ApplicationServerSpecificConfigurationGuide-orajaxws"></span><br clear="none"> OC4J 10.1.3 comes with <a shape="rect" class="external-link" href="http://www.oracle.com/technology/tech/java/oc4j/10131/OracleAS-NF-10131.pdf" rel="nofollow">preliminary implementation of JAX-WS (JSR-181)</a> but this implementation is somewhat limited only to top-down scenario, with very limited customization (lack of JAXB 2.0 etc.).</p></div></div><h4 id="ApplicationServerSpecificConfigurationGuide-Configurationoverview">Configuration overview</h4><p>A few components need to be customized in OC4J to allow CFX integration:</p><ul><li><a shape="rect" class="external-link" href="http://xerces.apache.org/xerces2-j/">Xerces</a></li><li>JAX-WS 2.0 APIs</li><li><a shape="rect" class="external-link" href="http://sourceforge.net/projects/wsdl4j" rel="nofollow">WSDL4J</a></li></ul><p>Unfortunately, these components have to be configured in different parts of OC4J.</p><h4 id="ApplicationServerSpecificConfigurationGuide-OracleOC4Jclassloading">Oracle OC4J class loading</h4><p>A key part of successfully integrating CXF into OC4J is to understand how class loaders work in OC4J. When starting OC4J there are generally three stages where customization could occur:</p><ol><li>Virtual Machine boot</li><li>OC4J boot</li><li>CXF (application) boot</li></ol><p>Customizing in the last step is <a shape="rect" class="external-link" href="http://download-uk.oracle.com/docs/cd/B25221_03/web.1013/b14433/classload.htm" rel="nofollow">quite easy to achieve</a> - basically OC4J has quite powerful class loader and an easy customization console. Unfortunately there are some components that could not be configured this way. They are configured during OC4J boot. Unfortunately one of this is OC4J webservices stack (located in <code>$ORACLE_HOME/webservices/lib</code>).</p><h4 id="ApplicationServerSpecificConfigurationGuide-Neededcomponents">Needed components</h4><p>Before start please download <a shape="rect" href="http://cxf.apache.org/download.html">Apache CXF 2.0.6 or better</a> and <a shape="rect" class="external-link" href="http://archive.apache.org/dist/xml/xerces-j/">Xerces 2.8.1</a></p><h4 id="ApplicationServerSpecificConfigurationGuide-Preparingstax-api">Preparing stax-api</h4><p>If you use a version of CXF that includes stax-api.jar that in turn include the QName class, remove <code>javax.xml.namespace.QName</code> from the stax-api shipped with CXF. Oracle apparently has it already in <code>$ORACLE_HOME/j2ee/home/lib/jax-qname-namespace.jar</code>.</p><p><span class="confluence-anchor-link" id="ApplicationServerSpecificConfigurationGuide-xerces"></span></p><h4 id="ApplicationServerSpecificConfigurationGuide-ReplacetheOracleXMLparserwithXerces">Replace the Oracle XML parser with Xerces</h4><p>The basic idea behind how to do this is described in detail <a shape="rect" class="external-link" href="http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html" rel="nofollow">here</a></p><p>Create OC4J shared library named <code>cxf.foundation</code> and fill it with:</p><ul><li>xercesImpl.jar (from Xerces distribution)</li><li>xml-apis-1.2.02.jar (from CXF-distribution)</li><li>xalan-2.7.0.jar (ditto)</li><li><p>geronimo-ws-metadata_2.0_spec-1.1.1.jar (ditto)</p><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When building Your application <strong>DO NOT INCLUDE THOSE COMPONENTS</strong> again.</p></div></div></li></ul><h4 id="ApplicationServerSpecificConfigurationGuide-GetridofOC4JJAX-WSlibraries">Get rid of OC4J JAX-WS libraries</h4><p>OC4J has <a shape="rect" href="application-server-specific-configuration-guide.html">preliminary support for JAX-WS</a>, unfortunately this means that during OC4J boot it loads <em>outdated</em> JAX-WS APIs and implementation by Oracle. This occurs even before shared libraries comes into action, at a very early stage of OC4J boot. Boot-time OC4J libraries are configured in <code>boot.xml</code> file in <code>$ORACLE_HOME/j2ee/home/oc4j.jar</code> bootstrap jar. To get rid of this:</p><ul><li>unpack <code>oc4j.jar</code> file</li><li>locate <code>META-INF/boot.xml</code> file and edit it</li><li>find section</li></ul><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;!-- WS jax-rpc --&gt;
&lt;code-source path="${oracle.home}/webservices/lib/jaxr-api.jar"/&gt;
&lt;code-source path="${oracle.home}/webservices/lib/jaxrpc-api.jar"/&gt;
&lt;code-source path="${oracle.home}/webservices/lib/jaxb-api.jar"/&gt;
&lt;code-source path="${oracle.home}/webservices/lib/saaj-api.jar"/&gt;
&lt;code-source path="${oracle.home}/webservices/lib/jws-api.jar" if="java.specification.version == /1\.[5-6]/"/&gt;
</pre>
</div></div><p>and comment out line which include <code>jws-api.jar</code> entry, like below</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;!-- &lt;code-source path="${oracle.home}/webservices/lib/jws-api.jar" if="java.specification.version == /1\.[5-6]/"/&gt; --&gt;
</pre>
</div></div><ul><li>repackage <code>oc4j.jar</code> (don't forget about <code>MANIFEST.MF</code> - use <code>jar -m META-INF/MANIFEST.MF</code>)</li></ul><p><span class="confluence-anchor-link" id="ApplicationServerSpecificConfigurationGuide-wsdl4j"></span></p><h4 id="ApplicationServerSpecificConfigurationGuide-swappingOraclewsdl.jarwithwsdl4j.jarandjaxb.jarAPIwithjaxb-api-2.0.jar">swapping Oracle <code>wsdl.jar</code> with <code>wsdl4j.jar</code> and <code>jaxb.jar</code> API with <code>jaxb-api-2.0.jar</code></h4><p>Additionally Oracle provides it's own implementation of WSDL functionality which conflicts with <code>wsdl4j.jar</code>. To get rid of this add <code>-Xbootclasspath/p:"&lt;path to wsdlj&gt;/wsdl4j-1.6.1.jar;&lt;path to jaxb2&gt;/jaxb-api-2.0.jar"</code> option to JVM parametrs (either in command line running OC4J standalone or in OPMN).</p><h4 id="ApplicationServerSpecificConfigurationGuide-Deployingapplications">Deploying applications</h4><p>When deploying please follow those steps:</p><ul><li>Edit deployment plan</li><li>Edit <code>Configure class loading</code> in the deployment plan like described <a shape="rect" class="external-link" href="http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html" rel="nofollow">here</a></li><li><strong>Uncheck</strong> <code><strong>oracle.xml</strong></code> library</li><li><strong>Check</strong> <code><strong>cxf.foundation</strong></code> library</li><li><strong>Uncheck</strong> <code><strong>Search Local Classes First</strong></code></li><li><p>do not include <code>xercesImpl</code>, <code>xml-apis</code>, <code>xalan</code> and <code>geronimo-ws-metadata_2.0_spec-1.1.1.jar</code> in <code>war</code> - those will be automatically loaded by by OC4J Shared Libraries class loader.</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>You can automate above steps by packaging You <code>war</code> into <code>ear</code> archive (even though) if it's only <code>war</code> and providing <code>orion-application.xml</code> proprietary descriptor as described <a shape="rect" class="external-link" href="http://download-west.oracle.com/docs/cd/B32110_01/web.1013/b28952/classload.htm#CIHIHDEG" rel="nofollow">here</a>. You could also provide proprietary <code>orion-web.xml</code> in Your <code>war</code> instrumenting <code>Search Local Classes First</code> attribute described above. This step is described <a shape="rect" class="external-link" href="http://www.oracle.com/technology/tech/java/oc4j/htdocs/how-to-servlet-sysclassloader.html" rel="nofollow">here</a>.</p></div></div></li></ul><h4 id="ApplicationServerSpecificConfigurationGuide-OracleFAQ">Oracle FAQ</h4><h5 id="ApplicationServerSpecificConfigurationGuide-I'mgettingjava.lang.ClassCastException:org.apache.xerces.jaxp.DocumentBuilderFactoryImpl">I'm getting <code>java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</code></h5><p>This primarily happens when:</p><ul><li>xerces is loaded twice - by shared library class loader and application class loader</li><li>or when there is mismatch between <code>xerces</code> and <code>oracle</code> implementation of SAX API</li></ul><p>Please be sure You properly installed and enabled for Your application <code>cxf.foundation</code> shared library as described <a shape="rect" href="application-server-specific-configuration-guide.html">here</a>. If Yes please be sure that You didn't include xercesImpl.jar in Your <code>war</code>. If You still have problems please <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()" rel="nofollow">see how You can debug JAXP problems</a> - be sure that <code>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</code> are instantiated from within <code>JAXP</code> and not <code>oracle.xml.parser.v2.DocumentBuilder</code>.</p><p><span class="confluence-anchor-link" id="ApplicationServerSpecificConfigurationGuide-f2"></span></p><h5 id="ApplicationServerSpecificConfigurationGuide-IcannotgetWSDL(gettingHTTP500accesingmyCXFserviceWSDLwithhttp://myshot/myservice?wsdl)">I cannot get WSDL (getting HTTP 500 accesing my CXF service WSDL with <a shape="rect" class="external-link" href="http://myshot/myservice?wsdl" rel="nofollow">http://myshot/myservice?wsdl</a>)</h5><p>Please be sure that <code>wsdl4j.jar</code> is loaded before <code>wsdl.jar</code> as described <a shape="rect" href="application-server-specific-configuration-guide.html">here</a></p><h5 id="ApplicationServerSpecificConfigurationGuide-I'mgettingjava.lang.NoSuchMethodException:oracle.j2ee.ws.wsdl.extensions.soap.SOAPBodyImpl.getElementType()">I'm getting <code>java.lang.NoSuchMethodException: oracle.j2ee.ws.wsdl.extensions.soap.SOAPBodyImpl.getElementType()</code></h5><p><a shape="rect" href="application-server-specific-configuration-guide.html">See this</a></p><h5 id="ApplicationServerSpecificConfigurationGuide-Icannotgetittoworkstill">I cannot get it to work still</h5><p>Try something simple. Download OC4J standalone and bootstrap it from command line directly: <code>java [options] -jar oc4j.jar</code>. Enable <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()" rel="nofollow">SAX debugging</a>. Be sure You don't include douplicated jars in Your application like <code>xercesImpl, xalan, xml-apis and geronimo-ws-metadata_2.0_spec-1.1.1.jar</code>. Review steps above once more. It works <img class="emoticon emoticon-wink" src="https://cwiki.apache.org/confluence/s/9h3cbz/8703/189cb2l/_/images/icons/emoticons/wink.svg" data-emoticon-name="wink" alt="(wink)"> .</p><h2 id="ApplicationServerSpecificConfigurationGuide-IntegrationwithApplicationServerFAQ">Integration with Application Server FAQ</h2><p>1.<br clear="none"> Q: I have this error: javax.xml.ws.WebServiceException: Cannot create SAAJ factory instance.<br clear="none"> A: Please make sure you have the saaj-impl-1.3.jar in the classpath and make sure your app picks up this one instead of weblogic one.</p><h2 id="ApplicationServerSpecificConfigurationGuide-Resources">Resources</h2><p><a shape="rect" class="external-link" href="http://download-uk.oracle.com/docs/cd/B25221_03/web.1013/b14433/classload.htm" rel="nofollow">Utilizing the OC4J Class Loading Framework</a><br clear="none"> <a shape="rect" class="external-link" href="http://xfire.codehaus.org/XFire+on+WebLogic+9.2" rel="nofollow">Deploy XFire in WebLogic</a><br clear="none"> <a shape="rect" class="external-link" href="http://edocs.bea.com/wls/docs92/programming/classloading.html" rel="nofollow">Understanding WebLogic ClassLoader</a><br clear="none"> <a shape="rect" class="external-link" href="http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration" rel="nofollow">JBoss Class Configuration</a><br clear="none"> <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()" rel="nofollow">Troubleshooting SAX</a></p></div>
</div>
<!-- Content -->
</td>
</tr>
</table>
</td>
<td id="cell-2-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-3-0">&nbsp;</td>
<td id="cell-3-1">&nbsp;</td>
<td id="cell-3-2">
<div id="footer">
<!-- Footer -->
<div id="site-footer">
<a href="http://cxf.apache.org/privacy-policy.html">Privacy Policy</a> -
(<a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=68526">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=68526&amp;showComments=true&amp;showCommentArea=true#addcomment">add comment</a>)<br>
Apache CXF, CXF, Apache, the Apache feather logo are trademarks of The Apache Software Foundation.<br>
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
<!-- Footer -->
</div>
</td>
<td id="cell-3-3">&nbsp;</td>
<td id="cell-3-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-4-0" colspan="2">&nbsp;</td>
<td id="cell-4-1">&nbsp;</td>
<td id="cell-4-2" colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-4458903-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>