java - org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content -


i using cxf webservice uses local transport , accessing webservice java application. webservice reading file , sending through webservice call. using byte size 512. suppose file size 1200. first 2 attempt of retrieving file success , last chunk getting org.apache.cxf.interceptor.fault: unmarshalling error: illegal character (null, unicode 0) encountered: not valid in content.

here chunk represents 512 bytes. converting bytes string , returning web service.in last chunk 16 byte value filled , remaining filled zeros. appreciated. using cxf webservice 2.7.5, jdk1.7 ,redhat linux.

stack trace:

org.apache.cxf.interceptor.fault: unmarshalling error: illegal character (null, unicode 0) encountered: not valid in content  @ [row,col {unknown-source}]: [2,1]         @ org.apache.cxf.jaxb.jaxbencoderdecoder.unmarshall(jaxbencoderdecoder.java:808)         @ org.apache.cxf.jaxb.jaxbencoderdecoder.unmarshall(jaxbencoderdecoder.java:629)         @ org.apache.cxf.jaxb.io.datareaderimpl.read(datareaderimpl.java:157)         @ org.apache.cxf.interceptor.docliteralininterceptor.handlemessage(docliteralininterceptor.java:103)         @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:271)         @ org.apache.cxf.endpoint.clientimpl.onmessage(clientimpl.java:800)         @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.handleresponseinternal(httpconduit.java:1592)         @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.handleresponse(httpconduit.java:1490)         @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.close(httpconduit.java:1309)         @ org.apache.cxf.transport.abstractconduit.close(abstractconduit.java:56)         @ org.apache.cxf.transport.http.httpconduit.close(httpconduit.java:622)         @ org.apache.cxf.interceptor.messagesenderinterceptor$messagesenderendinginterceptor.handlemessage(messagesenderinterceptor.java:62)         @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:271)         @ org.apache.cxf.endpoint.clientimpl.doinvoke(clientimpl.java:530)         @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:463)         @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:366)         @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:319)         @ org.apache.cxf.frontend.clientproxy.invokesync(clientproxy.java:96)         @ org.apache.cxf.jaxws.jaxwsclientproxy.invoke(jaxwsclientproxy.java:133)         @ $proxy62.getjoblog(unknown source)         @ com.java.process.aclass.getmessage(aclass.java:468)         @ com.java.process.aclass.getxxxx(aclass.java:156)         @ com.java.process.aclass.main(cliclientstartup.java:409) caused by: javax.xml.bind.unmarshalexception  - linked exception: [com.ctc.wstx.exc.wstxunexpectedcharexception: illegal character (null, unicode 0) encountered: not valid in content  @ [row,col {unknown-source}]: [2,1]]         @ com.sun.xml.bind.v2.runtime.unmarshaller.unmarshallerimpl.handlestreamexception(unmarshallerimpl.java:436)         @ com.sun.xml.bind.v2.runtime.unmarshaller.unmarshallerimpl.unmarshal0(unmarshallerimpl.java:372)         @ com.sun.xml.bind.v2.runtime.unmarshaller.unmarshallerimpl.unmarshal(unmarshallerimpl.java:349)         @ org.apache.cxf.jaxb.jaxbencoderdecoder.dounmarshal(jaxbencoderdecoder.java:769)         @ org.apache.cxf.jaxb.jaxbencoderdecoder.access$100(jaxbencoderdecoder.java:94)         @ org.apache.cxf.jaxb.jaxbencoderdecoder$1.run(jaxbencoderdecoder.java:797)         @ java.security.accesscontroller.doprivileged(native method)         @ org.apache.cxf.jaxb.jaxbencoderdecoder.unmarshall(jaxbencoderdecoder.java:795)         ... 23 more caused by: com.ctc.wstx.exc.wstxunexpectedcharexception: illegal character (null, unicode 0) encountered: not valid in content  @ [row,col {unknown-source}]: [2,1]         @ com.ctc.wstx.sr.streamscanner.constructnullcharexception(streamscanner.java:630)         @ com.ctc.wstx.sr.streamscanner.throwinvalidspace(streamscanner.java:660)         @ com.ctc.wstx.sr.basicstreamreader.readtextprimary(basicstreamreader.java:4576)         @ com.ctc.wstx.sr.basicstreamreader.nextfromtree(basicstreamreader.java:2879)         @ com.ctc.wstx.sr.basicstreamreader.next(basicstreamreader.java:1072)         @ com.sun.xml.bind.v2.runtime.unmarshaller.staxstreamconnector.bridge(staxstreamconnector.java:196)         @ com.sun.xml.bind.v2.runtime.unmarshaller.unmarshallerimpl.unmarshal0(unmarshallerimpl.java:370)         ... 29 more 

from here

the problem causes these xmlexceptions data being read or loaded contains characters illegal according xml specifications. always, these characters in ascii control character range (think whacky characters null, bell, backspace, etc). these aren’t characters have business being in xml data; they’re illegal characters should removed, having found way data file format conversions, when tries create xml file excel data, or export data xml format may stored binary.

and example sanitizing data before unmarshal. error invalid xml characters on java

maybe should use out of box transferring files, mtom check here

or use cdata syntax wrap content, part evaluates null received literal.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -