SAAJ ClassCast Error with JDK 6
A project I'm working on at the moment has an authentication component which uses a webservice to do most of the work. During the development I stumbled across an issue, which while appearing to be known, is not well documented in any place, so in case anyone else hits this ....
Software Environment
The key part here is the JDK version, from what I can discern after doing some searching
all 1.6 JDK's have this issue, for the example here I'm using the 1.6.0_06 JDK(services & support), as bundled
with Solaris Nevada (snv_97)(services & support), either Tomcat 6 or Glassfish 3 for the app server, and Netbeans 6.5 as the IDE. Our webservice in this case was generated using wscompile as bundled with Appserver 9.1(services & support).
Stacktrace
The stacktrace that we are getting here (from Tomcat in this case, but the appserver is not important here)
is
org.apache.jasper.JasperException: java.lang.ClassCastException:
com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot
be cast to com.sun.xml.messaging.saaj.soap.MessageImpl
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl
cannot be cast to com.sun.xml.messaging.saaj.soap.MessageImpl
com.sun.xml.rpc.client.StubBase._postSendingHook(StubBase.java:231)
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)
.............
Whats actually going on here (and if anyone has corrections please feel free to provide them,
this is not an area I've spent time reading into) is that the saaj classes that you would have
used before from the webservices development packs are now present in the 1.6 jdks rt.jar, and
we have a conflict between what is expected by the webservice and what we have.
Workarounds
A couple of workarounds exist, namely things I really don't like as the vary from environment to
environment e.g. placing endorsed libs in place. A more generic workaround is to add an extra startup option of
which eliminates the problem, but may have implications for other aspects of your application, so
use with caution.
(2008-09-09 06:35:11.0)Permalink
Wednesday September 03, 2008
Amazons EBS
Werner Vogels (Amazon's CTO) has a nice post about Amazons Elastic Block Store. Well worth a read. Combined with the recently launched OpenSolaris AMI Catalogs this could be really interesting.
And into the mix you can add our developer and support services for OpenSolaris and MySQL - what more could you ask for if EC2 is in your plans.
(2008-09-03 06:46:46.0)Permalink