Can you provide a test case please ?
Unmarshalling a payload into an explicit collection is tested in CXF JAX-RS system tests but I need to have a test available to investigate further.
Can you also try CXF 2.7.14 ? The issue may have been fixed there
Cheers, Sergey



On 30/12/14 21:20, criedluv wrote:
I'm using:

CXF: 2.7.12
Spring: 3.2.5.RELEASE
JAXB
JAXWS/JAXRS

I'm getting the above error in my JAXRS prototype endpoint method
implementation because the method argument, List<Customer> is instead
unmarshalled to  List<ElementNSImpl>. I get the exception when accessing a
member of the List.

When running JAXWS to the same method all is well.

I have a large number of interface methods in my target project with
implementations supporting JAXWS just fine. I'm adding JAXRS support. I want
to make sure I use the right approach the first time.

Do I need to provide additional jaxb-provider configuration for each method
using input and/or output collections? If so, that's a lot of additional
configuration. Can you please point me to the best example?

Here is my prototype JAXWS / JAXRS config:


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

      <import resource="classpath:META-INF/cxf/cxf.xml" />

      <jaxrs:server address="/jaxrs"

modelRef="classpath:/data/model/CustomerService-jaxrs.xml">
        <jaxrs:serviceBeans>
          <ref bean="customer-bean"/>
        </jaxrs:serviceBeans>
        <jaxrs:providers>
          <ref bean="jaxb-provider"/>
          <bean class="service.description.NoCustomerExceptionMapper"/>
        </jaxrs:providers>                
      </jaxrs:server>

      <bean id="jaxb-provider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
         <property name="unmarshallAsJaxbElement" value="true"/>
         <property name="marshallAsJaxbElement" value="true"/>
      </bean>

      <jaxws:endpoint implementor="#customer-bean" address="/jaxws"/>

      <bean id="customer-bean"
class="service.description.CustomerServiceImpl"/>
</beans>



thanks in advance.






--
View this message in context: 
http://cxf.547215.n5.nabble.com/java-lang-ClassCastException-com-sun-org-apache-xerces-internal-dom-ElementNSImpl-cannot-be-cast-to-X-tp5752756.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to