Hi Tog,

Class defined as method input para need @XmlRootElement now. Besides the GetBook.java, I also remove @XmlRootElement from Book.java, which is input para for addBook method, I also get the same exception, would you please verify it?

The reason is in CXF URIParameterInInterceptor.java, we check input paras (MessagePartInfo of cxf service model), we do type cast here, so if class has no @XmlRootElement, part.getXmlSchema() in following code will return XmlSchemaComplexType, but not XmlSchemaElement, which cause type cast exception as you see.

if ("POST".equals(method) || "PUT".equals(method)) {
            doc = IriDecoderHelper.interopolateParams(doc,
(XmlSchemaElement)part.getXmlSchema(),
                                                     schemas,
                                                     params);
       } else {
doc = IriDecoderHelper.buildDocument((XmlSchemaElement)part.getXmlSchema(),
                                                schemas,
                                                params);
       }

Cheers
Freeman


tog wrote:
Hi Freeman,

Here is my GetBook class. So I changed the @XmlRootElement by @XmlElement.
Actually I did it for the classes and only this one is causing problem.
Can you explain what is the problem in that case ?

Cheers
Tog

package com.acme.book

//import javax.xml.bind.annotation.XmlAttribute
import javax.xml.bind.annotation.XmlElement
import javax.xml.bind.annotation.XmlAccessorType
import javax.xml.bind.annotation.XmlAccessType

//@XmlRootElement(name = "Book", namespace="http://book.acme.com/";)

@XmlAccessorType(XmlAccessType.NONE)
//@XmlRootElement(name = "GetBook")
public class GetBook {
   @XmlElement
   long id
}


On 5/24/07, Freeman Fang <[EMAIL PROTECTED]> wrote:

Hi  Tog,

I believe you remove @XmlRootElement(name = "GetBook") from you
GetBook.java, right?
I can reproduce your problem by means of removing @XmlRootElement(name =
"GetBook")

I think we should support your scenario.
Other guys, any thought?

I fill a jira to track it
https://issues.apache.org/jira/browse/CXF-680
Thanks very much

Freeman


tog wrote:
> Dan
>
> I moved to trunk and get the same exception :-)
> Does the stack trace help ?
>
> Cheers
> Guillaume
>
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException:
> org.apache.ws.commons.schema.XmlSchemaComplexType
>        at
>
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams
>
> (URIParameterInInterceptor.java:129)
>        at
>
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage
>
> (URIParameterInInterceptor.java:105)
>        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> PhaseInterceptorChain.java:147)
>        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
> ChainInitiationObserver.java:63)
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(
> JettyHTTPDestination.java:220)
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(
> JettyHTTPDestination.java:180)
>        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(
> JettyHTTPHandler.java:54)
>        at org.mortbay.jetty.handler.ContextHandler.handle(
> ContextHandler.java:690)
>        at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
> ContextHandlerCollection.java:191)
>        at org.mortbay.jetty.handler.HandlerWrapper.handle(
> HandlerWrapper.java:139)
>        at org.mortbay.jetty.Server.handle(Server.java:285)
>        at org.mortbay.jetty.HttpConnection.handleRequest(
> HttpConnection.java:457)
> at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(
> HttpConnection.java:751)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
>        at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
>        at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
>        at org.mortbay.io.nio.SelectChannelEndPoint.run(
> SelectChannelEndPoint.java:329)
>        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(
> BoundedThreadPool.java:475)
> 23 mai 2007 21:35:04 sun.reflect.NativeMethodAccessorImpl invoke0
> GRAVE: EXCEPTION
> java.util.ConcurrentModificationException
>        at java.util.AbstractList$Itr.checkForComodification(
> AbstractList.java:449)
> at java.util.AbstractList$ListItr.previous(AbstractList.java:463)
>        at
>
org.apache.cxf.phase.PhaseInterceptorChain$PhaseInterceptorIterator.previous
>
> (PhaseInterceptorChain.java:438)
>        at org.apache.cxf.phase.PhaseInterceptorChain.unwind(
> PhaseInterceptorChain.java:231)
>        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> PhaseInterceptorChain.java:161)
>        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
> ChainInitiationObserver.java:63)
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(
> JettyHTTPDestination.java:220)
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(
> JettyHTTPDestination.java:180)
>        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(
> JettyHTTPHandler.java:54)
>        at org.mortbay.jetty.handler.ContextHandler.handle(
> ContextHandler.java:690)
>        at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
> ContextHandlerCollection.java:191)
>        at org.mortbay.jetty.handler.HandlerWrapper.handle(
> HandlerWrapper.java:139)
>        at org.mortbay.jetty.Server.handle(Server.java:285)
>        at org.mortbay.jetty.HttpConnection.handleRequest(
> HttpConnection.java:457)
> at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(
> HttpConnection.java:751)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
>        at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
>        at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
>        at org.mortbay.io.nio.SelectChannelEndPoint.run(
> SelectChannelEndPoint.java:329)
>        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(
> BoundedThreadPool.java:475)
>
>
> On 5/21/07, Daniel Kulp <[EMAIL PROTECTED]> wrote:
>>
>>
>> Guillaume,
>>
>> Based on that stack trace, your using an older version of the http
>> binding jar.   Code at that line changed drastically on May 2nd.    I
>> can see how the pre-May 2nd code would generate that exception, but not
>> the post May 2nd code.
>>
>> Dan
>>
>>
>> On Monday 21 May 2007 09:18, tog wrote:
>> > Me again ...
>> > Any idea what could be causing the following exception  in  a
>> > restful_http_binding  type snipplet ?
>> >
>> > Cheers
>> > Guillaume
>> >
>> > 21 mai 2007 13:53:27
>> >
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptorhandl
>> >eMessage INFO: URIParameterInterceptor handle message on path
>> > [/books/123] with content-type [null]
>> > 21 mai 2007 13:53:27 org.apache.cxf.phase.PhaseInterceptorChain
>> > doIntercept INFO: Interceptor has thrown exception, unwinding now
>> > java.lang.ClassCastException:
>> > org.apache.ws.commons.schema.XmlSchemaComplexType
>> >         at
>> >
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.merg
>> >eParams (URIParameterInInterceptor.java:122)
>> >         at
>> >
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.hand
>> >leMessage (URIParameterInInterceptor.java:103)
>> >         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
>> > PhaseInterceptorChain.java:148)
>> > at org.apache.cxf.transport.ChainInitiationObserver.onMessage
(
>> > ChainInitiationObserver.java:63)
>> >         at
>> >
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceReques
>> >t( JettyHTTPDestination.java:200)
>> >         at
>> > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(
>> > JettyHTTPDestination.java:161)
>> >         at
>> > org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(
>> > JettyHTTPHandler.java:54)
>> >         at org.mortbay.jetty.handler.ContextHandler.handle(
>> > ContextHandler.java:690)
>> > at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
>> > ContextHandlerCollection.java:191)
>> >         at org.mortbay.jetty.handler.HandlerWrapper.handle(
>> > HandlerWrapper.java:139)
>> >         at org.mortbay.jetty.Server.handle(Server.java:285)
>> >         at org.mortbay.jetty.HttpConnection.handleRequest(
>> > HttpConnection.java:457)
>> >         at
>> > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(
>> > HttpConnection.java:751)
>> >         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java
:500)
>> >         at
>> > org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at
>> > org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357) at
>> > org.mortbay.io.nio.SelectChannelEndPoint.run(
>> > SelectChannelEndPoint.java:329)
>> >         at org.mortbay.thread.BoundedThreadPool$PoolThread.run(
>> > BoundedThreadPool.java:475)
>> >
>> > On 5/17/07, tog <[EMAIL PROTECTED]> wrote:
>> > > Hiya
>> > >
>> > > I got the following exception when querying the following URL of a
>> > > modified version of the restful_http_binding sample.
>> > >
>> > > <ns1:XMLFault>
>> > >     <ns1:faultstring>
>> > > java.lang.ClassCastException :
>> > > org.apache.ws.commons.schema.XmlSchemaComplexType
>> > > </ns1:faultstring>
>> > > </ns1:XMLFault>
>> > >
>> > > The only change I made between this faulty version and a working
one
>> > > is about the GetBook class that was rewriten and compiled in
Groovy.
>> > >  The schema generated in now
>> > >
>> > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> > > <xs:schema elementFormDefault="qualified" version=" 1.0"
>> > > targetNamespace=" http://book.acme.com"; xmlns:xs="
>> > > http://www.w3.org/2001/XMLSchema";>
>> > >
>> > >   <xs:complexType name="getBook">
>> > >     <xs:sequence>
>> > >       <xs:element name="id" type="xs:long"/>
>> > >     </xs:sequence>
>> > >   </xs:complexType>
>> > > </xs:schema>
>> > >
>> > >
>> > > instead of
>> > >
>> > >
>> > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> > > <xs:schema elementFormDefault="qualified" version="1.0"
>> > > targetNamespace=" http://book.acme.com"; xmlns:tns="
>> > > http://book.acme.com"; xmlns:xs="http://www.w3.org/2001/XMLSchema ">
>> > >
>> > >   <xs:element name="GetBook" type="tns:getBook"/>
>> > >
>> > >   <xs:complexType name="getBook">
>> > >     <xs:sequence>
>> > >       <xs:element name="id" type="xs:long"/>
>> > >     </xs:sequence>
>> > >   </xs:complexType>
>> > > </xs:schema>
>> > >
>> > > would these changes lead to that error ? My feeling is *no* since I
>> > > did the same change for other classes and this did not cause the
>> > > same exception.
>> > >
>> > > Thoughts ?
>> > >
>> > > Cheers
>> > > Guillaume
>>
>> --
>> J. Daniel Kulp
>> Principal Engineer
>> IONA
>> P: 781-902-8727    C: 508-380-7194
>> [EMAIL PROTECTED]
>> http://www.dankulp.com/blog
>>
>




Reply via email to