Application Server Specific Configuration GuidePage edited by Glen Mazza
Comment:
Clarified the WebSphere deployment instructions.
Changes (15)
Full ContentThis document provides app server-specific configuration information for running Apache CXF.
JBossIf you package the war in the ear, you might need to add the jboss specific file (jboss-app.xml) in the $EAR/META-INF folder to config the classloader. <?xml version="1.0" encoding="UTF-8"?> <jboss-app> <loader-repository> apache.cxf:loader=spring_http.ear <loader-repository-config> java2ParentDelegation=false </loader-repository-config> </loader-repository> </jboss-app> If you are coming across LinkageErrors involving the QName class, try repackaging the stax-api jar without the javax.xml.namespace.QName class. (In JBoss 4.0.5GA at least) a conflicting version of this class is included in JBoss's lib and lib/endorsed directories. This was the only way I could get CXF working in my environment.
Pack war in an ear, deploy the ear with weblogic-application.xml
The prefer-application-packages element you see above sets up WebLogic's Filtering Classloader. 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. Also note you can, and may need to, specify other options in the weblogic-application.xml file such as XML processing factories as shown here. See the WebLogic guide for more information.
WebsphereFor WebSphere Versions < 6.1.0.29Adding jars to the 'endorsed' folder appears to be the main solution: No Web Services Feature Pack for WebSphere installedput jar in the endorsed folder
And then restart the Websphere server. (Because we changed the endorsed folder, we need to restart it to make it take effect).
Add your own class loaderIf 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. Step by step
Tested in WAS 6.1 only but should work in earlier versions as well. Another user running WS6.1 FP 23 without the web services feature pack came up with this solution that seemed to work for them:
Web Services Feature Pack for WebSphere InstalledThings 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. Up to fixpack 27 (6.1.0.27) there was no possibility to disable the WebSphere Web Services engine. For WebSphere 6.1.0.29+, V7 and V8Follow the PDF download given within this IBM developerWorks article: http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html 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. To disable for the whole JVM, set the JVM property com.ibm.websphere.webservices.DisableIBMJAXWSEngine=true or to disable the engine just for a specific module by adding DisableIBMJAXWSEngine: true to WAR/META-INF/MANIFEST.MF. GlassfishCXF 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: <?xml version="1.0" encoding="UTF-8"?> <!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'> <sun-web-app> <class-loader delegate="false"/> </sun-web-app> OC4J
DisclaimerThis 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 fully JEE 5.0 certified stack and comes with their own JAX-WS implementation. BackgroundOracle 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).
Configuration overviewA few components need to be customized in OC4J to allow CFX integration: Unfortunately, these components have to be configured in different parts of OC4J. Oracle OC4J class loadingA 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:
Customizing in the last step is quite easy to achieve - 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 $ORACLE_HOME/webservices/lib). Needed componentsBefore start please download Apache CXF 2.0.6 or better and Xerces 2.8.1 Preparing stax-apiIf you use a version of CXF that includes stax-api.jar that in turn include the QName class, remove javax.xml.namespace.QName from the stax-api shipped with CXF. Oracle apparently has it already in $ORACLE_HOME/j2ee/home/lib/jax-qname-namespace.jar. Replace the Oracle XML parser with XercesThe basic idea behind how to do this is described in detail here Create OC4J shared library named cxf.foundation and fill it with:
Get rid of OC4J JAX-WS librariesOC4J has preliminary support for JAX-WS, unfortunately this means that during OC4J boot it loads outdated 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 boot.xml file in $ORACLE_HOME/j2ee/home/oc4j.jar bootstrap jar. To get rid of this:
<!-- WS jax-rpc --> <code-source path="${oracle.home}/webservices/lib/jaxr-api.jar"/> <code-source path="${oracle.home}/webservices/lib/jaxrpc-api.jar"/> <code-source path="${oracle.home}/webservices/lib/jaxb-api.jar"/> <code-source path="${oracle.home}/webservices/lib/saaj-api.jar"/> <code-source path="${oracle.home}/webservices/lib/jws-api.jar" if="java.specification.version == /1\.[5-6]/"/> and comment out line which include jws-api.jar entry, like below
<!-- <code-source path="${oracle.home}/webservices/lib/jws-api.jar" if="java.specification.version == /1\.[5-6]/"/> -->
swapping Oracle wsdl.jar with wsdl4j.jar and jaxb.jar API with jaxb-api-2.0.jarAdditionally Oracle provides it's own implementation of WSDL functionality which conflicts with wsdl4j.jar. To get rid of this add -Xbootclasspath/p:"<path to wsdlj>/wsdl4j-1.6.1.jar;<path to jaxb2>/jaxb-api-2.0.jar" option to JVM parametrs (either in command line running OC4J standalone or in OPMN). Deploying applicationsWhen deploying please follow those steps:
Oracle FAQI'm getting java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImplThis primarily happens when:
Please be sure You properly installed and enabled for Your application cxf.foundation shared library as described here. If Yes please be sure that You didn't include xercesImpl.jar in Your war. If You still have problems please see how You can debug JAXP problems - be sure that org.apache.xerces.jaxp.DocumentBuilderFactoryImpl are instantiated from within JAXP and not oracle.xml.parser.v2.DocumentBuilder. I cannot get WSDL (getting HTTP 500 accesing my CXF service WSDL with http://myshot/myservice?wsdl)Please be sure that wsdl4j.jar is loaded before wsdl.jar as described here I'm getting java.lang.NoSuchMethodException: oracle.j2ee.ws.wsdl.extensions.soap.SOAPBodyImpl.getElementType()I cannot get it to work stillTry something simple. Download OC4J standalone and bootstrap it from command line directly: java [options] -jar oc4j.jar. Enable SAX debugging. Be sure You don't include douplicated jars in Your application like xercesImpl, xalan, xml-apis and geronimo-ws-metadata_2.0_spec-1.1.1.jar. Review steps above once more. It works Integration with Application Server FAQ1. ResourcesUtilizing the OC4J Class Loading Framework
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache CXF Documentation > Application Server Specifi... confluence
- [CONF] Apache CXF Documentation > Application Server Sp... confluence
- [CONF] Apache CXF Documentation > Application Server Sp... confluence
- [CONF] Apache CXF Documentation > Application Server Sp... confluence
- [CONF] Apache CXF Documentation > Application Server Sp... confluence
