java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to com.sun

View: New views
3 Messages — Rating Filter:   Alert me  

java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to com.sun

by RichardCromer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings,

I have written a small web service client using JWSP 2.0 and am now trying to run it.  When I do I get the message:

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
          at com.sun.xml.rpc.client.StubBase._postSendingHook(StubBase.java:231)
          at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)
          at staticstub.ServicePortType_Stub.sayHello(Unknown Source)
          at staticstub.HelloClient.main(Unknown Source)

I looked on the web for this problem and it seems there is a bug in the way the JDK 1.6(which is the SDK I am using) and JAX-RPC communicate through MessageImpl.  Based on some workaround recommendation, I made sure the jaxrpc saaj-impl.jar appeared first in my classpath but that did NOT make a difference.   I also downloaded the latest saaj jar files (-impl and -api) and still nothing.

I am relatively new to this and really don't know how to debug these problems.  Can anyone help me with a workaround, or better yet, a solution.  Please provide details.


My Environment:

Windows XP, SP2
JDK 1.6
JWSP 2.0

Java IDE's installed:
Netbeans 5.5


Re: java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to com.sun

by kumarjayanti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

  If you are using JDK 1.6 then you will have to download the latest
SAAJ RI from the following link : https://saaj.dev.java.net/
  that should fix your classcast exception.

thanks.


RichardCromer wrote:

>Greetings,
>
>I have written a small web service client using JWSP 2.0 and am now trying
>to run it.  When I do I get the message:
>
>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
>          at
>com.sun.xml.rpc.client.StubBase._postSendingHook(StubBase.java:231)
>          at
>com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)
>          at staticstub.ServicePortType_Stub.sayHello(Unknown Source)
>          at staticstub.HelloClient.main(Unknown Source)
>
>I looked on the web for this problem and it seems there is a bug in the way
>the JDK 1.6(which is the SDK I am using) and JAX-RPC communicate through
>MessageImpl.  Based on some workaround recommendation, I made sure the
>jaxrpc saaj-impl.jar appeared first in my classpath but that did NOT make a
>difference.  
>
>I am relatively new to this and really don't know how to debug these
>problems.  Can anyone help me with a workaround, or better yet, a solution.
>Please provide details.
>
>
>My Environment:
>
>Windows XP, SP2
>JDK 1.6
>JWSP 2.0
>
>Java IDE's installed:
>Netbeans 5.5
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to com.sun

by phoneynk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I faced similar problem and find the solution on

http://blogs.sun.com/fintanr/entry/saaj_classcast_error_with_jdk

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

-Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl

which eliminates the problem, but may have implications for other aspects of your application, so use with caution.

RichardCromer wrote:
Greetings,

I have written a small web service client using JWSP 2.0 and am now trying to run it.  When I do I get the message:

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
          at com.sun.xml.rpc.client.StubBase._postSendingHook(StubBase.java:231)
          at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)
          at staticstub.ServicePortType_Stub.sayHello(Unknown Source)
          at staticstub.HelloClient.main(Unknown Source)

I looked on the web for this problem and it seems there is a bug in the way the JDK 1.6(which is the SDK I am using) and JAX-RPC communicate through MessageImpl.  Based on some workaround recommendation, I made sure the jaxrpc saaj-impl.jar appeared first in my classpath but that did NOT make a difference.   I also downloaded the latest saaj jar files (-impl and -api) and still nothing.

I am relatively new to this and really don't know how to debug these problems.  Can anyone help me with a workaround, or better yet, a solution.  Please provide details.


My Environment:

Windows XP, SP2
JDK 1.6
JWSP 2.0

Java IDE's installed:
Netbeans 5.5