I want to remap some built-in structures to improve maintenance of mine
bindings collection. After some readings on JiBX tutorial and forums i found
options how to solve this task. So, i selected one binding file from mine
bindings collection and started refactoring it. I created abstract mappings
of most recurrent structures and added them to separate files. New binding
validation is successful, but there are errors during compilation. JiBX
maven plugin tells me:

"Caused by: org.apache.maven.plugin.MojoExecutionException:
*** Error during code generation for file 'C:\Works\My SVN repositories\
maven.skg.pl\MDAS\src\mvn_projects\trunk\MDASTraderPortalDomain\src\main\resources\jibxBindings\IE507LT-binding.xml'
- please enter a bug report for this error in Jira if the problem is not
listed as fixed on the online status page ***

    at org.jibx.maven.JibxMojo.compile(JibxMojo.java:225)
    at org.jibx.maven.JibxMojo.execute(JibxMojo.java:174)
    at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
    ... 16 more
Caused by: org.jibx.runtime.JiBXException:
*** Error during code generation for file 'C:\Works\My SVN repositories\
maven.skg.pl\MDAS\src\mvn_projects\trunk\MDASTraderPortalDomain\src\main\resources\jibxBindings\IE507LT-binding.xml'
- please enter a bug report for this error in Jira if the problem is not
listed as fixed on the online status page ***

    at org.jibx.binding.Compile.compile(Compile.java:307)
    at org.jibx.maven.JibxMojo.compile(JibxMojo.java:222)
    ... 19 more"

I tried to compile this new binding directly:

"Error running binding compiler

*** Error during code generation for file 'IE507LT-binding.xml' - please
enter a bug report for this error in Jira if the problem is not listed as
fixed on the online status page ***

org.jibx.runtime.JiBXException: One or more <mapping> elements for
modifiable classes must be defined in <binding>
        at org.jibx.binding.Utility.loadBinding(Utility.java:317)
        at org.jibx.binding.Utility.loadFileBinding(Utility.java:408)
        at org.jibx.binding.Compile.compile(Compile.java:296)
        at org.jibx.binding.Compile.main(Compile.java:385)"

Any suggestion how to solve this problem? Any advise is acceptable.

NOTE.

******************************

1. I'm using JiBX 1.1.6a and Java 1.6 (compilation target equals to 1.5).

******************************

2. Working IE507LT-binding.xml binding:

<?xml version="1.0" encoding="UTF-8"?>
<binding name="IE507LT">

  <mapping name="IE507LT" class="com.skg.icdts.base.model.MessageImpl">

       <structure name="Header" usage="required">

        <structure set-method="setDocument" get-method="getDocument"
type="com.skg.icdts.doc.exportdeclooext.model.ExportDeclOoExtImpl">

            <structure name="ExitCarrier" usage="required">

                <structure set-method="setExitCarrier"
get-method="getExitCarrier"  type="com.skg.icdts.common.model.TraderImpl">

                    <value name="tin" set-method="setTin"
get-method="getTin" usage="required" style="attribute"/>
                    <value name="name" set-method="setName"
get-method="getName" usage="optional" style="attribute"/>
                    <value name="streetAndNumber"
set-method="setStreetAndNumber" get-method="getStreetAndNumber"
usage="optional" style="attribute"/>
                    <value name="postalCode" set-method="setPostalCode"
get-method="getPostalCode" usage="optional" style="attribute"/>
                    <value name="city" set-method="setCity"
get-method="getCity" usage="optional" style="attribute"/>
                    <value name="countryCode" set-method="setCountryCode"
get-method="getCountryCode" usage="optional" style="attribute"/>
                    <value name="nadLNG" set-method="setNadLNG"
get-method="getNadLNG" usage="optional" style="attribute"/>

                </structure>

            </structure>

            <structure name="ActualExitCustomsOffice" usage="required">

                  <structure set-method="setOfficeOfExit"
get-method="getOfficeOfExit"
type="com.skg.icdts.common.model.CustomsOfficeImpl">

                    <value name="referenceNumber"
set-method="setReferenceNumber" get-method="getReferenceNumber"
usage="required" style="attribute"/>

                  </structure>

            </structure>

            <value name="mrn" set-method="setMrn" get-method="getMrn"
usage="required" style="attribute"/>
            <value name="arrivalAgreedLocationCode"
set-method="setArrivalAgreedLocationCode"
get-method="getArrivalAgreedLocationCode" usage="optional"
style="attribute"/>
            <value name="arrivalAgreedLocationOfGoods"
set-method="setArrivalAgreedLocationOfGoods"
get-method="getArrivalAgreedLocationOfGoods" usage="optional"
style="attribute"/>
            <value name="arrivalAgreedLocationOfGoodsLNG"
set-method="setArrivalAgreedLocationOfGoodsLNG"
get-method="getArrivalAgreedLocationOfGoodsLNG" usage="optional"
style="attribute"/>
            <value name="customsSubPlace" set-method="setCustomsSubPlace"
get-method="getCustomsSubPlace" usage="optional" style="attribute"/>
            <value name="storingFlag" set-method="setStoringFlag"
get-method="getStoringFlag" usage="required" style="attribute"
serializer="eu.erp.mdas.jibx.hibernate.TrueFalselEnumHelper.TrueFalseToString"
deserializer="eu.erp.mdas.jibx.hibernate.TrueFalselEnumHelper.StringToTrueFalse"/>
            <value name="authorisedStoringLocationOfGoods"
set-method="setAuthorisedStoringLocationOfGoods"
get-method="getAuthorisedStoringLocationOfGoods" usage="optional"
style="attribute"/>
            <value name="dialogLanguageAtDestination"
set-method="setDialogLanguageAtDestination"
get-method="getDialogLanguageAtDestination" usage="optional"
style="attribute"/>
            <value name="arrivalNotificationDate"
set-method="setArrivalNotificationDate"
get-method="getArrivalNotificationDate" usage="required" style="attribute"
serializer="com.skg.tools.date.DateHelper.dateToString"
deserializer="com.skg.tools.date.DateHelper.stringToDate"/>
            <value name="arrivalNotificationPlace"
set-method="setArrivalNotificationPlace"
get-method="getArrivalNotificationPlace" usage="required"
style="attribute"/>
            <value name="arrivalNotificationPlaceLNG"
set-method="setArrivalNotificationPlaceLNG"
get-method="getArrivalNotificationPlaceLNG" usage="optional"
style="attribute"/>

        </structure>

    </structure>

    <value name="messageId" set-method="setMessageId"
get-method="getMessageId" usage="required" style="attribute"/>

  </mapping>

</binding>

******************************

3. Refactored E507LT-binding.xml (not working any more):

<?xml version="1.0" encoding="UTF-8"?>
<binding name="IE507LT">

  <include path="ExitCarrier.xml"/>

  <include path="ActualExitCustomsOffice.xml"/>

  <mapping name="IE507LT" class="com.skg.icdts.base.model.MessageImpl">

      <structure name="Header" usage="required">

        <structure set-method="setDocument" get-method="getDocument"
type="com.skg.icdts.doc.exportdeclooext.model.ExportDeclOoExtImpl">

            <structure name="ExitCarrier" usage="required">

                <structure set-method="setExitCarrier"
get-method="getExitCarrier"  map-as="ExitCarrier"/>

            </structure>

            <structure name="ActualExitCustomsOffice" usage="required">

                  <structure set-method="setOfficeOfExit"
get-method="getOfficeOfExit" map-as="ActualExitCustomsOffice"/>

            </structure>

            <value name="mrn" set-method="setMrn" get-method="getMrn"
usage="required" style="attribute"/>
            <value name="arrivalAgreedLocationCode"
set-method="setArrivalAgreedLocationCode"
get-method="getArrivalAgreedLocationCode" usage="optional"
style="attribute"/>
            <value name="arrivalAgreedLocationOfGoods"
set-method="setArrivalAgreedLocationOfGoods"
get-method="getArrivalAgreedLocationOfGoods" usage="optional"
style="attribute"/>
            <value name="arrivalAgreedLocationOfGoodsLNG"
set-method="setArrivalAgreedLocationOfGoodsLNG"
get-method="getArrivalAgreedLocationOfGoodsLNG" usage="optional"
style="attribute"/>
            <value name="customsSubPlace" set-method="setCustomsSubPlace"
get-method="getCustomsSubPlace" usage="optional" style="attribute"/>
            <value name="storingFlag" set-method="setStoringFlag"
get-method="getStoringFlag" usage="required" style="attribute"
serializer="eu.erp.mdas.jibx.hibernate.TrueFalselEnumHelper.TrueFalseToString"
deserializer="eu.erp.mdas.jibx.hibernate.TrueFalselEnumHelper.StringToTrueFalse"/>
            <value name="authorisedStoringLocationOfGoods"
set-method="setAuthorisedStoringLocationOfGoods"
get-method="getAuthorisedStoringLocationOfGoods" usage="optional"
style="attribute"/>
            <value name="dialogLanguageAtDestination"
set-method="setDialogLanguageAtDestination"
get-method="getDialogLanguageAtDestination" usage="optional"
style="attribute"/>
            <value name="arrivalNotificationDate"
set-method="setArrivalNotificationDate"
get-method="getArrivalNotificationDate" usage="required" style="attribute"
serializer="com.skg.tools.date.DateHelper.dateToString"
deserializer="com.skg.tools.date.DateHelper.stringToDate"/>
            <value name="arrivalNotificationPlace"
set-method="setArrivalNotificationPlace"
get-method="getArrivalNotificationPlace" usage="required"
style="attribute"/>
            <value name="arrivalNotificationPlaceLNG"
set-method="setArrivalNotificationPlaceLNG"
get-method="getArrivalNotificationPlaceLNG" usage="optional"
style="attribute"/>

        </structure>

    </structure>

    <value name="messageId" set-method="setMessageId"
get-method="getMessageId" usage="required" style="attribute"/>

  </mapping>

</binding>


<?xml version="1.0" encoding="UTF-8"?>
<binding>

    <mapping class="com.skg.icdts.common.model.TraderImpl"
type-name="ExitCarrier" abstract="true">

        <value name="tin" set-method="setTin" get-method="getTin"
usage="required" style="attribute"/>
        <value name="name" set-method="setName" get-method="getName"
usage="optional" style="attribute"/>
        <value name="streetAndNumber" set-method="setStreetAndNumber"
get-method="getStreetAndNumber" usage="optional" style="attribute"/>
        <value name="postalCode" set-method="setPostalCode"
get-method="getPostalCode" usage="optional" style="attribute"/>
        <value name="city" set-method="setCity" get-method="getCity"
usage="optional" style="attribute"/>
        <value name="countryCode" set-method="setCountryCode"
get-method="getCountryCode" usage="optional" style="attribute"/>
        <value name="nadLNG" set-method="setNadLNG" get-method="getNadLNG"
usage="optional" style="attribute"/>

    </mapping>

</binding>

ExitCarrier.xml:

<?xml version="1.0" encoding="UTF-8"?>
<binding>

    <mapping class="com.skg.icdts.common.model.TraderImpl"
type-name="ExitCarrier" abstract="true">

        <value name="tin" set-method="setTin" get-method="getTin"
usage="required" style="attribute"/>
        <value name="name" set-method="setName" get-method="getName"
usage="optional" style="attribute"/>
        <value name="streetAndNumber" set-method="setStreetAndNumber"
get-method="getStreetAndNumber" usage="optional" style="attribute"/>
        <value name="postalCode" set-method="setPostalCode"
get-method="getPostalCode" usage="optional" style="attribute"/>
        <value name="city" set-method="setCity" get-method="getCity"
usage="optional" style="attribute"/>
        <value name="countryCode" set-method="setCountryCode"
get-method="getCountryCode" usage="optional" style="attribute"/>
        <value name="nadLNG" set-method="setNadLNG" get-method="getNadLNG"
usage="optional" style="attribute"/>

    </mapping>

</binding>

ActualExitCustomsOffice.xml:

<?xml version="1.0" encoding="UTF-8"?>
<binding>

    <mapping class="com.skg.icdts.common.model.CustomsOfficeImpl"
type-name="ActualExitCustomsOffice" abstract="true">

        <value name="referenceNumber" set-method="setReferenceNumber"
get-method="getReferenceNumber" usage="required" style="attribute"/>

    </mapping>

</binding>


******************************

Best regards,
Aurelijus J.
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to