JiBX
  1. JiBX
  2. JIBX-110

Having a J2ME compatible official jibx release

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JiBX 1.1 beta4
    • Component/s: core
    • Labels:
      None
    • Environment:
      J2ME
    • Number of attachments :
      0

      Description

      It would be great having an offical jibx release for J2ME environments.
      With respect to our code analysis in the current version only slight
      modifications are necessary (below I have copied a part of the original post of Dirk Bade from the jibx-users list):

      The only Problem is the usage of java.sql.Time, java.sql.Date and java.sql.Timestamp within the jibx.runtime.Utility-class.
      If you simply remove the imports of these packages within the class and change the methods for serialization and deserialization
      (using Object instead of java.sql.* in the method-signature) it works fine. And because java.sql.* is not
      included in the 'Personal Profile' for mobile devices you won't miss the methods anyway. The binding-compiler does not like the changes in the method-signatures, so one has to use the original Utility-class for binding-compiling.

        Activity

        Hide
        Dennis Sosnoski added a comment -

        Added a separate Ant build target "j2me" to build J2ME versions of the distribution jars. This actually runs through all the tests and such, with the only difference being that all java.sql.* code is disabled.

        Show
        Dennis Sosnoski added a comment - Added a separate Ant build target "j2me" to build J2ME versions of the distribution jars. This actually runs through all the tests and such, with the only difference being that all java.sql.* code is disabled.
        Hide
        Lars added a comment -

        Great, thank you very much for adding this feature. We will test it and report our findings asap.

        Show
        Lars added a comment - Great, thank you very much for adding this feature. We will test it and report our findings asap.
        Hide
        Dirk Bade added a comment -

        I just tried to run the j2me-version, but i got a NoClassDefFoundException for java.sql.Date. The java.sql-code sections should have been disabled in the j2me-version (by the j2me-build target and the JEnabler), but using the JAD decompiler on Utility.class (in the j2me-run.jar) shows that no code at all has been cut out of the source. The java.sql parts are still present in the class-file. In case someone provides the source for JEnabler i could have a look at what's going wrong.

        Show
        Dirk Bade added a comment - I just tried to run the j2me-version, but i got a NoClassDefFoundException for java.sql.Date. The java.sql-code sections should have been disabled in the j2me-version (by the j2me-build target and the JEnabler), but using the JAD decompiler on Utility.class (in the j2me-run.jar) shows that no code at all has been cut out of the source. The java.sql parts are still present in the class-file. In case someone provides the source for JEnabler i could have a look at what's going wrong.
        Hide
        Dennis Sosnoski added a comment -

        I just downloaded the release, unpacked it, and ran the "j2me" target. I then unpacked the generated jibx-j2me-run.jar file and tried grepping the class files. There's no reference to "sql" in the class files at all.

        I'd suggest you try running the "enablej2me" Ant target separately and then look at the source code. At least on my system, the java.sql stuff is commented out after doing this. Note that you need to refresh after you've run the target, since the changes will not be detected automatically - the JEnable settings tell it to preserve the original file timestamps in order to avoid confusing CVS.

        The JEnable documentation and distribution is at http://www.sosnoski.com/opensrc/jenable/index.html

        Show
        Dennis Sosnoski added a comment - I just downloaded the release, unpacked it, and ran the "j2me" target. I then unpacked the generated jibx-j2me-run.jar file and tried grepping the class files. There's no reference to "sql" in the class files at all. I'd suggest you try running the "enablej2me" Ant target separately and then look at the source code. At least on my system, the java.sql stuff is commented out after doing this. Note that you need to refresh after you've run the target, since the changes will not be detected automatically - the JEnable settings tell it to preserve the original file timestamps in order to avoid confusing CVS. The JEnable documentation and distribution is at http://www.sosnoski.com/opensrc/jenable/index.html
        Hide
        Dirk Bade added a comment -

        Thanks for your comment Dennis, i tried to run only the enablej2me-target and it told me that 0 files had been found or modified in my path ("C:\Java\JiBX\build/src/[...]" - mind the different slashes). I tried to run the same target under Linux and it worked fine. I looked through the JEnable-sources and the build-file and found that JEnable gets confused in case it has to deal with absolute file-paths under Windows. Changing the arguments of the JEnable-call in the ant file from absolute to relative path-names worked (at least under Windows). Now everything works fine and the jibx-j2me-run.jar does its job also on my mobile device.

        Show
        Dirk Bade added a comment - Thanks for your comment Dennis, i tried to run only the enablej2me-target and it told me that 0 files had been found or modified in my path ("C:\Java\JiBX\build/src/ [...] " - mind the different slashes). I tried to run the same target under Linux and it worked fine. I looked through the JEnable-sources and the build-file and found that JEnable gets confused in case it has to deal with absolute file-paths under Windows. Changing the arguments of the JEnable-call in the ant file from absolute to relative path-names worked (at least under Windows). Now everything works fine and the jibx-j2me-run.jar does its job also on my mobile device.
        Hide
        Dennis Sosnoski added a comment -

        Thanks for tracking down the problem, Dirk. I think the problem may be the mixed separator characters you get when you run the Ant build.xml on Windows, since I think JEnable works fine on Windows when used by itself. I'll change the build.xml to use a relative path rather than an absolute path.

        Show
        Dennis Sosnoski added a comment - Thanks for tracking down the problem, Dirk. I think the problem may be the mixed separator characters you get when you run the Ant build.xml on Windows, since I think JEnable works fine on Windows when used by itself. I'll change the build.xml to use a relative path rather than an absolute path.
        Hide
        Kenny Ho added a comment -

        Has this been resolved since 1.1.0? I just downloaded 1.1.6a and try running the enablej2me and disablej2me target and for both case I got the same "matched 0 files and modified 0 for path...". (I am using windows eclipse.)

        I am not sure if this has something to do with the Build Failure I get when I run the j2me target:
        "[java] Attribute mismatch - from line 3, col 32 to line 4, col 32
        [java] attribute

        {http://www.sosnoski.com}

        key value '38193' != '83132'
        [java] Attribute mismatch - from line 5, col 64 to line 6, col 64
        [java] attribute

        {http://www.sosnoski.com}

        first-name value 'John' != 'Mary'
        [java] Attribute mismatch - from line 17, col 32 to line 18, col 32
        [java] attribute

        {http://www.sosnoski.com}

        key value '83132' != '38193'
        [java] Attribute mismatch - from line 19, col 64 to line 20, col 64
        [java] attribute

        {http://www.sosnoski.com}

        first-name value 'Mary' != 'John'
        [java] Error round-tripping class: example21.Directory
        [java] with input file example21/data1.xml and output compared to example21/data1.xml
        [java] Saved output document file path D:\Download\JiBX - XML Data Binding for Java\jibx\tutorial\temp.xml

        BUILD FAILED
        D:\Download\JiBX - XML Data Binding for Java\jibx\build\build.xml:1062: Java returned: 1"

        I don't have a linux setup to test this on. Should I open a new bug?

        Show
        Kenny Ho added a comment - Has this been resolved since 1.1.0? I just downloaded 1.1.6a and try running the enablej2me and disablej2me target and for both case I got the same "matched 0 files and modified 0 for path...". (I am using windows eclipse.) I am not sure if this has something to do with the Build Failure I get when I run the j2me target: " [java] Attribute mismatch - from line 3, col 32 to line 4, col 32 [java] attribute {http://www.sosnoski.com} key value '38193' != '83132' [java] Attribute mismatch - from line 5, col 64 to line 6, col 64 [java] attribute {http://www.sosnoski.com} first-name value 'John' != 'Mary' [java] Attribute mismatch - from line 17, col 32 to line 18, col 32 [java] attribute {http://www.sosnoski.com} key value '83132' != '38193' [java] Attribute mismatch - from line 19, col 64 to line 20, col 64 [java] attribute {http://www.sosnoski.com} first-name value 'Mary' != 'John' [java] Error round-tripping class: example21.Directory [java] with input file example21/data1.xml and output compared to example21/data1.xml [java] Saved output document file path D:\Download\JiBX - XML Data Binding for Java\jibx\tutorial\temp.xml BUILD FAILED D:\Download\JiBX - XML Data Binding for Java\jibx\build\build.xml:1062: Java returned: 1" I don't have a linux setup to test this on. Should I open a new bug?
        Hide
        Kenny Ho added a comment -

        I looked into it a bit more and I've manually run the enablej2me in the command line (by copying JEnable to the build directory and do it from there... for some reason "src/*/" worked but ../src/*/ doesn't) this resulted in a modification of 9 files (6 in src, 1 in extras, 2 in test, it would be great if someone can verify)

        Then I go into Eclipse and run the j2me target again but this time the build still failed. I am using java1.6.0_07. Other than a bunch of warnings from deprecation of the toURL() method in java.io.file and project in org.apache.tools.ant.ProjectComponent, I get the following error:
        [echo] Checking asymmetric bindings –
        [echo] Will generate warnings for no way to load prior value
        [bind] Error during initialization; is jibx-run.jar in load classpath?
        [bind] java.lang.IllegalArgumentException: Serializer org.jibx.runtime.Utility.serializeSqlDate not found
        [bind] at org.jibx.binding.def.StringConversion.<init>(StringConversion.java:154)...

        Now I am not sure if this means things are good or not because I do get the jibx-j2me-bind, extras and run.jar in the lib folder. Is this just the error from running the test?

        Also, do I need a j2me specific xpp3.jar? I noticed that's what I need for run time on standard java. I am trying to get this working on BlackBerry but these (XML binding, Ant, etc) are all new to me. Any help would be greatly appreciated.

        Show
        Kenny Ho added a comment - I looked into it a bit more and I've manually run the enablej2me in the command line (by copying JEnable to the build directory and do it from there... for some reason "src/* / " worked but ../src/* / doesn't) this resulted in a modification of 9 files (6 in src, 1 in extras, 2 in test, it would be great if someone can verify) Then I go into Eclipse and run the j2me target again but this time the build still failed. I am using java1.6.0_07. Other than a bunch of warnings from deprecation of the toURL() method in java.io.file and project in org.apache.tools.ant.ProjectComponent, I get the following error: [echo] Checking asymmetric bindings – [echo] Will generate warnings for no way to load prior value [bind] Error during initialization; is jibx-run.jar in load classpath? [bind] java.lang.IllegalArgumentException: Serializer org.jibx.runtime.Utility.serializeSqlDate not found [bind] at org.jibx.binding.def.StringConversion.<init>(StringConversion.java:154)... Now I am not sure if this means things are good or not because I do get the jibx-j2me-bind, extras and run.jar in the lib folder. Is this just the error from running the test? Also, do I need a j2me specific xpp3.jar? I noticed that's what I need for run time on standard java. I am trying to get this working on BlackBerry but these (XML binding, Ant, etc) are all new to me. Any help would be greatly appreciated.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Lars
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: