I built multiple binding files that fully worked in JUnit tests and now they are failing when trying to bind and xml to java object. This project is about to go into production and none of the files have been modified (classes, bindings, or the binder that use the JiBX classes).

Here is the binding code:

   public ErrorResponseTO unmarshalToObject(String xml)
     throws XmlBinderException {
       return (ErrorResponseTO) XmlBinderHelper.unmarshal(new ErrorResponseTO(), new ByteArrayInputStream( xml.getBytes()), "UTF-8");
   }
  
  
  
   Object unmarshal(Object object, InputStream stream, String enc)
      throws XmlBinderException {
        try {
            IBindingFactory bfact = BindingDirectory.getFactory(object.getClass());
            IUnmarshallingContext ctx = bfact.createUnmarshallingContext();
            return ctx.unmarshalDocument(stream, enc);
        }
        catch(JiBXException e) {
            throw new XmlBinderException(e);
        }
   }

Here is my binding file:

<binding direction="both" forwards="false" package="com.foo.hnfs.bene.databinding" value-style="element">
    <format type="com.foo.hnfs.common.util.DateTime"
        serializer="com.foo.hnfs.common.util.DateTime.serialize"
        deserializer="com.foo.hnfs.common.util.DateTime.deserialize "/>
    <mapping name="AppBody" class="com.foo.hnfs.bene.to.ErrorResponseTO">
        <structure name="TxnInfo"/>
        <structure field="errorInfo" usage="optional"/>
    </mapping>
    <mapping name="ErrorInfo" class="com.foo.hnfs.bene.to.ErrorInfoTO">
        <value name="ErrorType" field="errorType" usage="optional"/>
        <value name="ErrorMsgUser" field="userMessage" usage="optional"/>
        <value name="ErrorMsgTechnical" field="technicalMessage" usage="optional"/>
        <value name="ErrorCode" field="errorCode" usage="optional"/>
    </mapping>
</binding>

Here is the error (note...JiBX does not create an object called com.foo.hnfs.bene.to.JiBX_ErrorDeersResponseBindingErrorResponseTO_access...so why is JiBX requesting it?)

com.foo.hnfs.common.exception.XmlBinderException: org.jibx.runtime.JiBXException: Unable to load unmarshaller class com.foo.hnfs.bene.to.JiBX_ErrorDeersResponseBindingErrorResponseTO_access
    at com.foo.hnfs.common.xml.databinding.JibxXmlBinder.unmarshal(JibxXmlBinder.java:127)
    at com.foo.hnfs.common.xml.databinding.XmlBinderHelper.mapXmlToObject (XmlBinderHelper.java:283)
    at com.foo.hnfs.bene.databinding.ErrorResponseDataBinder.unmarshalToObject(ErrorResponseDataBinder.java:87)
    at com.foo.hnfs.bene.DeersBinderTest.testErrorResults(DeersBinderTest.java :911)
    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 junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run (TestCase.java:118)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.jibx.runtime.JiBXException: Unable to load unmarshaller class com.foo.hnfs.bene.to.JiBX_ErrorDeersResponseBindingErrorResponseTO_access
    at org.jibx.runtime.impl.UnmarshallingContext.getUnmarshaller(Unknown Source)
    at org.jibx.runtime.impl.UnmarshallingContext.getUnmarshaller(Unknown Source)
    at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement (Unknown Source)
    at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unknown Source)
    at com.foo.hnfs.common.xml.databinding.JibxXmlBinder.unmarshal(JibxXmlBinder.java:124)
    ... 16 more

Thank you so much for your help!

--
jay blanton
[EMAIL PROTECTED]
(c) 916-715-1529
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to