JiBX
  1. JiBX
  2. JIBX-234

Binding compiler throws IllegalStateException with IBM JDK 6 and Linux amd64

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1.6
    • Fix Version/s: JiBX 1.2
    • Component/s: core
    • Labels:
      None
    • Environment:
      Ubuntu 64-bit. Ant 1.7.0. IBM JDK 1.6.0 build pxa6460sr1-20080416_01(SR1). JiBX 1.1.6a
    • Number of attachments :
      0

      Description

      Binding using ant script works fine with Sun JDK 6 and IBM JDK 5. Fails with IBM JDK 6. I've tried on 2 projects and get same results on each.

      Relevant parts of Ant script:

      <target name="init">
      <path id="build.classpath">
      <pathelement location="$

      {lib}/jibx-run.jar" />
      <pathelement location="${lib}

      /xmlunit.jar" />
      </path>

      <path id="bind.classpath">
      <path refid="build.classpath" />
      <pathelement location="$

      {lib}/jibx-bind.jar" />
      <pathelement location="${lib}

      /bcel.jar" />
      <pathelement location="$

      {lib}

      /jibx-extras.jar" />
      </path>

      <!-- JiBX binding compiler task definition -->
      <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
      <classpath refid="bind.classpath" />
      </taskdef>
      </target>

      <!-- Compile the bindings -->
      <target name="bind" depends="init" description="Run the JiBX binding compiler">
      <bind verbose="true">
      <classpath>
      <path refid="build.classpath" />
      <path path="$

      {dest.dir}

      " />
      </classpath>
      <bindingfileset dir="$

      {src.dir}

      ">
      <include name="*.xml" />
      </bindingfileset>
      </bind>
      </target>

      Console output with IBM JDK 6:

      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ export JAVA_HOME=/opt/ibm/java-x86_64-60/
      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ java -version
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build pxa6460sr1-20080416_01(SR1))
      IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460-20080415_18762 (JIT enabled, AOT enabled)
      J9VM - 20080415_018762_LHdSMr
      JIT - r9_20080415_1520
      GC - 20080415_AA)
      JCL - 20080412_01
      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ ant bind
      Buildfile: build.xml

      init:

      bind:
      [bind] Using the following paths:
      [bind] /local/work/Seascape/jibx_extras_test/lib/jibx-run.jar
      [bind] /local/work/Seascape/jibx_extras_test/lib/xmlunit.jar
      [bind] /local/work/Seascape/jibx_extras_test/output/classes
      [bind] Using the following binding paths:
      [bind] /local/work/Seascape/jibx_extras_test/src/bindingdom1.xml
      [bind] Running binding compiler version jibx_1_1_6a
      [bind] Error running binding compiler
      [bind] java.lang.IllegalStateException: The current state is not START_DOCUMENT.
      [bind] at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalStateException(StAXMessageProvider.java:46)
      [bind] at com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getEncoding(XMLStreamReaderImpl.java:1357)
      [bind] at com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy.getEncoding(XMLInputFactoryImpl.java:304)
      [bind] at org.jibx.runtime.impl.StAXReaderWrapper.startTag(StAXReaderWrapper.java:110)
      [bind] at org.jibx.runtime.impl.StAXReaderWrapper.next(StAXReaderWrapper.java:239)
      [bind] at org.jibx.runtime.impl.UnmarshallingContext.toStart(UnmarshallingContext.java:515)
      [bind] at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2766)
      [bind] at org.jibx.binding.model.BindingElement.readBinding(BindingElement.java:760)
      [bind] at org.jibx.binding.model.BindingElement.readBinding(BindingElement.java:776)
      [bind] at org.jibx.binding.model.BindingElement.validateBinding(BindingElement.java:794)
      [bind] at org.jibx.binding.Utility.validateBinding(Utility.java:223)
      [bind] at org.jibx.binding.Utility.loadBinding(Utility.java:264)
      [bind] at org.jibx.binding.Utility.loadFileBinding(Utility.java:408)
      [bind] at org.jibx.binding.Compile.compile(Compile.java:296)
      [bind] at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
      [bind] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      [bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [bind] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
      [bind] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
      [bind] at java.lang.reflect.Method.invoke(Method.java:612)
      [bind] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      [bind] at org.apache.tools.ant.Task.perform(Task.java:348)
      [bind] at org.apache.tools.ant.Target.execute(Target.java:357)
      [bind] at org.apache.tools.ant.Target.performTasks(Target.java:385)
      [bind] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      [bind] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      [bind] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      [bind] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      [bind] at org.apache.tools.ant.Main.runBuild(Main.java:698)
      [bind] at org.apache.tools.ant.Main.startAnt(Main.java:199)
      [bind] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      [bind] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
      [bind]

      BUILD FAILED
      /local/work/Seascape/jibx_extras_test/build.xml:43: JiBXException in JiBX binding compilation

      Total time: 0 seconds

      Console output with IBM JDK 5:

      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ export JAVA_HOME=/opt/ibm/java2-x86_64-50/
      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ ant bind
      Buildfile: build.xml

      init:

      bind:
      [bind] Using the following paths:
      [bind] /local/work/Seascape/jibx_extras_test/lib/jibx-run.jar
      [bind] /local/work/Seascape/jibx_extras_test/lib/xmlunit.jar
      [bind] /local/work/Seascape/jibx_extras_test/output/classes
      [bind] Using the following binding paths:
      [bind] /local/work/Seascape/jibx_extras_test/src/bindingdom1.xml
      [bind] Running binding compiler version jibx_1_1_6a
      [bind] binding bindingdom1:
      [bind] context (mp#=1) (cv#=0) (fm#=0)
      [bind] mapping class extras.DomContact1 to element contact (#0)
      [bind] context (cv#=0) (fm#=0)
      [bind] element wrapper contact
      [bind] object binding for extras.DomContact1 create class extras.DomContact1
      [bind] structure ordered
      [bind] element first-name from property m_firstName (java.lang.String)
      [bind] element last-name from property m_lastName (java.lang.String)
      [bind] element phone from property m_phone (java.lang.String)
      [bind] direct property using optional property m_information (org.w3c.dom.Element)
      [bind] direct marshaller/unmarshaller reference
      [bind] Generating code for mapping extras.DomContact1
      [bind]
      [bind] Wrote 2 files
      [bind]
      [bind] extras.JiBX_bindingdom1DomContact1_access2 output file size is 1839 bytes
      [bind]
      [bind] extras.JiBX_bindingdom1Factory output file size is 2627 bytes
      [bind]
      [bind] Kept 2 files unchanged:
      [bind] extras.DomContact1
      [bind] extras.JiBX_bindingdom1DomContact1_access1
      [bind]
      [bind] Deleted 2 files:
      [bind] extras.JiBX_bindingdom1Factory
      [bind] extras.JiBX_bindingdom1DomContact1_access

      BUILD SUCCESSFUL
      Total time: 0 seconds

      Console output with Sun JDK 6:

      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ export JAVA_HOME=/usr/lib/jvm/java-6-sun
      nigel@lapcat:/local/work/Seascape/jibx_extras_test$ ant bind
      Buildfile: build.xml

      init:

      bind:
      [bind] Using the following paths:
      [bind] /local/work/Seascape/jibx_extras_test/lib/jibx-run.jar
      [bind] /local/work/Seascape/jibx_extras_test/lib/xmlunit.jar
      [bind] /local/work/Seascape/jibx_extras_test/output/classes
      [bind] Using the following binding paths:
      [bind] /local/work/Seascape/jibx_extras_test/src/bindingdom1.xml
      [bind] Running binding compiler version jibx_1_1_6a
      [bind] binding bindingdom1:
      [bind] context (mp#=1) (cv#=0) (fm#=0)
      [bind] mapping class extras.DomContact1 to element contact (#0)
      [bind] context (cv#=0) (fm#=0)
      [bind] element wrapper contact
      [bind] object binding for extras.DomContact1 create class extras.DomContact1
      [bind] structure ordered
      [bind] element first-name from property m_firstName (java.lang.String)
      [bind] element last-name from property m_lastName (java.lang.String)
      [bind] element phone from property m_phone (java.lang.String)
      [bind] direct property using optional property m_information (org.w3c.dom.Element)
      [bind] direct marshaller/unmarshaller reference
      [bind] Generating code for mapping extras.DomContact1
      [bind]
      [bind] Wrote 1 files
      [bind]
      [bind] extras.JiBX_bindingdom1DomContact1_access output file size is 1837 bytes
      [bind]
      [bind] Kept 3 files unchanged:
      [bind] extras.DomContact1
      [bind] extras.JiBX_bindingdom1Factory
      [bind] extras.JiBX_bindingdom1DomContact1_access1
      [bind]
      [bind] Deleted 1 files:
      [bind] extras.JiBX_bindingdom1DomContact1_access2

      BUILD SUCCESSFUL
      Total time: 0 seconds

      IBM JDKs downloaded from http://www.ibm.com/developerworks/java/jdk/linux/download.html and installed using:

      1. sudo aptitude install bc xauth alien
      2. sudo alien ibm-java-x86_64-sdk-6.0-1.0.x86_64.rpm
      3. sudo dpkg -i ibm-java-x86-64-sdk_6.0-2_amd64.deb
      4. sudo update-alternatives --install /usr/bin/java java /opt/ibm/java-x86_64-60/bin/java 1
      5. sudo update-alternatives --config java

        Activity

        Hide
        Alan Stewart added a comment -

        Thanks Dennis. However, I am having some trouble creating an EAR for WebSphere to be able to test it - at least until 1.2 gets into the maven repo. Though I downloaded the 1.2 distribution from Sourceforge and got the jars into my local repo, the 1.2 version of the maven-jibx-plugin was not included and I am getting an error when running the 1.2-beta-1 plugin with the 1.2 binding compiler:
        java.lang.ClassNotFoundException: org.apache.bcel.classfile.FieldOrMethod

        It was working in 1.1.6a and also the 1.2 binding compiler runs fine in Eclipse with my bindings, so until I can get at the 1.2 version of the maven-jibx-plugin, I won't know if the above issue goes away
        Alan

        Show
        Alan Stewart added a comment - Thanks Dennis. However, I am having some trouble creating an EAR for WebSphere to be able to test it - at least until 1.2 gets into the maven repo. Though I downloaded the 1.2 distribution from Sourceforge and got the jars into my local repo, the 1.2 version of the maven-jibx-plugin was not included and I am getting an error when running the 1.2-beta-1 plugin with the 1.2 binding compiler: java.lang.ClassNotFoundException: org.apache.bcel.classfile.FieldOrMethod It was working in 1.1.6a and also the 1.2 binding compiler runs fine in Eclipse with my bindings, so until I can get at the 1.2 version of the maven-jibx-plugin, I won't know if the above issue goes away Alan
        Hide
        Alan Stewart added a comment -

        I was able to get an ear deployed to WebSphere 7 and I can confirm that problem originally reported above is resolved.
        I am still getting the ClassNotFound error when using the maven-jibx-plugin 1.2-beta-1 but was able to assemble the war and ear manually after using the 1.2 binding compiler.

        Is there some way I can get the source for the 1.2 release version of the plugin to compile locally or will it be in the maven repo soon?
        Thanks
        Alan

        Show
        Alan Stewart added a comment - I was able to get an ear deployed to WebSphere 7 and I can confirm that problem originally reported above is resolved. I am still getting the ClassNotFound error when using the maven-jibx-plugin 1.2-beta-1 but was able to assemble the war and ear manually after using the 1.2 binding compiler. Is there some way I can get the source for the 1.2 release version of the plugin to compile locally or will it be in the maven repo soon? Thanks Alan
        Hide
        Dennis Sosnoski added a comment -

        Maven updates have been made to the local JiBX repository, so the changes should be picked up by the main repository sometime today.

        Show
        Dennis Sosnoski added a comment - Maven updates have been made to the local JiBX repository, so the changes should be picked up by the main repository sometime today.
        Hide
        Alan Stewart added a comment -

        All works fine now with 1.2. Thanks

        Show
        Alan Stewart added a comment - All works fine now with 1.2. Thanks
        Hide
        Nigel Charman added a comment -

        Confirmed working with 1.2.1

        Show
        Nigel Charman added a comment - Confirmed working with 1.2.1

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Nigel Charman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: