WebSphere
IncompatibleClassChangeError when deploying Axis 1.2-RC3 on WebSphere 5.1 with PARENT_FIRST classloading
I am deploying Axis 1.2RC3 in a war that resides within an ear. The axis jars are in the war/WEB-INF/lib dir. For various reasons related to the other contents of my ear, I must use PARENT_FIRST classloading. As many have reported, if you have PARENT_FIRST classloading on WebSphere 5.1 with Axis 1.2RC3, then there is a conflict between the version of saaj (1.1) that ships with WebSphere, and the version of saaj (1.2) that Axis 1.2RC3 expects, and you get the following exception:
java.lang.IncompatibleClassChangeError: class org.apache.axis.SOAPPart does not implement interface org.w3c.dom.Document
This issue can be resolved with PARENT_LAST classloading and a manifest which specifies the classpath…but for those of use who can’t use PARENT_LAST classloading, there is another option.
It appears that a single source code change to Axis will eliminate the issue altogether. The offending code is in org.apache.axis.message.MessageElement.addTextNode(), and can be patched as follows:
OLD CODE:
public SOAPElement addTextNode(String s) throws SOAPException {
try {
Text text = getOwnerDocument().createTextNode(s);
((org.apache.axis.message.Text)text).setParentElement(this);
return this;
} catch (ClassCastException e) {
throw new SOAPException(e);
}
}
PATCHED CODE:
public SOAPElement addTextNode(String s) throws SOAPException {
try {
Text text = new org.apache.axis.message.Text(s);
this.appendChild(text);
return this;
} catch (ClassCastException e) {
throw new SOAPException(e);
}
After making this change, Axis 1.2RC3 will run on WebSphere 5.1 with PARENT_FIRST classloading, and no exceptions will be thrown.
That’s it. Hope this helps.
Recent Posts
- Siri – a Shot Across Google’s Bow
- “Is colocation cheaper than using a cloud computing service to run the same workload?”
- “How Big is Amazon’s Cloud Computing Business?”
- “Android will run majority of smartphones by Spring”
- Amazon EC2 I/O Performance: Local Ephemeral Disks vs. RAID 0 Striped EBS Volumes
- “We create 5 exabytes every two days.”
- “Go Screw Yourself, Apple.”
- “You are not Google. (or: you don’t really need NoSQL…)”
- “The largest cloud providers are botnets.”
- Observed Performance of Amazon EC2 Instances
- Cloud Computing and Mobile Devices
- Time and Clock Issues in Windows-Based EC2 Instances
- My experimental local and real-time search engine is now available
- Entropy in Cloud Computing Applications
- How to Jailbreak iPhone 3.01