ClassCastException when attempting to start a Web services application
 Technote (troubleshooting)
 
Problem(Abstract)
You could see the following exception when trying to start a Web services application:


[4/19/05 10:05:40:980 EDT] 44d990 XMLUtils E com.ibm.ws.webservices.engine.utils.XMLUtils WSWS3227E: Error: Exception:
[4/19/05 10:05:40:992 EDT] 44d990 XMLUtils E com.ibm.ws.webservices.engine.utils.XMLUtils TRAS0014I: The following exception was logged java.lang.ClassCastException: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at com.ibm.ws.webservices.engine.utils.XMLUtils.getDOMFactory(XMLUtils.java:364)
at com.ibm.ws.webservices.engine.utils.XMLUtils.<clinit>(XMLUtils.java:130)
at com.ibm.ws.webservices.tools.WSDLQuery.parse(WSDLQuery.java:140)
 
Cause
At the root of this problem is a conflict between the classes packaged in the Web services application ear and the classloader policy used by the Web Services engine. By design, the Web Services engine will use the application classloader to find its classes.

In this scenario, when parsing xml files, the Web Services engine expects to use the xml parsers (xerces/xalan) shipped with IBM® WebSphere® Application Server. However, the Web services application ear has also packaged xerces/xalan for its own custom use which results in the Web Services engine to load the application xerces/xalan classes instead of the expected Application Server classes. As a result, the application receives the ClassCastException during parsing.

 
Resolving the problem
The only circumvention at this time is to not package parsers(xerces/xalan) within the Web service application ear.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Web Services (for example: SOAP or UDDI or WSGW or WSIF)
Operating system(s): Windows
Software version: 5.1.1.4
Software edition:
Reference #: 1204363
IBM Group: Software Group
Modified date: Apr 22, 2005