Link to home
Start Free TrialLog in
Avatar of numtech
numtech

asked on

SOAP impl error in Java 6

Hello,
I am making a J2SE client which can communicate with J2EE Server using webservices.
but when running my client i have this error:
com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to com.sun.xml.messaging.saaj.soap.MessageImpl

Open in new window


Apparently its a bug in SAAj-impl in java 6 (but i am using java7 with Java6 compatibility in my Eclipse) :
http://java.net/jira/browse/SAAJ-19

So i have change my pom.xml like this:
		<dependency>
			<groupId>com.sun.xml.rpc</groupId>
			<artifactId>jaxrpc-impl</artifactId>
			<version>1.1.3_01</version>
		</dependency>
		<dependency>
			<groupId>javax.activation</groupId>
			<artifactId>activation</artifactId>
			<version>1.1.1</version>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.messaging.saaj</groupId>
			<artifactId>saaj-impl</artifactId>
			<version>1.3</version>
		</dependency>

		<dependency>
			<groupId>javax.mail</groupId>
			<artifactId>mail</artifactId>
			<version>1.4.1</version>
		</dependency>

Open in new window


But i doesn't solved the problem. Maybe the buged saaj-impl is still used.
How can i desactivate the wrong saaj-impl and forced to use saaj-impl 1.3?

thanks
Avatar of sweetfa2
sweetfa2
Flag of Australia image

Copy the META-INF/services directory from saaj-impl.jar into your client jar file.
Avatar of numtech
numtech

ASKER

I am using maven to build my Jar, so i am not sure i can make that. Thus, when i am running TestCase my jar is not yet build so it doesn't solved the entire problem
In your maven project if you have a standard maven structure your will have a src/resources/main directory.

Add the META-INF directory at that point.  Your eclipse program will pick it up automagically.
Avatar of numtech

ASKER

Ok,
but in the first post you say "coy META-INF/services" but there is no services directory in the META-INF directory, only MANIFEST.MF file containing:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_05-b05 (Sun Microsystems Inc.)
Specification-Title: SOAP with Attachments API for Java
Specification-Version: 1.3
Implementation-Title: SAAJ Implementation
Implementation-Version: 1.3
Implementation-Vendor: Sun Microsystems Inc
Implementation-Vendor-Id: com.sun
Extension-Name: com.sun.xml.messaging.saaj
Class-Path: saaj-api.jar activation.jar

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of numtech
numtech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of numtech

ASKER

Nobody solved the problem so i remove the problem instead of solving it