You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by amber <am...@hotmail.fr> on 2011/01/21 09:12:03 UTC

openEJB and Jax-ws

Hi,
I have a web-service that return a collection (ArrayList) of DTO objects. It
works fine when deployed under JBoss 5.1 (soapUI works fine too)

But Junit (with OpenEJB) fail on the webService test with a Java cast error
: “java.lang.ClassCastException: [Lcom.foo.test.myObjectDTO; cannot be cast
to java.util.Collection”

If I change the code to return an array (myObjectDTO[]) the test is ok with
Junit (and still soapUI).

Any idea? Why I can return an arrayList under JBOss and not under
Junit/OpenEJB ?

-- 
View this message in context: http://openejb.979440.n4.nabble.com/openEJB-and-Jax-ws-tp3229118p3229118.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: openEJB and Jax-ws

Posted by amber <am...@hotmail.fr>.
Hi,

the client side is OpenEJB/Junit (I run the test from Eclipse). The other
client is SoapUI 3.5.1

That's strange because before upgrading to OpenEJB 3.1.4 and Maven 3, the
same test worked fine. Maybe I should have a look to my Maven's
dependencies? 

Here they are (extract) :


			
			<dependency>
				<groupId>com.sun.xml.ws</groupId>
				<artifactId>jaxws-rt</artifactId>
				<version>2.2</version>
			</dependency>

			<dependency>
				<groupId>com.sun.xml.ws</groupId>
				<artifactId>policy</artifactId>
				<version>2.2</version>
			</dependency>


			<dependency>
				<groupId>javax.jws</groupId>
				<artifactId>jsr181-api</artifactId>
				<version>1.0-MR1</version>
			</dependency>


			<dependency>
				<groupId>org.apache.openejb</groupId>
				<artifactId>javaee-api</artifactId>
				<version>5.0-3</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>org.apache.openejb</groupId>
				<artifactId>openejb-cxf</artifactId>
				<version>3.1.4</version>
				<scope>test</scope>
			</dependency>

			<dependency>
				<groupId>org.apache.openejb</groupId>
				<artifactId>openejb-javaagent</artifactId>
				<version>3.1.4</version>
			</dependency>

			<dependency>
				<groupId>org.apache.openejb</groupId>
				<artifactId>openejb-core</artifactId>
				<version>3.1.4</version>
				<scope>test</scope>
			</dependency>


		<build>
		<plugins>
			<!--
				this configures the surefire plugin to run your tests with the
				javaagent enabled
			-->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<forkMode>pertest</forkMode>
				
<argLine>-javaagent:${basedir}/target/openejb-javaagent-3.1.4.jar</argLine>
					<workingDirectory>${basedir}/target</workingDirectory>
				</configuration>
			</plugin>

			<!--
				this tells maven to copy the openejb-javaagent jar into your target/
				directory
			-->
			<!-- where surefire can see it -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.apache.openejb</groupId>
									<artifactId>openejb-javaagent</artifactId>
									<outputDirectory>${project.build.directory}</outputDirectory>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

It's not easy to extract a short exemple from our whole solution (multi
maven projects) :(

Anyway I will stay in array as you said!

-- 
View this message in context: http://openejb.979440.n4.nabble.com/openEJB-and-Jax-ws-tp3229118p3229554.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: openEJB and Jax-ws

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Hi,

To increase interoperability, you should definitely switch to an array.
Anyway, OpenEJB relies on CXF to support JAX-WS. Do you also use CXF
(OpenEJB) in the client side?
JBoss AS probably relies on another JAX-WS stack that's why you could not
get the same behavior.

Do you have a simple test case to provide?
We can have a look deeper if you want.

Jean-Louis




2011/1/21 amber <am...@hotmail.fr>

>
> Hi,
> I have a web-service that return a collection (ArrayList) of DTO objects.
> It
> works fine when deployed under JBoss 5.1 (soapUI works fine too)
>
> But Junit (with OpenEJB) fail on the webService test with a Java cast error
> : “java.lang.ClassCastException: [Lcom.foo.test.myObjectDTO; cannot be cast
> to java.util.Collection”
>
> If I change the code to return an array (myObjectDTO[]) the test is ok with
> Junit (and still soapUI).
>
> Any idea? Why I can return an arrayList under JBOss and not under
> Junit/OpenEJB ?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/openEJB-and-Jax-ws-tp3229118p3229118.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>