aspose file tools*
The moose likes Java in General and the fly likes Problem of Unmarshalling xml using JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem of Unmarshalling xml using JAXB" Watch "Problem of Unmarshalling xml using JAXB" New topic
Author

Problem of Unmarshalling xml using JAXB

kishore routhu
Greenhorn

Joined: Jan 17, 2013
Posts: 14
I am using JAXB for working with xml's (Unmarshalling and Marshalling)

xml source is as follows
<?xml version="1.0" encoding="UTF-8"?>
<OTA_HotelRatePlanNotifRQ xmlns="http://www.opentravel.org/OTA/2003/05" TimeStamp="2013-01-18T15:58:22.686N" Version="1">
<POS>
<Source AgentSine="159" AgentDutyCode="7ecb927d90b2c39">
<RequestorID URL="http://24.134.53.26/V8/FidelioIISWrapper.dll/FidelioXMLInter" Type="Cultuzz" ID="38193"/>
</Source>
</POS>
<RatePlans>
<RatePlan RatePlanCode="CUL3" RatePlanType="13" RatePlanCategory="RAC" Start="2013-01-18" End="2016-10-12" CurrencyCode="EUR">
<BookingRules>
<BookingRule MinAdvancedBookingOffset="0">
<LengthsOfStay>
<LengthOfStay Time="0" TimeUnit="Day" MinMaxMessageType="SetMinLOS"/>
<LengthOfStay Time="0" TimeUnit="Day" MinMaxMessageType="SetMaxLOS"/>
</LengthsOfStay>
</BookingRule>
</BookingRules>
<Rates>
<Rate Start="2013-01-18" End="2013-12-31" Mon="1" Tue="1" Weds="1" Thur="1" Fri="1" Sat="0" Sun="0" CurrencyCode="EUR" InvTypeCode="78785" UnitMultiplier="1">
<AdditionalGuestAmounts>
<AdditionalGuestAmount AgeQualifyingCode="10" Amount="111"/>
</AdditionalGuestAmounts>
<BaseByGuestAmts>
<BaseByGuestAmt NumberOfGuests="1" AgeQualifyingCode="TEE" AmountAfterTax="11"/>
<BaseByGuestAmt NumberOfGuests="1" AgeQualifyingCode="CHI" AmountAfterTax="22"/>
<BaseByGuestAmt NumberOfGuests="1" AgeQualifyingCode="BAB" AmountAfterTax="33"/>
</BaseByGuestAmts>
</Rate>
<Rate Start="2013-01-18" End="2013-12-31" Mon="0" Tue="0" Weds="0" Thur="0" Fri="0" Sat="1" Sun="1" CurrencyCode="EUR" InvTypeCode="78785" UnitMultiplier="1">
<AdditionalGuestAmounts>
<AdditionalGuestAmount AgeQualifyingCode="10" Amount="111"/>
</AdditionalGuestAmounts>
<BaseByGuestAmts>
<BaseByGuestAmt NumberOfGuests="1" AgeQualifyingCode="TEE" AmountAfterTax="11"/>
<BaseByGuestAmt NumberOfGuests="1" AgeQualifyingCode="CHI" AmountAfterTax="22"/>
<BaseByGuestAmt NumberOfGuests="1" AgeQualifyingCode="BAB" AmountAfterTax="33"/>
</BaseByGuestAmts>
</Rate>
</Rates>
</RatePlan>
</RatePlans>
</OTA_HotelRatePlanNotifRQ>



While unmarshalling i am getting the following Error :

java.lang.IllegalArgumentException: 0
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.jaxp.datatype.DurationImpl.<init>(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newDuration(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$25.parse(RuntimeBuiltinLeafInfoImpl.java:782)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$25.parse(RuntimeBuiltinLeafInfoImpl.java:780)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:202)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:449)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427)
2013-01-21 16:55:40,348 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
2013-01-21 16:55:40,348 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
2013-01-21 16:55:40,349 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
2013-01-21 16:55:40,349 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
2013-01-21 16:55:40,349 ERROR [STDERR] at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
2013-01-21 16:55:40,349 ERROR [STDERR] at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
2013-01-21 16:55:40,349 ERROR [STDERR] at de.cultuzz.adapter.servlets.Suite8ControllerServlet.processRequest(Suite8ControllerServlet.java:142)
2013-01-21 16:55:40,349 ERROR [STDERR] at de.cultuzz.adapter.servlets.Suite8ControllerServlet.doPost(Suite8ControllerServlet.java:91)
2013-01-21 16:55:40,349 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
2013-01-21 16:55:40,349 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2013-01-21 16:55:40,349 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
2013-01-21 16:55:40,350 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2013-01-21 16:55:40,350 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
2013-01-21 16:55:40,350 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44




Please explain me that what wrong with xml ?
What is the root cause for IllegalArgumentException ?
How to resolve this problem ?
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

Hi there. We're not really able to help you if we don't see your code. Write a SSCCE to display your problem.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 516
    
    3
TimeStamp="2013-01-18T15:58:22.686N"

This is most probably an error if the attribute is of type xs:dateTime. And it is probably the cause of validating unmarshalling. It should either end with Z rather than N or some standard conformant syntax. But, however probably, the issue cannot be resolved without seeing the schema or actually data binding xml-to-javatype-adapter if any.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem of Unmarshalling xml using JAXB