You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tog <gu...@gmail.com> on 2007/05/17 08:13:16 UTC

XmlSchemaComplexType exception

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

Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
Actually I have the same error using the latest cxf-bundle from
http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/ which
is dated May 21.

Do I miss a jarfile ?

Cheers
Tog

On 5/22/07, tog <gu...@gmail.com> wrote:
>
> Daniel,
>
> Sorry I used the official RC from the site ;-)
> With the latest trunk, i got an other exception ..
>
> Cheers
> Guillaume
>
> Enregistre Book de id 123
> 21 mai 2007 23:38:07
> org.apache.cxf.service.factory.ReflectionServiceFactoryBeanbuildServiceFromClass
> INFO: Creating Service {http://book.acme.com/}BookServiceService<http://book.acme.com/%7DBookServiceService>from class
> com.acme.book.BookService
> Exception in thread "main" java.lang.ClassCastException:
> org.apache.cxf.service.model.BindingInfo
>         at
> org.apache.cxf.binding.soap.SoapTransportFactory.createEndpointInfo(
> SoapTransportFactory.java:207)
>         at
> org.apache.cxf.frontend.AbstractEndpointFactory.createEndpointInfo (
> AbstractEndpointFactory.java:202)
>         at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(
> AbstractEndpointFactory.java:105)
>         at org.apache.cxf.frontend.ServerFactoryBean.create(
> ServerFactoryBean.java :84)
>         at com.acme.book.Main.createRestService(Main.java:57)
>         at com.acme.book.Main.main(Main.java:36)
>
>
> On 5/21/07, Daniel Kulp < dkulp@apache.org> 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 <gu...@gmail.com> 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
> > daniel.kulp@iona.com
> > http://www.dankulp.com/blog
> >
>
>

Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
Daniel,

Sorry I used the official RC from the site ;-)
With the latest trunk, i got an other exception ..

Cheers
Guillaume

Enregistre Book de id 123
21 mai 2007 23:38:07
org.apache.cxf.service.factory.ReflectionServiceFactoryBeanbuildServiceFromClass
INFO: Creating Service {http://book.acme.com/}BookServiceService from class
com.acme.book.BookService
Exception in thread "main" java.lang.ClassCastException:
org.apache.cxf.service.model.BindingInfo
        at
org.apache.cxf.binding.soap.SoapTransportFactory.createEndpointInfo(
SoapTransportFactory.java:207)
        at
org.apache.cxf.frontend.AbstractEndpointFactory.createEndpointInfo(
AbstractEndpointFactory.java:202)
        at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(
AbstractEndpointFactory.java:105)
        at org.apache.cxf.frontend.ServerFactoryBean.create(
ServerFactoryBean.java:84)
        at com.acme.book.Main.createRestService(Main.java:57)
        at com.acme.book.Main.main(Main.java:36)


On 5/21/07, Daniel Kulp <dk...@apache.org> 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 <gu...@gmail.com> 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
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>

Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
That rocks ! Then I will be able to define restul services in binding ...
My only remaining problem is that Groovy is currently not  able to define
package annotation (package-info.java) but hopefully this limitation will be
removed at some point

Cheers
Guillaume

On 5/25/07, Freeman Fang <fr...@iona.com> wrote:
>
> Hi Tog,
> My next commit will meet your requirement. You can define class without
> @XmlRootElement for input parameter class of rest binding.
>
> Cheers
>
> Freeman
>
> tog wrote:
> > Hi Jim,
> >
> > Ok but I was kind of obliged to process like this - see [1] since I am
> > using
> > groovy which generates additional properties / fields / methods  (non
> > business one) to my bean. And I want to get rid of them ...
> >
> > So the question is:
> >   Is there a way to achieve the same result as what I get when using
> > @XmlRootElement by only using annotations on the properties ?
> >
> > When I use @XmlRootElement on my groovy bean I got the following
> > exception
> > because of the interface and extra fields.
> >
> > Cheers
> > Tog
> >
> > INFO: Creating Service {http://book.acme.com/}BookServiceService from
> > class
> > com.acme.book.BookService
> > Exception in thread "main"
> > org.apache.cxf.service.factory.ServiceConstructionException
> >        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
> > JAXBDataBinding.java:255)
> >        at
> >
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass
> >
> > (ReflectionServiceFactoryBean.java:220)
> >        at
> >
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel
> >
> > (ReflectionServiceFactoryBean.java:248)
> >        at
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(
> > ReflectionServiceFactoryBean.java:136)
> >        at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint
> (
> > AbstractEndpointFactory.java:83)
> >        at org.apache.cxf.frontend.ServerFactoryBean.create(
> > ServerFactoryBean.java:84)
> >        at com.acme.book.Main.createRestService(Main.java:57)
> >        at com.acme.book.Main.main(Main.java:36)
> > Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2
> > counts
> > of IllegalAnnotationExceptions
> > groovy.lang.MetaClass is an interface, and JAXB can't handle interfaces.
> >        this problem is related to the following location:
> >                at groovy.lang.MetaClass
> >                at public groovy.lang.MetaClass
> > com.acme.book.GetBook.getMetaClass()
> >                at com.acme.book.GetBook
> > groovy.lang.MetaClass does not have a no-arg default constructor.
> >        this problem is related to the following location:
> >                at groovy.lang.MetaClass
> >                at public groovy.lang.MetaClass
> > com.acme.book.GetBook.getMetaClass()
> >                at com.acme.book.GetBook
> >
> >        at
> > com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(
> > IllegalAnnotationsException.java:66)
> >        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(
> > JAXBContextImpl.java:422)
> >        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(
> > JAXBContextImpl.java:270)
> >        at com.sun.xml.bind.v2.ContextFactory.createContext(
> > ContextFactory.java:103)
> >        at com.sun.xml.bind.v2.ContextFactory.createContext(
> > ContextFactory.java:81)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
> >        at javax.xml.bind.ContextFinder.find(ContextFinder.java:366)
> >        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
> >        at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(
> > JAXBDataBinding.java:381)
> >        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
> > JAXBDataBinding.java:253)
> >        ... 7 more
> >
> >
> > [1] http://www.nabble.com/Newbie-question-%21-tf3753790.html
> >
> > On 5/24/07, Jim Ma <em...@iona.com> wrote:
> >>
> >> Hi Tog,
> >>
> >> Restful_http_bindings sample use JaxwsServiceFactoryBean to create
> >> service info by reflecting the classes. JaxwsServiceFactoryBean
> generate
> >> the schema information with default JaxbDataBinding .
> >> The classes you modified is used to generate schema by JaxbDataBinding
> .
> >> When @XmlRootElement is removed from the GetBook class ,
> JaxbDataBinding
> >> will only generate the schema type for this class. See [1] and [2]
> >> A XmlSchemaComplexType will be bound to the message part instead of a
> >> XmlSchemaElement , so it will cause the cast exception .
> >>
> >> I do not think this is an issue or unsupported. Jaxb need this
> >> annotation to generate the appropriate schema.
> >>
> >> [1] JAXB spec 8.7.2
> >>
> >> [2]
> >>
> http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
> >>
> >>
> >> Cheers
> >>
> >> Jim
> >>
> >>
> >> Freeman Fang wrote:
> >> > 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 <fr...@iona.com> 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 <dk...@apache.org> 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 <gu...@gmail.com> 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
> >> >>> >> daniel.kulp@iona.com
> >> >>> >> http://www.dankulp.com/blog
> >> >>> >>
> >> >>> >
> >> >>>
> >> >>>
> >> >>
> >> >
> >> >
> >>
> >
>
>

Re: XmlSchemaComplexType exception

Posted by Freeman Fang <fr...@iona.com>.
Hi Tog,
My next commit will meet your requirement. You can define class without 
@XmlRootElement for input parameter class of rest binding.

Cheers

Freeman

tog wrote:
> Hi Jim,
>
> Ok but I was kind of obliged to process like this - see [1] since I am 
> using
> groovy which generates additional properties / fields / methods  (non
> business one) to my bean. And I want to get rid of them ...
>
> So the question is:
>   Is there a way to achieve the same result as what I get when using
> @XmlRootElement by only using annotations on the properties ?
>
> When I use @XmlRootElement on my groovy bean I got the following 
> exception
> because of the interface and extra fields.
>
> Cheers
> Tog
>
> INFO: Creating Service {http://book.acme.com/}BookServiceService from 
> class
> com.acme.book.BookService
> Exception in thread "main"
> org.apache.cxf.service.factory.ServiceConstructionException
>        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
> JAXBDataBinding.java:255)
>        at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass 
>
> (ReflectionServiceFactoryBean.java:220)
>        at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel 
>
> (ReflectionServiceFactoryBean.java:248)
>        at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(
> ReflectionServiceFactoryBean.java:136)
>        at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(
> AbstractEndpointFactory.java:83)
>        at org.apache.cxf.frontend.ServerFactoryBean.create(
> ServerFactoryBean.java:84)
>        at com.acme.book.Main.createRestService(Main.java:57)
>        at com.acme.book.Main.main(Main.java:36)
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 
> counts
> of IllegalAnnotationExceptions
> groovy.lang.MetaClass is an interface, and JAXB can't handle interfaces.
>        this problem is related to the following location:
>                at groovy.lang.MetaClass
>                at public groovy.lang.MetaClass
> com.acme.book.GetBook.getMetaClass()
>                at com.acme.book.GetBook
> groovy.lang.MetaClass does not have a no-arg default constructor.
>        this problem is related to the following location:
>                at groovy.lang.MetaClass
>                at public groovy.lang.MetaClass
> com.acme.book.GetBook.getMetaClass()
>                at com.acme.book.GetBook
>
>        at
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(
> IllegalAnnotationsException.java:66)
>        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(
> JAXBContextImpl.java:422)
>        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(
> JAXBContextImpl.java:270)
>        at com.sun.xml.bind.v2.ContextFactory.createContext(
> ContextFactory.java:103)
>        at com.sun.xml.bind.v2.ContextFactory.createContext(
> ContextFactory.java:81)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at 
> javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
>        at javax.xml.bind.ContextFinder.find(ContextFinder.java:366)
>        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
>        at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(
> JAXBDataBinding.java:381)
>        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
> JAXBDataBinding.java:253)
>        ... 7 more
>
>
> [1] http://www.nabble.com/Newbie-question-%21-tf3753790.html
>
> On 5/24/07, Jim Ma <em...@iona.com> wrote:
>>
>> Hi Tog,
>>
>> Restful_http_bindings sample use JaxwsServiceFactoryBean to create
>> service info by reflecting the classes. JaxwsServiceFactoryBean generate
>> the schema information with default JaxbDataBinding .
>> The classes you modified is used to generate schema by JaxbDataBinding .
>> When @XmlRootElement is removed from the GetBook class , JaxbDataBinding
>> will only generate the schema type for this class. See [1] and [2]
>> A XmlSchemaComplexType will be bound to the message part instead of a
>> XmlSchemaElement , so it will cause the cast exception .
>>
>> I do not think this is an issue or unsupported. Jaxb need this
>> annotation to generate the appropriate schema.
>>
>> [1] JAXB spec 8.7.2
>>
>> [2]
>> http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html 
>>
>>
>> Cheers
>>
>> Jim
>>
>>
>> Freeman Fang wrote:
>> > 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 <fr...@iona.com> 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 <dk...@apache.org> 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 <gu...@gmail.com> 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
>> >>> >> daniel.kulp@iona.com
>> >>> >> http://www.dankulp.com/blog
>> >>> >>
>> >>> >
>> >>>
>> >>>
>> >>
>> >
>> >
>>
>


Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
Me again,

I noticed that in schema part of the "good" wsdl I have both a
   <xs:element name="GetBook" type="tns:getBook"/>
and a complex type:
  <xs:complexType name="getBook">
  <xs:sequence>
  <xs:element name="id" type="xs:long"/>
  </xs:sequence>
  </xs:complexType>

while the faulty has only the second part. Is that the difference expected
between @XmlRootElement and @XmlElement ?

Cheers
Tog

On 5/24/07, tog <gu...@gmail.com> wrote:
>
> Hi Jim,
>
> Ok but I was kind of obliged to process like this - see [1] since I am
> using groovy which generates additional properties / fields / methods  (non
> business one) to my bean. And I want to get rid of them ...
>
> So the question is:
>    Is there a way to achieve the same result as what I get when using
> @XmlRootElement by only using annotations on the properties ?
>
> When I use @XmlRootElement on my groovy bean I got the following exceptionbecause of the interface and extra fields.
>
> Cheers
> Tog
>
> INFO: Creating Service {http://book.acme.com/}BookServiceService<http://book.acme.com/%7DBookServiceService>from class
> com.acme.book.BookService
> Exception in thread "main"
> org.apache.cxf.service.factory.ServiceConstructionException
>         at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
> JAXBDataBinding.java:255)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(
> ReflectionServiceFactoryBean.java:220)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel
> (ReflectionServiceFactoryBean.java:248)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create (
> ReflectionServiceFactoryBean.java:136)
>         at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(
> AbstractEndpointFactory.java:83)
>         at org.apache.cxf.frontend.ServerFactoryBean.create(
> ServerFactoryBean.java :84)
>         at com.acme.book.Main.createRestService(Main.java:57)
>         at com.acme.book.Main.main(Main.java:36)
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2
> counts of IllegalAnnotationExceptions
> groovy.lang.MetaClass is an interface, and JAXB can't handle interfaces.
>         this problem is related to the following location:
>                 at groovy.lang.MetaClass
>                 at public groovy.lang.MetaClass
> com.acme.book.GetBook.getMetaClass()
>                 at com.acme.book.GetBook
> groovy.lang.MetaClass does not have a no-arg default constructor.
>         this problem is related to the following location:
>                 at groovy.lang.MetaClass
>                 at public groovy.lang.MetaClass
> com.acme.book.GetBook.getMetaClass()
>                 at com.acme.book.GetBook
>
>         at
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check (
> IllegalAnnotationsException.java:66)
>         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(
> JAXBContextImpl.java:422)
>         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(
> JAXBContextImpl.java :270)
>         at com.sun.xml.bind.v2.ContextFactory.createContext(
> ContextFactory.java:103)
>         at com.sun.xml.bind.v2.ContextFactory.createContext(
> ContextFactory.java:81)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java
> :210)
>         at javax.xml.bind.ContextFinder.find(ContextFinder.java:366)
>         at javax.xml.bind.JAXBContext.newInstance (JAXBContext.java:574)
>         at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(
> JAXBDataBinding.java:381)
>         at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
> JAXBDataBinding.java:253)
>         ... 7 more
>
>
> [1] http://www.nabble.com/Newbie-question-%21-tf3753790.html
>
> On 5/24/07, Jim Ma <em...@iona.com> wrote:
> >
> > Hi Tog,
> >
> > Restful_http_bindings sample use JaxwsServiceFactoryBean to create
> > service info by reflecting the classes. JaxwsServiceFactoryBean generate
> > the schema information with default JaxbDataBinding .
> > The classes you modified is used to generate schema by JaxbDataBinding .
> >
> > When @XmlRootElement is removed from the GetBook class , JaxbDataBinding
> > will only generate the schema type for this class. See [1] and [2]
> > A XmlSchemaComplexType will be bound to the message part instead of a
> > XmlSchemaElement , so it will cause the cast exception .
> >
> > I do not think this is an issue or unsupported. Jaxb need this
> > annotation to generate the appropriate schema.
> >
> > [1] JAXB spec 8.7.2
> >
> > [2]
> >
> > http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
> >
> > Cheers
> >
> > Jim
> >
> >
> > Freeman Fang wrote:
> > > 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 <fr...@iona.com> 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 < dkulp@apache.org> 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 <gu...@gmail.com> 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
> > >>> >> daniel.kulp@iona.com
> > >>> >> http://www.dankulp.com/blog
> > >>> >>
> > >>> >
> > >>>
> > >>>
> > >>
> > >
> > >
> >
>
>

Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
Hi Jim,

Ok but I was kind of obliged to process like this - see [1] since I am using
groovy which generates additional properties / fields / methods  (non
business one) to my bean. And I want to get rid of them ...

So the question is:
   Is there a way to achieve the same result as what I get when using
@XmlRootElement by only using annotations on the properties ?

When I use @XmlRootElement on my groovy bean I got the following exception
because of the interface and extra fields.

Cheers
Tog

INFO: Creating Service {http://book.acme.com/}BookServiceService from class
com.acme.book.BookService
Exception in thread "main"
org.apache.cxf.service.factory.ServiceConstructionException
        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
JAXBDataBinding.java:255)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass
(ReflectionServiceFactoryBean.java:220)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel
(ReflectionServiceFactoryBean.java:248)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(
ReflectionServiceFactoryBean.java:136)
        at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(
AbstractEndpointFactory.java:83)
        at org.apache.cxf.frontend.ServerFactoryBean.create(
ServerFactoryBean.java:84)
        at com.acme.book.Main.createRestService(Main.java:57)
        at com.acme.book.Main.main(Main.java:36)
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts
of IllegalAnnotationExceptions
groovy.lang.MetaClass is an interface, and JAXB can't handle interfaces.
        this problem is related to the following location:
                at groovy.lang.MetaClass
                at public groovy.lang.MetaClass
com.acme.book.GetBook.getMetaClass()
                at com.acme.book.GetBook
groovy.lang.MetaClass does not have a no-arg default constructor.
        this problem is related to the following location:
                at groovy.lang.MetaClass
                at public groovy.lang.MetaClass
com.acme.book.GetBook.getMetaClass()
                at com.acme.book.GetBook

        at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(
IllegalAnnotationsException.java:66)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(
JAXBContextImpl.java:422)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(
JAXBContextImpl.java:270)
        at com.sun.xml.bind.v2.ContextFactory.createContext(
ContextFactory.java:103)
        at com.sun.xml.bind.v2.ContextFactory.createContext(
ContextFactory.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:366)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(
JAXBDataBinding.java:381)
        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
JAXBDataBinding.java:253)
        ... 7 more


[1] http://www.nabble.com/Newbie-question-%21-tf3753790.html

On 5/24/07, Jim Ma <em...@iona.com> wrote:
>
> Hi Tog,
>
> Restful_http_bindings sample use JaxwsServiceFactoryBean to create
> service info by reflecting the classes. JaxwsServiceFactoryBean generate
> the schema information with default JaxbDataBinding .
> The classes you modified is used to generate schema by JaxbDataBinding .
> When @XmlRootElement is removed from the GetBook class , JaxbDataBinding
> will only generate the schema type for this class. See [1] and [2]
> A XmlSchemaComplexType will be bound to the message part instead of a
> XmlSchemaElement , so it will cause the cast exception .
>
> I do not think this is an issue or unsupported. Jaxb need this
> annotation to generate the appropriate schema.
>
> [1] JAXB spec 8.7.2
>
> [2]
> http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
>
> Cheers
>
> Jim
>
>
> Freeman Fang wrote:
> > 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 <fr...@iona.com> 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 <dk...@apache.org> 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 <gu...@gmail.com> 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
> >>> >> daniel.kulp@iona.com
> >>> >> http://www.dankulp.com/blog
> >>> >>
> >>> >
> >>>
> >>>
> >>
> >
> >
>

Re: XmlSchemaComplexType exception

Posted by Jim Ma <em...@iona.com>.
Hi Tog,

Restful_http_bindings sample use JaxwsServiceFactoryBean to create 
service info by reflecting the classes. JaxwsServiceFactoryBean generate 
the schema information with default JaxbDataBinding .
The classes you modified is used to generate schema by JaxbDataBinding .
When @XmlRootElement is removed from the GetBook class , JaxbDataBinding 
will only generate the schema type for this class. See [1] and [2]
A XmlSchemaComplexType will be bound to the message part instead of a 
XmlSchemaElement , so it will cause the cast exception .

I do not think this is an issue or unsupported. Jaxb need this 
annotation to generate the appropriate schema.

[1] JAXB spec 8.7.2

[2] 
http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html

Cheers

Jim


Freeman Fang wrote:
> 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 <fr...@iona.com> 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 <dk...@apache.org> 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 <gu...@gmail.com> 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
>>> >> daniel.kulp@iona.com
>>> >> http://www.dankulp.com/blog
>>> >>
>>> >
>>>
>>>
>>
>
>

Re: XmlSchemaComplexType exception

Posted by Freeman Fang <fr...@iona.com>.
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 <fr...@iona.com> 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 <dk...@apache.org> 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 <gu...@gmail.com> 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
>> >> daniel.kulp@iona.com
>> >> http://www.dankulp.com/blog
>> >>
>> >
>>
>>
>


Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
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 <fr...@iona.com> 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 <dk...@apache.org> 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 <gu...@gmail.com> 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
> >> daniel.kulp@iona.com
> >> http://www.dankulp.com/blog
> >>
> >
>
>

Re: XmlSchemaComplexType exception

Posted by Freeman Fang <fr...@iona.com>.
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 <dk...@apache.org> 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 <gu...@gmail.com> 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
>> daniel.kulp@iona.com
>> http://www.dankulp.com/blog
>>
>


Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
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 <dk...@apache.org> 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 <gu...@gmail.com> 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
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>

Re: XmlSchemaComplexType exception

Posted by Daniel Kulp <dk...@apache.org>.
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 <gu...@gmail.com> 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
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: XmlSchemaComplexType exception

Posted by tog <gu...@gmail.com>.
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.URIParameterInInterceptorhandleMessage
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.mergeParams
(URIParameterInInterceptor.java:122)
        at
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage
(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.serviceRequest(
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 <gu...@gmail.com> 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
>