Hi!

I have a big problem marshalling/unmarshalling with JiBX. The error I get
is:

Exception in thread "main" Incompatible binding version for class
com.my.utils.ja.person.Person, recompile binding with current JiBX
distribution
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:618)
        at
org.jibx.runtime.BindingDirectory.getFactoryFromName(BindingDirectory.java:106)
        at 
org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:215)
        at com.my.utils.ja.TestMarshallUtils.main(TestMarshallUtils.java:24)
Caused by: java.lang.NoSuchMethodError:
org/jibx/runtime/impl/RuntimeSupport.splitClassNames(ILjava/lang/String;)[Ljava/lang/String;
        at com.my.utils.ja.person.JiBX_bindingFactory.<init>()
        at com.my.utils.ja.person.JiBX_bindingFactory.getInstance()
        ... 7 more


Anyone knows how can I solve this?


XML:
<?xml version=\"1.0\"
encoding=\"UTF-8\"?><Person><name>name</name><lastName>lastName</lastName><birth>2001-12-31T12:00:00</birth></Person>

XSD:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
        <xsd:element name="Person">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name="name">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="lastName">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="birth">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:dateTime">
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="age" minOccurs="0">
                                        <xsd:simpleType>
                                                <xsd:restriction base="xsd:int" 
/>
                                        </xsd:simpleType>
                                </xsd:element>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
</xsd:schema>

BINDING XML:
<binding name="binding" package="com.my.utils.ja.person">
  <mapping class="com.my.utils.ja.person.Person" name="Person">
    <value style="element" name="name" get-method="getName"
set-method="setName"/>
    <value style="element" name="lastName" get-method="getLastName"
set-method="setLastName"/>
    <value style="element" name="birth" get-method="getBirth"
set-method="setBirth"/>
    <value style="element" name="age" get-method="getAge"
set-method="setAge" usage="optional"/>
  </mapping>
</binding>

JAVA CODE:
String xml = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><Person><name>name</name><lastName>lastName</lastName><birth>2001-12-31T12:00:00</birth></Person>";
                
StringReader reader = new StringReader(xml);
                
Object o = new Object();
try {
    IBindingFactory bfact = BindingDirectory.getFactory(Person.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
    o = uctx.unmarshalDocument(reader, null);
} finally {
    if (reader != null) {
        reader.close();
        reader = null;
    }
}
            
// to object
Person p = (Person) o;
System.out.println("*** PERSON ***");
System.out.println("name: " + p.getName());
System.out.println("lastName: " + p.getLastName());
System.out.println("birth: " + p.getBirth());
System.out.println("age: " + p.getAge());
-- 
View this message in context: 
http://www.nabble.com/Incompatible-binding-version-tp22772699p22772699.html
Sent from the jibx-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to