-1

Project Set Up:

Project Domains contains all domain Object with No jibx configuration.

Class A {
  List<A> list;
}

Project JibxTest contains jibx configuration and its contains Domains.jar

When we try configured the binding.xml in Project JibxTest as following:

<binding>
    <mapping name="A" class="Domains.A" ordered="false">
          <collection item-type="Domains.A" field="list" usage="optional" create- type="java.util.ArrayList"/> 
    </mapping>
</binding>  

we are getting JIBX exception :

Error during code generation for file 'C:\JIBXTest/binding.xml' -
     [bind]  this may be due to an error in your binding or classpath, or to an error in the JiBX code ***
     [bind] java.lang.IllegalStateException: Internal error - cannot modify class Domains.A loaded from C:\JIBXTest\lib\Domains.jar

When we copy the Domain.A class in to JibxTest project and modify the binding file. It works.

Robin Green
  • 32,079
  • 16
  • 104
  • 187

1 Answers1

-5

Per this email:

JiBX should be able to work with the classes in the jar as long as you're only using public fields or methods. If the fields aren't public, you need to either switch to public get/set methods (if available) or unjar the class files so that the JiBX binding compiler can modify them.

In Java it is standard to have getters and setters, so I suggest you add those.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Robin Green
  • 32,079
  • 16
  • 104
  • 187