Hi,

I'm a newbie to JIBX and I'm starting to prototype with it to see if we can use it as our xml binding solution. All has worked well with our object model until I ran a binding test using a Hibernate generated object. I'm getting the following exception when marshalling:

java.lang.ClassCastException: org.prx.user.UserImpl$$EnhancerByCGLIB$ $4c56d3d
        at org.prx.user.JiBX_piece_bindingProducer_access.marshal()
at org.prx.piece.AbstractPieceImpl.JiBX_piece_binding_marshal_2_3 (AbstractPieceImpl.java) at org.prx.piece.PieceImpl.JiBX_piece_binding_marshal_3_2 (PieceImpl.java)
        at org.prx.piece.JiBX_piece_bindingPieceImpl_access.marshal()
        at org.prx.piece.PieceImpl.marshal(PieceImpl.java)
        at org.jibx.runtime.impl.MarshallingContext.marshalRoot(Unknown Source)
at org.jibx.runtime.impl.MarshallingContext.marshalDocument(Unknown Source) at org.prx.piece.PieceManagerTest.testGet5NewPieces (PieceManagerTest.java:62)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main (JUnitStarter.java:32)

I read this post: http://www.mail-archive.com/jibx- [EMAIL PROTECTED]/msg01042.html and changed all my mappings over to use the get/set-method instead of fields but I am still getting the exception above. Does it have to do with the abstract mappings?

My mapping file is below and any help would be appreciated.

-thanks
-matt

<binding>

    <namespace uri="http://www.prx.org"; default="elements"/>

    <!-- Piece Mapping -->
    <mapping class="org.prx.piece.AbstractPieceImpl" abstract="true">
        <value name="id" get-method="getId" set-method="setId"/>
<value name="title" get-method="getTitle" set- method="setTitle"/> <value name="createdDate" get-method="getCreateDate" set- method="setCreateDate"/>

        <structure get-method="getExtras" set-method="setExtras">
<value name="fullDescription" get- method="getFullDescription" set-method="setFullDescription"/> <value name="producers" get-method="getProducers" set- method="setProducers"/>
        </structure>

<structure get-method="getCreator" set-method="setCreator" map-as="org.prx.user.Producer"/> <structure get-method="getImage" set-method="setImage" map- as="org.prx.dropbox.ImageFile"/> <structure get-method="getLanguage" set-method="setLanguage" map-as="org.prx.util.Language"/>

<collection name="adjectives" get-method="getAdjectives" set- method="setAdjectives" type="java.util.TreeSet">
            <structure type="org.prx.adjective.AdjectiveImpl"/>
        </collection>

<collection name="topics" get-method="getTopics" set- method="setTopics" type="java.util.HashSet">
            <structure type="org.prx.piece.category.TopicCategory"/>
        </collection>

<collection name="types" get-method="getTypes" set- method="setTypes" type="java.util.HashSet">
            <structure type="org.prx.piece.category.TypeCategory"/>
        </collection>
    </mapping>

<mapping name="piece" class="org.prx.piece.PieceImpl" extends="org.prx.piece.AbstractPieceImpl">
        <structure map-as="org.prx.piece.AbstractPieceImpl"/>

<value name="discount" get-method="getDiscount" set- method="setDiscount"/> <value name="runningTime" get-method="getRunningTime" set- method="setRunningTime"/>

    </mapping>
    <!-- End Piece Mapping -->


    <!-- Members -->
    <mapping class="org.prx.user.MemberImpl" abstract="true">
        <value name="id" get-method="getId" set-method="setId"/>
<value name="username" get-method="getUsername" set- method="setUsername"/>
    </mapping>

    <mapping class="org.prx.user.UserImpl" abstract="true">
        <structure map-as="org.prx.user.MemberImpl"/>
<value name="firstName" get-method="getFirstName" set- method="setFirstName"/>
    </mapping>

<mapping name="creator" class="org.prx.user.Producer" extends="org.prx.user.UserImpl">
        <structure map-as="org.prx.user.UserImpl"/>
    </mapping>
    <!-- End Member Mapping -->


    <!-- Files -->
    <mapping name="image" class="org.prx.dropbox.ImageFile">
        <value name="url" get-method="getURL" set-method="setURL"/>
<value name="resized" get-method="isResized" set- method="setResized"/>
    </mapping>


    <!-- Categories -->
<mapping class="org.prx.piece.category.PieceCategoryImpl" abstract="true">
        <value name="id" get-method="getId" set-method="setId"/>
        <value name="name" get-method="getName" set-method="setName"/>
    </mapping>

<mapping name="topic" class="org.prx.piece.category.TopicCategory" extends="org.prx.piece.category.PieceCategoryImpl">
        <structure map-as="org.prx.piece.category.PieceCategoryImpl"/>
    </mapping>

<mapping name="type" class="org.prx.piece.category.TypeCategory" extends="org.prx.piece.category.PieceCategoryImpl">
        <structure map-as="org.prx.piece.category.PieceCategoryImpl"/>
    </mapping>
    <!-- End Categories -->


    <!-- Adjectives -->
    <mapping name="adjective" class="org.prx.adjective.AdjectiveImpl">
        <value name="id" get-method="getId" set-method="setId"/>
<value name="value" get-method="getAdjective" set- method="setAdjective"/>
    </mapping>
    <!-- End Adjectives -->


    <!-- Language -->
    <mapping name="language" class="org.prx.util.Language">
        <value name="id" get-method="getId" set-method="setId"/>
        <value name="name" get-method="getName" set-method="setName"/>
    </mapping>
    <!-- End Language -->

</binding>




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to