Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User ejakkk's Avatar
    Join Date
    Jun 2009
    Posts
    8
    Hi..
    I'm developing a project with Netbeans and i set the obfuscation to high level(9) because i use bouncy castle.
    Nothings wrong with the Bouncy, and when i go back to check to send the email (i try to make an implementation of rsa in email), it says:
    Uncaught exception java/lang/RuntimeException: Error loading connection class for 'J2ME' (java.lang.ClassNotFoundException).

    What is wrong with it? When i set the obfuscation back to off (0 i guess), it works fine, but it wont let BouncyCastle works then. Really need the answer..

  2. #2
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    What about other obfuscation levels?

    The obfuscator is Proguard?

    What are you running this on? Device or emulator?

    If you're running on the emulator, can you post the stack trace?

    Graham.

  3. #3
    Registered User ejakkk's Avatar
    Join Date
    Jun 2009
    Posts
    8
    I'm running this on emulator, and i think the obfuscator is proguard 4.2, since i see it in the output.

    post-compile:
    compile:
    pre-obfuscate:
    proguard-init:
    skip-obfuscation:
    proguard:
    Building jar: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\before-obfuscation.jar
    ProGuard, version 4.2
    Reading program jar [C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\before-obfuscation.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr226.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\satsa-crypto.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr229.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr238.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\j2me-xmlrpc.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr211.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\satsa-jcrmi.jar]
    Note: duplicate definition of library class [java.rmi.Remote]
    Note: duplicate definition of library class [java.rmi.RemoteException]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr082.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\satsa-apdu.jar]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACEntry]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACFile]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACLFileReader]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACLPermissions]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACList]
    Note: duplicate definition of library class [com.sun.satsa.acl.APDUPermissions]
    Note: duplicate definition of library class [com.sun.satsa.acl.AccessControlManager]
    Note: duplicate definition of library class [com.sun.satsa.acl.JCRMIPermission]
    Note: duplicate definition of library class [com.sun.satsa.acl.JCRMIPermissions]
    Note: duplicate definition of library class [com.sun.satsa.acl.PINAttributes]
    Note: duplicate definition of library class [com.sun.satsa.acl.PINData]
    Note: duplicate definition of library class [com.sun.satsa.acl.PINEntryDialog]
    Note: duplicate definition of library class [java.lang.UnsupportedOperationException]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr184.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr239.jar]
    Note: duplicate definition of library class [java.lang.UnsupportedOperationException]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr75.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr179.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\satsa-pki.jar]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACEntry]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACFile]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACLFileReader]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACLPermissions]
    Note: duplicate definition of library class [com.sun.satsa.acl.ACList]
    Note: duplicate definition of library class [com.sun.satsa.acl.APDUPermissions]
    Note: duplicate definition of library class [com.sun.satsa.acl.AccessControlManager]
    Note: duplicate definition of library class [com.sun.satsa.acl.JCRMIPermission]
    Note: duplicate definition of library class [com.sun.satsa.acl.JCRMIPermissions]
    Note: duplicate definition of library class [com.sun.satsa.acl.PINAttributes]
    Note: duplicate definition of library class [com.sun.satsa.acl.PINData]
    Note: duplicate definition of library class [com.sun.satsa.acl.PINEntryDialog]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr180.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\mmapi.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\j2me-ws.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\wma20.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\jsr234.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\cldcapi11.jar]
    Reading library jar [C:\Program Files\NetBeans 6.5 RC1\mobility8\WTK2.5.2\lib\midpapi21.jar]
    Note: duplicate definition of library class [javax.microedition.media.PlayerListener]
    Note: duplicate definition of library class [javax.microedition.media.Player]
    Note: duplicate definition of library class [javax.microedition.media.Controllable]
    Note: duplicate definition of library class [javax.microedition.media.MediaException]
    Note: duplicate definition of library class [javax.microedition.media.Control]
    Note: duplicate definition of library class [javax.microedition.media.control.VolumeControl]
    Note: duplicate definition of library class [javax.microedition.media.control.ToneControl]
    Note: duplicate definition of library class [javax.microedition.media.protocol.DataSource]
    Note: duplicate definition of library class [javax.microedition.media.Manager]
    Note: duplicate definition of library class [javax.microedition.media.SystemTimeBase]
    Note: duplicate definition of library class [javax.microedition.securityservice.CMSMessageSignatureServiceException]
    Note: duplicate definition of library class [javax.microedition.securityservice.CMSMessageSignatureService]
    Note: there were 40 duplicate class definitions.
    Preparing output jar [C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\obfuscated.jar]
    Copying resources from program jar [C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\before-obfuscation.jar]
    Created dir: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\obfuscated
    Expanding: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\obfuscated.jar into C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\obfuscated
    post-obfuscate:
    obfuscate:
    pre-preverify:
    do-preverify:
    Created dir: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\preverifysrc
    Copying 30 files to C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\preverifysrc
    Created dir: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\preverified
    Preverifying 30 file(s) into C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\preverified directory.
    Copying 11 files to C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\build\preverified
    post-preverify:
    preverify:
    pre-jar:
    set-password-init:
    set-keystore-password:
    set-alias-password:
    set-password:
    create-jad:
    add-configuration:
    add-profile:
    do-extra-libs:
    nokiaS80-prepare-j9:
    nokiaS80-prepare-manifest:
    nokiaS80-prepare-manifest-no-icon:
    nokiaS80-create-manifest:
    semc-build-j9:
    do-jar:
    Building jar: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\dist\Email_QIU.jar
    nsicom-create-manifest:
    do-jar-no-manifest:
    bdj-build-image:
    update-jad:
    Updating application descriptor: C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\dist\Email_QIU.jad
    Generated "C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\dist\Email_QIU.jar" is 77956 bytes.
    ricoh-init-dalp:
    ricoh-add-app-icon:
    ricoh-build-dalp-with-icon:
    ricoh-build-dalp-without-icon:
    ricoh-build-dalp:
    savaje-prepare-icon:
    savaje-build-jnlp:
    post-jar:
    jar:
    pre-run:
    cldc-run:
    Copying 1 file to C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\dist\nbrun41782
    Copying 1 file to C:\Documents and Settings\reza\My Documents\NetBeansProjects\Email_QIU\dist\nbrun41782
    Jad URL for OTA execution: http://localhost:8082/servlet/org.ne.../Email_QIU.jad
    Starting emulator in execution mode
    Running with storage root C:\Documents and Settings\reza\j2mewtk\2.5.2\appdb\DefaultColorPhone
    Running with locale: Indonesian_Indonesia.1252
    Running in the identified_third_party security domain
    Uncaught exception java/lang/RuntimeException: Error loading connection class for 'J2ME' (java.lang.ClassNotFoundException).
    Execution completed.

    and when i change the obfuscator level, the output vary for each level.

  4. #4
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    You said you get this problem as obfuscation level 9, but not at 0. What about level 1? Do you get the problem then?

    Also:

    Quote Originally Posted by grahamhughes View Post
    What are you running this on? Device or emulator?

    If you're running on the emulator, can you post the stack trace?
    It might be helpful to see a complete stack trace from the emulator, for where the error occurs.

    Graham.

  5. #5
    Registered User ejakkk's Avatar
    Join Date
    Jun 2009
    Posts
    8
    hi graham, really thanks for the response.

    i'm afraid there's no other stack trace in the output, i don't think i handle those problems too in my exception. when i set the obfuscating level in any level beside high the bouncy castle still doesnt work, it gives different output though when i build it. But when i set it to 0, it gives error:
    Uncaught exception java/lang/NoClassDefFoundError: java/security/SecureRandom: Cannot create class in system package .

    which i found in this forum is that i have to set the obfuscating level to high.

  6. #6
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    Are you using the wireless toolkit emulator?

    You should really read the documentation about debugging. It is much easier to track down the problem if you can find the line of code that throws the exception, and for this you will need a stack trace. If the error happens in the emulator, then the emulator can provide you with a lot of diagnostic information.

    Graham.

  7. #7
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    Grahm I read the output of the code,in the second last line I found these lines
    Uncaught exception java/lang/RuntimeException: Error loading connection class for 'J2ME' (java.lang.ClassNotFoundException).
    Execution completed.
    I guess there is the class called as the Connection,it can be the either the in built or the user defined.When loading this class then the same exception,please check the same and share with us.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  8. #8
    Registered User ejakkk's Avatar
    Join Date
    Jun 2009
    Posts
    8
    It works now, after i rename the Bouncy Castle library class, put it in the right package, manually. And i don't need to obfuscate it again.
    Somehow Netbeans or java (i dont know which one) doesnt allow class named like the real one java has. Then after renaming it, i dont obfuscate my program and the connection still work.

    Got to deal with it later, but i accept the way it is now since the deadline of my assignment is getting closer.

    And once again, thank you for all the reply..

  9. #9
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    I guess that the reason for the issue can be since there is in built class called as "COnnection" and your one was the same.I Hope so....anyways your have a good luck for the deadlines for the project.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Connection times out after 10 requests...
    By QSIPhone in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2007-04-09, 17:29
  2. connection to serial port
    By marluzch in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2006-11-20, 19:47
  3. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-08-31, 18:47
  4. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java General
    Replies: 0
    Last Post: 2004-08-31, 18:45
  5. Replies: 5
    Last Post: 2003-02-07, 11:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved