- Dennis
Robert Augustyn wrote:
Hi,
I am not able to get the simplest test to work :( and would appreciate your help.
I am able to successfully bind and then when I run test it fails on
ibf = BindingDirectory.getFactory(bin,target);
What gives? I must be doing something fundamentally wrong but I have searched the list and did not find anything on the subject.
I know that methods got successfully added to the class ....
Thanks for taking the time ...
this is an error:
Unable to access binding information for class com.unisys.tmp.Customer
org.jibx.runtime.JiBXException: Unable to access binding information for class com.unisys.tmp.Customer
Root cause: java.lang.NoSuchFieldException: JiBX_bindingList
at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:107)
at com.unisys.tmp.Test.main(Test.java:16)
Caused by: java.lang.NoSuchFieldException: JiBX_bindingList
at java.lang.Class.getField0(Class.java:1735)
....
Source of my test.java
IBindingFactory ibf = null;
Class target = com.unisys.tmp.Customer.class;
Customer cust = new Customer();
String bin = "H:\\jdev905\\jdev\\mywork\\Workspace1\\jix\\classes\\com\\unisys\\tmp\\binding.xml";
try {
ibf = BindingDirectory.getFactory(bin,target);
IUnmarshallingContext uctx = ibf.createUnmarshallingContext();
Object obj = uctx.unmarshalDocument(new FileInputStream(
"H:\\jdev905\\jdev\\mywork\\Workspace1\\jix\\classes\\com\\unisys\\tmp\\data.xml"),
null);
if (!target.isInstance(obj)) {
System.err.println("Unmarshalled result not expected type");
}
} catch (JiBXException ex1) {
System.err.println(ex1.getMessage());
}
<binding>
<mapping name="customer" class="com.unisys.tmp.Customer">
<value name="first-name" field="firstName"/>
<value name="last-name" field="lastName"/>
</mapping>
</binding>
<customer>
<first-name>John</first-name>
<last-name>Smith</last-name>
</customer>
package com.unisys.tmp;
public class Customer {
public String firstName;
public String lastName;
}
Buildfile: H:\jdev905\jdev\mywork\Workspace1\jix\src\build1.xml
[bind] Using the following paths:
[bind] H:\jdev905\jdev\mywork\Workspace1\jix\classes
[bind] H:\jdev905\java\jibx\lib\jibx-run.jar
[bind] Using the following binding paths:
[bind] com/unisys/tmp/binding.xml
[bind] binding com_unisys_tmp_binding:
[bind] context (mp#=1) (cv#=0) (fm#=0)
[bind] mapping class com.unisys.tmp.Customer to element customer
[bind] element wrapper customer
[bind] object binding for com.unisys.tmp.Customer
[bind] structure ordered
[bind] element first-name from property firstName (java.lang.String)
[bind] element last-name from property lastName (java.lang.String)
[bind]
[bind] Wrote 3 files
[bind]
[bind] com.unisys.tmp.Customer output file size is 2570 bytes
[bind] Found 6 methods:
[bind] void marshal
[bind] void unmarshal
[bind] int JiBX_getIndex
[bind] com.unisys.tmp.Customer JiBX_com_unisys_tmp_binding_newinstance_1_0
[bind] void JiBX_com_unisys_tmp_binding_unmarshal_1_0
[bind] void JiBX_com_unisys_tmp_binding_marshal_1_0
[bind]
[bind] com.unisys.tmp.JiBX_com_unisys_tmp_bindingCustomer_access output file size is 1927 bytes
[bind] Found 4 methods:
[bind] void marshal
[bind] java.lang.Object unmarshal
[bind] boolean isPresent
[bind] boolean isExtension
[bind]
[bind] com.unisys.tmp.JiBX_com_unisys_tmp_bindingFactory output file size is 1539 bytes
[bind] Found 3 methods:
[bind] org.jibx.runtime.IBindingFactory getInstance
[bind] org.jibx.runtime.IMarshallingContext createMarshallingContext
[bind] org.jibx.runtime.IUnmarshallingContext createUnmarshallingContext
[bind]
[bind] Kept 0 files unchanged:
[bind]
[bind] Deleted 0 files:
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users
