You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Venu Gogineni <ve...@gmail.com> on 2007/12/05 05:39:48 UTC

CXF 2.0.2 + Spring 2.0 - ArrayList error - Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Unmarshalling Error : Unable to create an instance

I am using a complex nested object and ArrayList attributes. When I try to
get object from my client(JUnit)  I am getting unmarshall exception. If I
don't populate ArrayList attribute(null), everything works fine. I couldn't
make it work with ArrayList attribute. Any idea? 

Here is the snippet of code...

Services:
--------

@WebService
public interface TestWebService {	
	
	public ComplexObject getComplexObject(@WebParam(name="id") Long id);

}



public class ComplexObject extends AbstractPOJO {

  private String name;
  
  
  
  private List<Phone> phones;
  
  private List<Address> addresses;

}


@WebService(endpointInterface = "com.test.service.TestWebService")
public class TestWebServiceImpl implements TestWebService {

	public ComplexObject getComplexObject(@WebParam(name="id") Long id) {
	
		// returns ComplexObject
	
	}

}


<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jaxws="http://cxf.apache.org/jaxws"
      xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">






	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
	
	  
	<bean id="test" class="com.test.service.impl.TestWebServiceImpl">
		
	</bean>
	
  	<jaxws:endpoint id="testWebService" implementor="#test"
address="/TestWebService" />
  	
  	
	  
</beans>	



Client Code(JUnit):
-----------------


<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">

    <bean id="client" class="com.test.service.TestWebService" 
      factory-bean="clientFactory" factory-method="create"/>
    
	<bean id="clientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
	  <property name="serviceClass" value="com.test.service.TestWebService"/>
	  <property name="address"
value="http://localhost:8080/TestServices/TestWebService"/>
	</bean>
	  
</beans>


public void testGetComplexObject() throws Exception {		
		
		
		ComplexObject object = 
			testWebService.getComplexObject(new Long("1"));
}
		
-- 
View this message in context: http://www.nabble.com/CXF-2.0.2-%2B-Spring-2.0---ArrayList-error---Interceptor-has-thrown-exception%2C-unwinding-now-org.apache.cxf.interceptor.Fault%3A-Unmarshalling-Error-%3A-Unable-to-create-an-instance-tf4947427.html#a14165199
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF 2.0.2 + Spring 2.0 - ArrayList error - Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Unmarshalling Error : Unable to create an instance

Posted by woostreet <vm...@gmail.com>.
Have you chose a binding method. It looks like complex object is properly
annotated with JAXB that is why it is not working. Also keep in mind that
JAXB does not support interfaces and superclasses.


Venu Gogineni wrote:
> 
> I am using a complex nested object and ArrayList attributes. When I try to
> get object from my client(JUnit)  I am getting unmarshall exception. If I
> don't populate ArrayList attribute(null), everything works fine. I
> couldn't make it work with ArrayList attribute. Any idea? 
> 
> Here is the snippet of code...
> 
> Services:
> --------
> 
> @WebService
> public interface TestWebService {	
> 	
> 	public ComplexObject getComplexObject(@WebParam(name="id") Long id);
> 
> }
> 
> 
> 
> public class ComplexObject extends AbstractPOJO {
> 
>   private String name;
>   
>   
>   
>   private List<Phone> phones;
>   
>   private List<Address> addresses;
> 
> }
> 
> 
> @WebService(endpointInterface = "com.test.service.TestWebService")
> public class TestWebServiceImpl implements TestWebService {
> 
> 	public ComplexObject getComplexObject(@WebParam(name="id") Long id) {
> 	
> 		// returns ComplexObject
> 	
> 	}
> 
> }
> 
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:jaxws="http://cxf.apache.org/jaxws"
>       xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 
> 
> 
> 
> 
> 
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 	
> 	  
> 	<bean id="test" class="com.test.service.impl.TestWebServiceImpl">
> 		
> 	</bean>
> 	
>   	<jaxws:endpoint id="testWebService" implementor="#test"
> address="/TestWebService" />
>   	
>   	
> 	  
> </beans>	
> 
> 
> 
> Client Code(JUnit):
> -----------------
> 
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
> 
>     <bean id="client" class="com.test.service.TestWebService" 
>       factory-bean="clientFactory" factory-method="create"/>
>     
> 	<bean id="clientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
> 	  <property name="serviceClass" value="com.test.service.TestWebService"/>
> 	  <property name="address"
> value="http://localhost:8080/TestServices/TestWebService"/>
> 	</bean>
> 	  
> </beans>
> 
> 
> public void testGetComplexObject() throws Exception {		
> 		
> 		
> 		ComplexObject object = 
> 			testWebService.getComplexObject(new Long("1"));
> }
> 		
> 

-- 
View this message in context: http://www.nabble.com/CXF-2.0.2-%2B-Spring-2.0---ArrayList-error---Interceptor-has-thrown-exception%2C-unwinding-now-org.apache.cxf.interceptor.Fault%3A-Unmarshalling-Error-%3A-Unable-to-create-an-instance-tf4947427.html#a14206017
Sent from the cxf-user mailing list archive at Nabble.com.