Hello, 
Hopefully someone can help me with an error I'm struggling with while trying
to use precompiled bindings. I'm trying to create a simple prototype where I
have a compiled binding/class in a jar file that is used as a dependency of
another project containing a binding and a class which extends a class
contained in the jar file. The jar contains a class Person, and the
jibx_bindingfactory compiled class that goes with it. The dependant project
contains a class Customer that extends Person, and binding.xml and
person-binding.xml mapping files. 

Im getting the error below when I try to run a build shared library/compile
bindings task:

[java] java.lang.IllegalStateException: Internal error - cannot modify class
com.accenture.apsp.crossjardepend.Person loaded from D:\Projects\APSP_int
egration\CrossJarDependency\lib\person-shared.jar
     [java]     at
org.jibx.binding.classes.ClassFile.getClassGen(ClassFile.java:1283)
     [java]     at
org.jibx.binding.classes.ClassFile.getInstructionBuilder(ClassFile.java:1308)
     [java]     at
org.jibx.binding.classes.MethodBuilder.<init>(MethodBuilder.java:168)
     [java]     at
org.jibx.binding.classes.ExceptionMethodBuilder.<init>(ExceptionMethodBuilder.java:59)
     [java]     at
org.jibx.binding.classes.BoundClass.getStoreMethod(BoundClass.java:237)
     [java]     at
org.jibx.binding.def.PropertyDefinition.genStore(PropertyDefinition.java:699)
     [java]     at
org.jibx.binding.def.ValueChild.genUnmarshal(ValueChild.java:593)
     [java]     at
org.jibx.binding.def.ValueChild.genContentUnmarshal(ValueChild.java:885)
     [java]     at
org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:215)
     [java]     at
org.jibx.binding.def.ObjectBinding.genUnmarshalContentMethod(ObjectBinding.java:882)
     [java]     at
org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:1078)
     [java]     at
org.jibx.binding.def.ComponentProperty.genContentUnmarshal(ComponentProperty.java:299)
     [java]     at
org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:215)
     [java]     at
org.jibx.binding.def.ObjectBinding.genUnmarshalContentMethod(ObjectBinding.java:882)
     [java]     at
org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:1078)
     [java]     at
org.jibx.binding.def.MappingDefinition.generateUnmarshalImplementation(MappingDefinition.java:642)
     [java]     at
org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:850)
     [java]     at
org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:620)
     [java]     at
org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:986)
     [java]     at org.jibx.binding.Compile.compile(Compile.java:221)
     [java]     at org.jibx.binding.Compile.main(Compile.java:374)

My ant task is as follows:

<target name="build-shared">
        <delete quiet="true" dir="${basedir}/bin" />
        <mkdir dir="${basedir}/bin" />
        <echo message="Compiling shared classes" />
        <javac srcdir="${basedir}/src/main/java" destdir="${basedir}/bin"
classpathref="bind-classpath" />
        <echo message="Running JiBX binding compiler" />
        <java classname="org.jibx.binding.Compile" fork="yes" failonerror="true"
classpathref="bind-classpath">
        <arg value="-v"/>
        <arg value="${basedir}/gen/binding.xml"/>                       
        </java>

                                
                <echo message="Constructing and copying shared.jar" />
                <mkdir dir="${build-client}/lib" />
                <jar jarfile="${build-client}/lib/shared.jar" 
basedir="${basedir}/bin" />
                <mkdir dir="${build-service}/lib" />
                <copy todir="${build-service}/lib" 
file="${build-client}/lib/shared.jar"
/>
</target>

Here is my binding.xml:
<binding xmlns:tns="http://mycompany.com/apsp/domain";
xmlns:ns0="http://mycompany.com/apsp/integration/CustomerService";
name="binding" package="com.mycompany.apsp.domain" force-classes="true"
add-constructors="true">
  <namespace uri="http://mycompany.com/apsp/domain"; default="elements"/>
  <namespace uri="http://mycompany.com/apsp/integration/CustomerService";
prefix="ns0"/>
  <namespace uri="http://mycompany.com/apsp/crossjardepend"; prefix="ns1" />
  <include
path="file:///D:/Projects/APSP_integration/CrossJarDependency/gen/person-binding.xml"
precompiled="true"/>
  <mapping abstract="true" type-name="tns:customer"
class="com.mycompany.apsp.domain.Customer">
    <structure type="com.mycompany.apsp.crossjardepend.Person">
      <value style="element" name="id" field="id" usage="optional"/>
    </structure>
    <value style="element" name="firstName" field="firstName"
usage="optional"/>
    <value style="element" name="lastName" field="LastName"
usage="optional"/>
    <value style="element" name="phone" field="phone" usage="optional"/>
  </mapping>
</binding>

Here is the person-binding.xml that is referenced above:

<binding xmlns:tns="http://accenture.com/apsp/crossjardepend"; name="binding"
package="com.accenture.apsp.crossjardepend">
  <namespace uri="http://accenture.com/apsp/crossjardepend";
default="elements"/>
  <mapping abstract="true" type-name="tns:person"
class="com.accenture.apsp.crossjardepend.Person">
    <value style="element" name="id" field="id" usage="optional"/>
  </mapping>
  <mapping abstract="true" class="com.accenture.apsp.crossjardepend.Person"
name="person">
    <structure map-as="tns:person"/>
  </mapping>
</binding>


Thanks for any help or ideas for getting past this error!

-Josh L

-- 
View this message in context: 
http://www.nabble.com/Error-trying-to-use-precompiled-bindings-and-extended-classes-tp25355028p25355028.html
Sent from the jibx-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to