Thursday 4 June 2009

Spring Web Services - Deploying to WAS 6.1


If like me you've ever tried to deploy a Spring web service, that auto generates the WSDL, to WebSphere Application Server you've probably encoutered the same WSDLException that I have:
Caused by: WSDLException: faultCode=CONFIGURATION_ERROR: No Java extensionType found to represent a '{http://www.w3.org/2001/XMLSchema}schema' element in the context of a 'javax.wsdl.Types'.:
at javax.wsdl.extensions.ExtensionRegistry.createExtension(Unknown Source)
at org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.addTypes(InliningXsdSchemaTypesProvider.java:102)
at org.springframework.ws.wsdl.wsdl11.ProviderBasedWsdl4jDefinition.afterPropertiesSet(ProviderBasedWsdl4jDefinition.java:233)
at org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition.afterPropertiesSet(DefaultWsdl11Definition.java:170)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)

This is basically down to IBM's JDK shipping with old versions of WSDL4J, Xalan and Xerces and also has other side effects detailed in the following posts:
http://jira.springframework.org/browse/SWS-35
http://forum.springsource.org/archive/index.php/t-26464.html
http://forum.springsource.org/showthread.php?t=53734

There seem to be many suggestions on how to solve this problem from setting environment variables to copying the correct version of the jars to lib/ext directory of the
WAS install but the best solution I've come across is to put the correct jars in the WEB-INF/lib directory of the web application and change the classloader mode to PARENT_LAST and WAR classloader policy to APPLICATION in the EAR's deployment descriptor.


One thing to note is that changing these settings just at the EAR level is not sufficient, you need to change them at the WAR level. This has the effect of telling your web application to locate classes using the WAR classloader first (WEB-INF/lib), if it cant find them then delegate to the EAR classloader and finally to the WASext classloader until they are found.

Search This Blog