Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

J2ME version startup crash on Blackberry Bold

mariogig
2009-01-22
2013-05-02
  • mariogig
    mariogig
    2009-01-22

    BT747 J2ME crash every time on startup on Blackberry Bold

    these are the error:

    ver 0.2.42
    Error starting _0$2e2$2e42: Module '_0$2e2$2e42' has verification error 1762 at offset 742d

    ver 0.2.44
    Error starting _0$2e2$2e44: Module '_0$2e2$2e44-2' has verification error 1762 at offset 6ef2

    ver 0.2.46
    Error starting _0$2e2$2e46: Module '_0$2e2$2e46-2' has verification error 1107 at offset 3064

    I added this bug to the list.
    Anyone can confirm this?
    Thanks

     
    • mariogig
      mariogig
      2009-01-23

      I tried on another Blackberry Bold with another firmware (4.6.0.185 instead of 4.6.0.217) and it crash too.
      The only difference are the offset:

      0.2.42 offset 6193
      0.2.44 offset 73b2
      0.2.46 offset 3064

      Thanks.

       
      • Mario De Weerd
        Mario De Weerd
        2009-01-23

        I checked the libraries that should be on the Blackberry and the required ones seem to be there (JSR-75 qnd JSR-82) - so in principle not a problem there.
        The error message is a bit cryptic and I did  not find an explication of this error number.

          CLDC version:  1.0
          CLDC version:  1.1
          MIDP version:  1.0
          MIDP version:  2.0
          Specific JSR:  JSR-75 ( File system )
          Specific JSR:  JSR-82 ( Bluetooth )
          Specific JSR:  JSR-120 ( Wireless Messaging API )
          Specific JSR:  JSR-135 ( Mobile Media API )
          Specific JSR:  JSR-179 ( Location API )
          Specific JSR:  JSR-184 ( Mobile 3D Graphics API )

         
      • Mario De Weerd
        Mario De Weerd
        2009-01-23

        I found a list regarding JVM error numbers but it does not seem to be complete:
        http://www.blackberry.com/developers/javaknowledge/general/kpa0307163334.shtml

         
      • Mario De Weerd
        Mario De Weerd
        2009-01-23

        I found a page with some interesting comments regarding the cause of the problem which unfortunately is going to be difficult to resolve.

        http://googlewaterloo.blogspot.com/2007/01/verification-errors-with-blackberry.html

        I'll try to 'clean up' using these directives:
        Change non static accesses to static members using declaring type
        Change indirect accesses to static members to direct accesses(accesses through subtypes)

        That is 'automatic' and hopefully resolves the issue.

         
        • Mario De Weerd
          Mario De Weerd
          2009-01-23

          Please try 0_2_47.  I made modifications as indicated on the web page I indicated.

          Hopefully that works...

           
          • Mario De Weerd
            Mario De Weerd
            2009-02-11

            I tried on a collegue's blackberry (I think bold too) and the app works.
            The app can connect to the GPS device and download data.  I did not optimize the download settings, so it was not 'fast' - the essential is that it worked.

            However, there are some problems with the key mapping.  The menus/'Back' does not work for example.  Left, right, up, down and enter are ok.
            I'll dig into that in a few weeks time - I have vacation coming up and you should not expect something to be done before end of February.

             
            • Mario De Weerd
              Mario De Weerd
              2009-03-03

              A menu issue on the Blackberry is solved in 0.2.66.

               
    • mariogig
      mariogig
      2009-01-26

      The crash are still here on 0.2.47, now the error is:

      ver 0.2.47
      Error starting BT_J2ME: Module 'BT_J2ME-2' has verification error 1107 at offset 3068

      A little less criptic?

      Thanks.

       
      • Mario De Weerd
        Mario De Weerd
        2009-01-26

        I found some interesting information in the J2ME Polish pages.
        It seems that using the Blackberry JDE one can track down the problem.
        Could you try to see where this JDE can be found?

        Here is the info:

        Verification error

        It may happen that a blackberry build can't be executed due to a verification error. The device will respond to the execution of the application with something like this :

        Error starting appname: Module 'appname' has verification error XXXX at offset XXXX

        There are numerous reasons for this behaviour:

            * The signing went wrong. Please check the signing of the application.
            * A derived or subclass of another class tries to access a static variable directly. Create a get() method for this variable to access it.
            * Remove unused imports
            * Remove System.out.println() calls
            * Make sure every method has a valid qualifier like private/public/protected

        To identify the class and method which causes the error, you can do the following :

           1. Open the emulator of the BlackBerry JDE
           2. Load the application
           3. Open the application
           4. An error screen should appear stating something like this :

              jvm error 104 uncaught runtime exception

           5. Choose from the underlying menu (using the arrow keys) the option "catfail"
           6. Now choose the right most point to save a file named "failure.zip" to your disk
           7. Extract the files within failure.zip to your disk and open the .bug file

        There are three interesting values in the .bug file:

        VM:VECPs

        (the package)

        VM:VECCs

        (the class)

        VM:VECMm

        (and the method which causes the error)

         
        • Mario De Weerd
          Mario De Weerd
          2009-01-28

          I found the blackberry JDE and installed it.
          I also found the way to create a 'cod' file.
          After launching in the emulator (simulator?), the verification error appeared and I was able to know in which class and method this happens.  Knowing what the exact cause is another story of trial and error ...

           
    • mariogig
      mariogig
      2009-01-28

      Hi ,thanks Mario De Weerd

      The JDE is available here for free but with registration:
      http://na.blackberry.com/eng/developers/javaappdev/javadevenv.jsp

      The version must be equal or than the installed software
      (4.6.0.xxx for the Blackberry Bold) then I think we must try 4.6.0.

      Sun JDK and Directx 8 or better are  prerequisites (I don't tried if work without)
      http://java.sun.com/javase/downloads/index.jsp

      Before you can upload to the simulator, you need to convert the jar/jad files in the blackberry native
      .cod (normally when you download an application the device do it on the fly)

      "For semplicity, move the JAD and JAR files to the BIN directory in the RIM JDE install folder
      (default folder is c:\program files\Research in Motion\Blackberry JDE 4.6.0\bin\)
      Go to the folder with command prompt and launch RAPC.exe: write all on one line (or You can also make a .cmd file)
      rapc import="c:\Program Files\Research in Motion\Blackberry JDE 4.6.0\lib\net_rim_api.jar" codename=BT_j2ME -midlet jad=BT_J2ME.jad BT_J2ME.jar

      If successful, it will say no errors, and you found the .cod files in the Bin folder"

      I tried and this is the logfile, there are some error on ending lines

      ...omissis...
      ...omissis...
      Resolving
      Optimizing
      I:\Program Files\BlackBerry JDE 4.6.0\bin\BT_J2ME.jar(bu.class):1: Warning!: member data 'bw B' not required in class: bu
      I:\Program Files\BlackBerry JDE 4.6.0\bin\BT_J2ME.jar(bf.class):1: Warning!: member data 'cb b' not required in class: bf
      I:\Program Files\BlackBerry JDE 4.6.0\bin\BT_J2ME.jar(bi.class):0: Warning!: local variable(s) { local#1 } initialized but not used in: bi.l()
      I:\Program Files\BlackBerry JDE 4.6.0\bin\BT_J2ME.jar(net/sf/bt747/j4me/app/o.class): Warning!: verification failed at opcode offset: 152 cause: incompatible types in control flow merge in net.sf.bt747.j4me.app.o.<init>(ai,MTKMidlet)
      I:\Program Files\BlackBerry JDE 4.6.0\bin\BT_J2ME.jar(net/sf/bt747/j4me/app/u.class): Warning!: verification failed at opcode offset: 75 cause: incompatible types in control flow merge in net.sf.bt747.j4me.app.u.c()
      Populating
      No errors.

      After that I tried to import in the "Device simulator" under File>Load Java Program the .cod generated.
      You can found the program under "downloads" folder on the device
      When I run it (ver 0.2.47) it says (different error and screen from the real device):

      JVM error 104
      Uncaught: Runtime exception (like Mario De Weerd sayed!)

      Scroll for available command

      I select Catfails

      and the I receive this box
      "Device Error" - Blackberry Smarthphone Simulator

      BORK Screen Catfail

      Exit-Ignore-Save log

      I saved the log on a failure.zip file in the BIN directory.
      After then if you press ignore you see the same type of error of the real device (verification error 1107)
      but with different offset: 92c4

      Then I tried to open the .bug file inside the failure.zip but it doesn't seem to be plain text,
      it seems a binary file but with the VM:VECPs,VM:VECCs,VM:VECMm present.
      It's a bit difficult to read.

      I uploaded it here.
      hxxp://s1.xzshare.com/24667939-failure.zip
      (replace the hxxp with http)

      I hope helped you a little.
      I'm candidate me for the beta testing :) !!!
      Thanks

       
      • Mario De Weerd
        Mario De Weerd
        2009-01-28

        This has the obfuscated version of BT747 for J2ME and a '.cod' file.
        In the emulator I get a complaint about a null pointer when started the first time.  I'll need to look into that later.
        On the second start, it is ok (I guess it has to do with Bluetooth).

        I do not think I will generate a cod file systematically, so it would be nice if you could write something for the install instructions on how to install the '.jar' on Blackberry.

        I hope that the rest of the functionality works ...

         
    • Mario De Weerd
      Mario De Weerd
      2009-01-28

      It looks like we are more or less in parallel ;-).

       
    • Mario De Weerd
      Mario De Weerd
      2009-01-28

      Let's hope that the verification errors reported by rapc of the obfuscated file are the only ones...
      I do not get these when the application is not obfuscated ;-(.

      I was able to avoid one by commenting out a bunch of code to stumble on a second one ...

      Anyway, this piece of 'unix-like' code (running on cygwin), helps me get the relevant strings:

      unzip  -o failure.zip  ; strings 8300.bug | grep -a VM:

       
    • Mario De Weerd
      Mario De Weerd
      2009-01-28

      OK, it looks like I am onto a root cause :

              menu.appendMenuOption("Download Settings", new DelayedDialog(
                      LogDownloadConfigScreen.class, c, this, this));

      I use 'LogDownloadConfigScreen.class', I guess the Blackberry JVM does not like that.  This is also used in the second class that the JVM complains at (after commenting the code above).

      I'll make a rewrite of that and hopefully that is the only thing...

       
    • Mario De Weerd
      Mario De Weerd
      2009-01-28

      That was it!

      I uploaded a 'cod' file in the tracker that you can try:
      https://sourceforge.net/tracker2/download.php?group_id=196368&atid=957176&file_id=311038&aid=2529640

      The chosen font is a bit big because it relies on the width only - I am improving that a bit and will make another build - in the mean time you can try.