Hello all.  I have been trying to bind a simple class and am getting an exception.  Any suggestions/tips would be greatly appreciated.  Below is the binding and class snippet followed by the exception.

<binding>
  <mapping name="BondCashFlows" class="BondSen">
    <collection field="cflows"/>
  </mapping>
  <mapping name="cashflow" class="BondCashFlows">
    <value name="date" field="date"/>
    <value name="amount" field="amount"/>
    <value name="amount2" field="amount2"/>
    <value name="amount3" field="amount3"/>
    <value name="amount4" field="amount4"/>
  </mapping>
</binding>


public class BondSen {
        public List cflows;

public class BondCashFlows {

        public BondCashFlows() {}
       
        public String date;
        public String amount;
        public String amount2;
        public String amount3;
        public String amount4;
}
       
exception thrown:

org.jibx.runtime.JiBXException: Need no-argument constructor or factory for java.util.List
        at org.jibx.binding.def.ObjectBinding.genNewInstanceCode(ObjectBinding.java:393)
        at org.jibx.binding.def.ObjectBinding.genNewInstanceCall(ObjectBinding.java:432)
        at org.jibx.binding.def.ObjectBinding.genNewInstance(ObjectBinding.java:884)
        at org.jibx.binding.def.ComponentProperty.genContentUnmarshal(ComponentProperty.java:233)
        at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:153)
        at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:736)
        at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:875)
        at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:272)
        at org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:541)
        at org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:600)
        at org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:578)
        at org.jibx.binding.Compile.compile(Compile.java:303)
        at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
        at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
        at org.apache.commons.jelly.tags.core.OtherwiseTag.doTag(OtherwiseTag.java:87)
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
        at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
        at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:84)
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
        at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
        at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
        at com.werken.werkz.Goal.fire(Goal.java:639)
        at com.werken.werkz.Goal.attain(Goal.java:575)
        at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
        at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
        at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
        at com.werken.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:87)
        at com.werken.werkz.Goal.firePostGoalCallbacks(Goal.java:710)
        at com.werken.werkz.Goal.fire(Goal.java:654)
        at com.werken.werkz.Goal.attain(Goal.java:575)
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
        at com.werken.werkz.Goal.attain(Goal.java:573)
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
        at com.werken.werkz.Goal.attain(Goal.java:573)
        at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
        at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
        at org.apache.maven.cli.App.doMain(App.java:488)
        at org.apache.maven.cli.App.main(App.java:1239)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)



I have tried the same example with the generic Collection interface which is ultimately preferred, however get the same exception except for class java.util.Collection.  If I use an ArrayList however it works fine.  Anyone else experiencing/experienced this same problem?  Did I miss something?

Many thanks for any suggestions/tips!

sns

This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates.

Reply via email to