Hi,
I'm using Jaxb 2.0EA and getting the following
exception when trying to unmarshall an fpml instance
document, the com.riskman.fpml.Document class is
abstract, xml pasted after the stack trace:
javax.xml.bind.UnmarshalException: Unable to create an
instance of com.riskman.fpml.Document
- with linked exception:
[java.lang.InstantiationException]
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:523)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:490)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:145)
at
com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:36)
at
com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:19)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$IntercepterLoader.startElement(ElementBeanInfoImpl.java:173)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:367)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:345)
at
com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:117)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
at MainTest.deserializeXML(MainTest.java:54)
at MainTest.process(MainTest.java:36)
at MainTest.main(MainTest.java:24)
Caused by: java.lang.InstantiationException
at
sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at
com.sun.xml.bind.v2.ClassFactory.create0(ClassFactory.java:92)
at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.createInstance(ClassBeanInfoImpl.java:195)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:484)
... 23 more
javax.xml.bind.UnmarshalException: Unable to create an
instance of com.riskman.fpml.Document
- with linked exception:
[java.lang.InstantiationException]
--java code
JAXBContext jc =
JAXBContext.newInstance("com.riskman.fpml");
Unmarshaller u = jc.createUnmarshaller();
u.unmarshal( new FileInputStream(
"C:\\downloads\\critical\\riskmansite\\hyperjaxbtest\\xml\\ird_ex01_vanilla_swap.xml"
) );
-- xml instance
<?xml version="1.0"?>
<!--
== Copyright (c) 2002-2004. All rights reserved.
== Financial Products Markup Language is subject to
the FpML public license.
== A copy of this license is available at
http://www.fpml.org/documents/license
-->
<FpML version="4-1" xsi:type="DataDocument"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.fpml.org/2004/FpML-4-1
../fpml-main-4-1.xsd"
xmlns="
http://www.fpml.org/2004/FpML-4-1">
<trade>
<tradeHeader>
<partyTradeIdentifier>
<partyReference href="CHASE"/>
<tradeId
tradeIdScheme="
http://www.chase.com/swaps/trade-id">TW9235</tradeId>
</partyTradeIdentifier>
<partyTradeIdentifier>
<partyReference href="BARCLAYS"/>
<tradeId
tradeIdScheme="
http://www.barclays.com/swaps/trade-id">SW2000</tradeId>
</partyTradeIdentifier>
<tradeDate>1994-12-12</tradeDate>
</tradeHeader>
<swap>
<!-- Chase pays the floating rate every 6 months,
based on 6M DEM-LIBOR-BBA,
on an ACT/360 basis -->
<swapStream>
<payerPartyReference href="CHASE"/>
<receiverPartyReference href="BARCLAYS"/>
<calculationPeriodDates
id="floatingCalcPeriodDates">
<effectiveDate>
<unadjustedDate>1994-12-14</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</effectiveDate>
<terminationDate>
<unadjustedDate>1999-12-14</unadjustedDate>
<dateAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCenters id="primaryBusinessCenters">
<businessCenter>DEFR</businessCenter>
</businessCenters>
</dateAdjustments>
</terminationDate>
<calculationPeriodDatesAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCentersReference
href="primaryBusinessCenters"/>
</calculationPeriodDatesAdjustments>
<calculationPeriodFrequency>
<periodMultiplier>6</periodMultiplier>
<period>M</period>
<rollConvention>14</rollConvention>
</calculationPeriodFrequency>
</calculationPeriodDates>
<paymentDates>
<calculationPeriodDatesReference
href="floatingCalcPeriodDates"/>
<paymentFrequency>
<periodMultiplier>6</periodMultiplier>
<period>M</period>
</paymentFrequency>
<payRelativeTo>CalculationPeriodEndDate</payRelativeTo>
<paymentDatesAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCentersReference
href="primaryBusinessCenters"/>
</paymentDatesAdjustments>
</paymentDates>
<resetDates id="resetDates">
<calculationPeriodDatesReference
href="floatingCalcPeriodDates"/>
<resetRelativeTo>CalculationPeriodStartDate</resetRelativeTo>
<fixingDates>
<periodMultiplier>-2</periodMultiplier>
<period>D</period>
<dayType>Business</dayType>
<businessDayConvention>NONE</businessDayConvention>
<businessCenters>
<businessCenter>GBLO</businessCenter>
</businessCenters>
<dateRelativeTo href="resetDates"/>
</fixingDates>
<resetFrequency>
<periodMultiplier>6</periodMultiplier>
<period>M</period>
</resetFrequency>
<resetDatesAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCentersReference
href="primaryBusinessCenters"/>
</resetDatesAdjustments>
</resetDates>
<calculationPeriodAmount>
<calculation>
<notionalSchedule>
<notionalStepSchedule>
<initialValue>50000000.00</initialValue>
<currency
currencyScheme="
http://www.fpml.org/ext/iso4217">DEM</currency>
</notionalStepSchedule>
</notionalSchedule>
<floatingRateCalculation>
<floatingRateIndex>DEM-LIBOR-BBA</floatingRateIndex>
<indexTenor>
<periodMultiplier>6</periodMultiplier>
<period>M</period>
</indexTenor>
</floatingRateCalculation>
<dayCountFraction
dayCountFractionScheme="
http://www.fpml.org/spec/2004/day-count-fraction-1-0">ACT/360</dayCountFraction>
</calculation>
</calculationPeriodAmount>
</swapStream>
<!-- Barclays pays the 6% fixed rate every year on
a 30E/360 basis -->
<swapStream>
<payerPartyReference href="BARCLAYS"/>
<receiverPartyReference href="CHASE"/>
<calculationPeriodDates id="fixedCalcPeriodDates">
<effectiveDate>
<unadjustedDate>1994-12-14</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</effectiveDate>
<terminationDate>
<unadjustedDate>1999-12-14</unadjustedDate>
<dateAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCentersReference
href="primaryBusinessCenters"/>
</dateAdjustments>
</terminationDate>
<calculationPeriodDatesAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCentersReference
href="primaryBusinessCenters"/>
</calculationPeriodDatesAdjustments>
<calculationPeriodFrequency>
<periodMultiplier>1</periodMultiplier>
<period>Y</period>
<rollConvention>14</rollConvention>
</calculationPeriodFrequency>
</calculationPeriodDates>
<paymentDates>
<calculationPeriodDatesReference
href="fixedCalcPeriodDates"/>
<paymentFrequency>
<periodMultiplier>1</periodMultiplier>
<period>Y</period>
</paymentFrequency>
<payRelativeTo>CalculationPeriodEndDate</payRelativeTo>
<paymentDatesAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
<businessCentersReference
href="primaryBusinessCenters"/>
</paymentDatesAdjustments>
</paymentDates>
<calculationPeriodAmount>
<calculation>
<notionalSchedule>
<notionalStepSchedule>
<initialValue>50000000.00</initialValue>
<currency
currencyScheme="
http://www.fpml.org/ext/iso4217">DEM</currency>
</notionalStepSchedule>
</notionalSchedule>
<fixedRateSchedule>
<initialValue>0.06</initialValue>
</fixedRateSchedule>
<dayCountFraction
dayCountFractionScheme="
http://www.fpml.org/spec/2004/day-count-fraction-1-0">30E/360</dayCountFraction>
</calculation>
</calculationPeriodAmount>
</swapStream>
</swap>
</trade>
<party id="CHASE">
<partyId>CHASUS33</partyId>
</party>
<party id="BARCLAYS">
<partyId>BARCGB2L</partyId>
</party>
</FpML>
Thanks,
Hunter