Random occurrence of the exception - org.jibx.runtime.JiBXException: Unable to access binding information for class

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown Random occurrence of the exception - org.jibx.runtime.JiBXException: Unable to access binding information for class

by Sundeep Malali :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I am using Jibx for marshalling / unmarshalling Java objects. I am randomly running into the exception -  "org.jibx.runtime.
JiBXException: Unable to access binding information for class". I do not face this exception every time the object is marshalled. It happens only sometimes and that too randomly.

I have basically have 2 simple classes Area and City, where Area has a reference of City in it. I use hibernate queries to load a list of Area objects based on a City selected.

The bindings for the objects are given below.

  <mapping class="com.redbus.homedelivery.orm.Area1" name="area1">
    <value style="element" name="area-id" field="areaId" usage="optional" get-method="getAreaId" set-method="setAreaId"/>
    <value style="element" name="area-name" field="areaName" usage="optional" get-method="getAreaName" set-method="setAreaName"/>
    <value style="element" name="pincode" field="pincode" usage="optional" get-method="getPincode" set-method="setPincode"/>
    <structure field="city1" usage="optional" get-method="getCity1" set-method="setCity1"/>
  </mapping>
  <mapping class="com.redbus.homedelivery.orm.City1" name="city1">
    <value style="element" name="city-id" field="cityId" usage="optional" get-method="getCityId" set-method="setCityId"/>
    <value style="element" name="city-name" field="cityName" usage="optional" get-method="getCityName" set-method="setCityName"/>   
  </mapping>

I use the following ant task to compile the bindings.

    <target name="bind" depends="compile">
        <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
            <classpath>
                <fileset dir="${lib}" includes="*.jar"/>
            </classpath>
        </taskdef>
        <bind verbose="true" load="true" binding="${config.dir.core}/jibx_binding/binding.xml">
            <classpath>
                <pathelement path="${build.classes.dir}"/>
                <pathelement location="${lib}/jibx-run.jar"/>
            </classpath>
        </bind>
    </target>

One thing to note is, my objects are compiled into the same location where the jibx bindings are compiled. In this case, I have both
Area1.class and JiBX_HomeDelivery_hd_core_src_main_config_jibx_binding_bindingArea1_access.class (generated class) under the same classes folder in Tomcat WEB-INF.

Another point is, some of the properties in other objects share the same name with the Area classs. For e.g, area is a property of another object Address.

I use the following code snippet to generate the xml -

IBindingFactory bfact;
bfact = BindingDirectory.getFactory(obj.getClass());
// marshal root object back out to document in memory
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setIndent(2);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
mctx.marshalDocument(obj, "UTF-8", null, bos);
xml = new String(bos.toByteArray(),"UTF-8");

Can anyone throw some light on what may be the issue ?

Thanks in advance.

Regds
Sundeep


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
jibx-users@...
https://lists.sourceforge.net/lists/listinfo/jibx-users
LightInTheBox - Buy quality products at wholesale price!