cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Antwort: Re: Unmarshalling Error: UndeclaredPrefix: Cannot resolve 'ns0:Xxx' as a QName: the prefix 'ns0' is not declared [Virus checked]
Date Mon, 13 Jul 2009 15:29:44 GMT
On Mon July 13 2009 10:16:13 am jp4 wrote:
> Dan,
>
> I upgraded to CXF 2.2.2 and tried once again with Java 6.  I am still
> seeing the same error.  The type is properly declared, and I can validate
> the same XML with a servlet that uses the same XSDs.  Should I open a bug
> for this? Any other ideas?

Yes, please do open a bug, but we'll probably need a testcase that shows the 
error as I'm not sure how to reproduce it without a test case.

Thanks!
Dan

>
> Thanks,
>
> John
>
> dkulp wrote:
> > On Thu July 9 2009 10:34:38 am jp4 wrote:
> >> I am seeing a similar behavior where the xsi:type causes the
> >> UndeclaredPrefix error.  Initially I was running CXF 2.2 with JDK 1.5 on
> >
> > Well, definitely try with CXF 2.2.2.   That may help.
> >
> > If that doesn't help, use something like wireshark or similar to capture
> > the
> > raw message off the wire and see if ns3 is actually properly declared on
> > the
> > wire.   If not, that would probably be a bug.
> >
> > Dan
> >
> >> Jboss 4.2.3.GA.  I have since upgraded to Java 6.  I send a sample
> >> request
> >> through SOAPUI and I still see the same error below...  If I attempt to
> >> validate the same file from within the container using a servlet and the
> >> code below, it validates just fine.  Any idea what could be causing the
> >> discrepancy?
> >>
> >>         Source source = new
> >> StreamSource(getClass().getResourceAsStream("/request.xml"));
> >>         // If you comment the following line, it works
> >>         source = toDOMSource(source);
> >>         validator.validate(source);
> >>
> >>
> >> <07/09/09
> >> 10:23:37:779|http-8443-2|INFO|apache.cxf.phase.PhaseInterceptorChain|Int
> >>erc eptor has thrown exception, unwinding now|
> >> org.apache.cxf.interceptor.Fault: Unmarshalling Error: UndeclaredPrefix:
> >> Cannot resolve 'ns3:FundingSourceType' as a QName: the prefix 'ns3' is
> >> not
> >> declared.
> >> 	at
> >> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.jav
> >>a:6 22) at
> >> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.jav
> >>a:5 27) at
> >> org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:108) at
> >> org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLite
> >>ral InInterceptor.java:183) at
> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> >>hai n.java:236) at
> >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati
> >>onO bserver.java:89) at
> >> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestin
> >>ati on.java:99) at
> >> org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser
> >>vle tController.java:337) at
> >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl
> >>ler .java:182) at
> >> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSe
> >>rvl et.java:163) at
> >> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFSe
> >>rvl et.java:141) at
>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>
> >> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >> 	at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> >>tio nFilterChain.java:290) at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> >>erC hain.java:206) at
> >> com.billmelater.enterpriseservices.servlet.util.RequestTimerServletFilte
> >>r.d oFilter(RequestTimerServletFilter.java:55) at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> >>tio nFilterChain.java:235) at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> >>erC hain.java:206) at
> >> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.do
> >>Fil ter(FilterChainProxy.java:378) at
> >> org.springframework.security.intercept.web.FilterSecurityInterceptor.inv
> >>oke (FilterSecurityInterceptor.java:109)
> >>
> >> dkulp wrote:
> >> > Did some snooping...   The RI seems to have the same problem:
> >> > http://forums.java.net/jive//message.jspa?messageID=268876
> >> >
> >> > And they mention its a bug in the JDK:
> >> > https://jaxp.dev.java.net/issues/show_bug.cgi?id=46
> >> >
> >> > The workaround seems to be to use the latest 1.6 JDK or get the latest
> >> > sun jaxp parser
> >> > (http://download.java.net/maven/1/com.sun.xml.parsers/jars/
> >> > )  and throw it in your endorsed dir.
> >> >
> >> > Dan
> >> >
> >> > On Jun 18, 2008, at 2:16 PM, jan.minaroviech@external.t-mobile.at
> >>
> >> wrote:
> >> >> Hi,
> >> >>
> >> >> looks like the same problem i have. But my response is invalid also
> >> >> according to soapUI validation.
> >> >>
> >> >> I'm not using any additional interceptors, only default cxfServlet,
> >> >> default bus config etc, without security, attachments etc. and I'm
> >> >> using
> >> >> jaxWS+jaxB
> >> >>
> >> >> This is response, which is problem in my case (cxf is client in this
> >> >> case)
> >> >>
> >> >> <soapenv:Envelope
> >> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >> >>   <soapenv:Body>
> >> >>      <locationSearchReply
> >> >> xmlns="http://www.deltavista.at/schema/locationsearch">
> >> >>         <foundLocation>
> >> >>            <street>Stephansplatz</street>
> >> >>            <houseNumber>1</houseNumber>
> >> >>            <city>Wien</city>
> >> >>            <zip xsi:type="xsd:string">1010</zip>
> >> >>            <country xsi:type="xsd:string">AUT</country>
> >> >>            <locationMatch>4</locationMatch>
> >> >>            <similarity>92</similarity>
> >> >>            <confidence>98</confidence>
> >> >>         </foundLocation>
> >> >>      </locationSearchReply>
> >> >>   </soapenv:Body>
> >> >> </soapenv:Envelope>
> >> >>
> >> >> i have a problem with xsd:string inside reply.
> >> >>
> >> >> pieces of xsd:
> >> >>                                        <element name="zip"
> >> >> type="locationsearch:Zip" minOccurs="1"/>
> >> >>                        <simpleType name="Zip">
> >> >>                                <restriction base="string">
> >> >>                                        <minLength value="4"/>
> >> >>                                        <maxLength value="7"/>
> >> >>                                </restriction>
> >> >>                        </simpleType>
> >> >>
> >> >> when i turn off validation, everything works
> >> >>
> >> >> best regards
> >> >> jano
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> Daniel Kulp <dkulp@apache.org>
> >> >> 06/18/2008 20:05
> >> >> Bitte antworten an
> >> >> users@cxf.apache.org
> >> >>
> >> >>
> >> >> An
> >> >> users@cxf.apache.org
> >> >> Kopie
> >> >>
> >> >> Thema
> >> >> Re: Unmarshalling Error: UndeclaredPrefix: Cannot resolve 'ns0:Xxx'
> >> >> as a
> >> >> QName: the prefix 'ns0' is not declared  [Virus checked]
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> Very strange.   The message is definitely valid.
> >> >>
> >> >> Could questions:
> >> >> 1) Do you have any SAAJ type handlers/interceptors on the chain
> >> >> (jaxws SOAPHandler, ws-security things, etc...)?
> >> >>
> >> >> 2) I noticed you have a xerces jar...  can you try removing that and
> >> >> seeing if the JDK built-in parser will work?  Also, check if you have
> >> >> a xalan jar installed and remove that as well.
> >> >>
> >> >> 3) Can you turn off validation.   It looks like it's the validator
> >> >> having an issue, not the unmarshaller.   If it unmarshalls OK that
> >> >> way, we at least know the parser is giving it the correct data.   If
> >> >> that still fails, we'll need to dig in more.
> >> >>
> >> >> Dan
> >> >>
> >> >> On Jun 17, 2008, at 12:33 PM, Urciolo, Kevin wrote:
> >> >>> I am running in to an issue when a Java 5 client using JWSDP is
> >> >>> sending
> >> >>> a request to my CXF (2.1.1 SNAPSHOT) service.  I get an exception,
> >> >>> Unmarshalling Error: UndeclaredPrefix: Cannot resolve 'ns0:Xxx'
as a
> >> >>> QName: the prefix 'ns0' is not declared, as shown below.  The type
> >> >>> is an
> >> >>> extension from a base type.  I am assuming this is why "xsi:type"
is
> >> >>> generated by the client since it is not used in other places.
> >> >>>
> >> >>> Is there a reason why CXF is having trouble with this?
> >> >>>
> >> >>> Type From Schema:
> >> >>>
> >> >>>                      <xs:complexType name="Xxx">
> >> >>>                               <xs:complexContent>
> >> >>>                                       <xs:extension base="tns:Base">
> >> >>>                                               <xs:sequence>
> >> >>>                                                       <xs:element
> >> >>> minOccurs="1"
> >> >>>
> >> >>> name="a"
> >> >>> nillable="false" type="xs:boolean" />
> >> >>>                                                       <xs:element
> >> >>> minOccurs="1"
> >> >>>
> >> >>> name="b"
> >> >>> nillable="false" type="xs:boolean" />
> >> >>>                                               </xs:sequence>
> >> >>>                                       </xs:extension>
> >> >>>                               </xs:complexContent>
> >> >>>                     </xs:complexType>
> >>
> >> -----------------------------------------------------------------------
> >>
> >> >>>-
> >>
> >> -----------------------------------------------------------------------
> >>
> >> >>>- -----
> >> >>>
> >> >>> XML Generated:
> >> >>>
> >> >>> <?xml version="1.0"?>
> >> >>> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
> >> >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >>> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
> >> >>> xmlns:ns0="http://mdc.com">
> >> >>> <env:Body>
> >> >>>   <ns0:createXxxRequest>
> >> >>>     <ns0:xxx xsi:type="ns0:Xxx">
> >> >>>       <ns0:name>xxx</ns0:name>
> >> >>>     </ns0:xxx>
> >> >>>   </ns0:createXxxRequest>
> >> >>> </env:Body>
> >> >>> </env:Envelope>
> >>
> >> -----------------------------------------------------------------------
> >>
> >> >>>-
> >>
> >> -----------------------------------------------------------------------
> >>
> >> >>>- -----
> >> >>>
> >> >>> Exception In Log:
> >> >>>
> >> >>> INFO: Interceptor has thrown exception, unwinding now
> >> >>> org.apache.cxf.interceptor.Fault: Unmarshalling Error:
> >> >>> UndeclaredPrefix:
> >> >>> Cannot resolve 'ns0:Xxx' as a QName: the prefix 'ns0' is not
> >> >>> declared.
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.ja
> >> >>>v a:643)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.ja
> >> >>>v a:555)
> >> >>>       at
> >> >>> org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:64)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLit
> >> >>>e ralInInterceptor.java:183)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptor
> >> >>>C hain.java:221)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiat
> >> >>>i onObserver.java:78)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.transport.servlet.ServletDestination.invoke(ServletDesti
> >> >>>n ation.java:92)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.transport.servlet.ServletController.invokeDestination(Se
> >> >>>r vletController.java:279)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.transport.servlet.ServletController.invoke(ServletContro
> >> >>>l ler.java:161)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFS
> >> >>>e rvlet.java:174)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFS
> >> >>>e rvlet.java:152)
> >> >>>       at
> >> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
> >> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at
> >> >>> org
> >> >>> .apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
> >> >>>a tionFilterChain.java:252)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
> >> >>>t erChain.java:173)
> >> >>>       at
> >> >>> org
> >> >>> .jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilt
> >> >>>e r.java:96)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
> >> >>>a tionFilterChain.java:202)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
> >> >>>t erChain.java:173)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
> >> >>>v e.java:213)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.StandardContextValve.invoke(StandardContextVal
> >> >>>v e.java:178)
> >> >>>       at
> >> >>> org
> >> >>> .jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityA
> >> >>>s sociationValve.java:175)
> >> >>>       at
> >> >>> org
> >> >>> .jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.
> >> >>>j ava:74)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
> >> >>>a
> >> >>>
> >> >>> :126)
> >> >>>
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav
> >> >>>a
> >> >>>
> >> >>> :105)
> >> >>>
> >> >>>       at
> >> >>> org
> >> >>> .jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnect
> >> >>>i onValve.java:156)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
> >> >>>. java:107)
> >> >>>       at
> >> >>> org
> >> >>> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
> >> >>>1 48)
> >> >>>       at
> >> >>> org
> >> >>> .apache.coyote.http11.Http11Processor.process(Http11Processor.java:8
> >> >>>6 9)
> >> >>>       at
> >> >>> org.apache.coyote.http11.Http11BaseProtocol
> >> >>> $Http11ConnectionHandler.proc
> >> >>> essConnection(Http11BaseProtocol.java:664)
> >> >>>       at
> >> >>> org
> >> >>> .apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoin
> >> >>>t .java:527)
> >> >>>       at
> >> >>> org
> >> >>> .apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorke
> >> >>>r Thread.java:112)
> >> >>>       at java.lang.Thread.run(Thread.java:619)
> >> >>> Caused by: javax.xml.bind.UnmarshalException
> >> >>> - with linked exception:
> >> >>> [org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot resolve
> >> >>> 'ns0:Xxx' as a QName: the prefix 'ns0' is not declared.]
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamE
> >> >>>x ception(UnmarshallerImpl.java:396)
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Un
> >> >>>m arshallerImpl.java:335)
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unm
> >> >>>a rshallerImpl.java:312)
> >> >>>       at
> >> >>> org
> >> >>> .apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.ja
> >> >>>v a:628)
> >> >>>       ... 31 more
> >> >>> Caused by: org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot
> >> >>> resolve 'ns0:Xxx' as a QName: the prefix 'ns0' is not declared.
> >> >>>       at
> >> >>> org
> >> >>> .apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unkn
> >> >>>o wn Source)
> >> >>>       at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
> >> >>> Source)
> >> >>>       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> >> >>> Source)
> >> >>>       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> >> >>> Source)
> >> >>>       at
> >> >>> org.apache.xerces.impl.xs.XMLSchemaValidator
> >> >>> $XSIErrorReporter.reportErro
> >> >>> r(Unknown Source)
> >> >>>       at
> >> >>> org
> >> >>> .apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
> >> >>> Source)
> >> >>>       at
> >> >>> org
> >> >>> .apache.xerces.impl.xs.XMLSchemaValidator.getAndCheckXsiType(Unknown
> >> >>> Source)
> >> >>>       at
> >> >>> org
> >> >>> .apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> >> >>> Source)
> >> >>>       at
> >> >>> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> >> >>> Source)
> >> >>>       at
> >> >>> org
> >> >>> .apache.xerces.jaxp.validation.ValidatorHandlerImpl.startElement(Unk
> >> >>>n own Source)
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startEl
> >> >>>e ment(ValidatingUnmarshaller.java:73)
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStar
> >> >>>t Element(StAXStreamConnector.java:238)
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StA
> >> >>>X StreamConnector.java:172)
> >> >>>       at
> >> >>> com
> >> >>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Un
> >> >>>m arshallerImpl.java:333)
> >> >>>       ... 33 more
> >> >>
> >> >> ---
> >> >> Daniel Kulp
> >> >> dkulp@apache.org
> >> >> http://www.dankulp.com/blog
> >> >
> >> > ---
> >> > Daniel Kulp
> >> > dkulp@apache.org
> >> > http://www.dankulp.com/blog
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message