Hi Nilupa,
Looking at the stack trace, I'm wondering how you're passing the
XMLStreamReader to JiBX. The way the code is set up, you need to create
the StAXReaderWrapper *before* you reach the start tag of the element
that's going to be processed by JiBX (so in the case of processing a
SOAP message body, you'd need to do this while the XMLStreamReader is
positioned on the Body start tag). If you create the StAXReaderWrapper
when you're already positioned at the start tag of the element it looks
like it would cause this problem when you reach the end tag.
If you can't take this approach with CXF I can change the
StAXReaderWrapper to give you a workaround. It should be enough to just
make the startTag() method public, so that after constructing the
StAXReaderWrapper you call this method to initialize the state for the
current element start tag.
- Dennis
Nilupa Bandara wrote:
Hi,
I'm getting the following error (for both the simple types case and complex
types case) when I feed the XMLStreamReader to Unmarshalling context without
the following workaround[2]. It seems that the problem occurs when the
XMLStreamReader is used by JiBX framework to access an element which a part
of a larger element or document. I found something similar has been
reported[3]. Is this the same issue or is it different ? Any suggestions on
what the solution should be ?
Thanks in advance !!
Nilupa
[1]
java.lang.ArrayIndexOutOfBoundsException: Attempt to peek past end of stack
at org.jibx.runtime.IntStack.peek(IntStack.java:231)
at org.jibx.runtime.IntStack.peek(IntStack.java:245)
at
org.jibx.runtime.impl.StAXReaderWrapper.endTag(StAXReaderWrapper.java:159)
at
org.jibx.runtime.impl.StAXReaderWrapper.nextToken(StAXReaderWrapper.java:182)
at
org.jibx.runtime.impl.UnmarshallingContext.parseContentText(UnmarshallingContext.java:880)
at
org.jibx.runtime.impl.UnmarshallingContext.parseElementText(UnmarshallingContext.java:955)
at
com.sosnoski.ws.library.types.BookInformation.JiBX_binding_unmarshal_1_0(BookInformation.java)
at
com.sosnoski.ws.library.types.JiBX_bindingBookInformation_access2.unmarshal()
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2732)
at org.apache.xcf.jibx.JibxDataReader.read(JibxDataReader.java:61)
at org.apache.xcf.jibx.JibxDataReader.read(JibxDataReader.java:1)
at
org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:251)
at
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:127)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:313)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:277)
at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
[2]
Document element = StaxUtils.read(reader);
reader = StaxUtils.createXMLStreamReader(element);
[3] http://www.mail-archive.com/u...@xfire.codehaus.org/msg00447.html