4 Replies Latest reply: Jul 20, 2009 8:00 AM by PhHein RSS

    java.lang.SecurityException: Application not authorized to access the restr

    843849
      I am working j2me wireless toolkit. i have written a program which takes one file from net and formats that data in midlet. It is compiling properly but when i am running it it is giving the error.
      The exact message it is showing is

      java.lang.SecurityException: Application not authorized to access the restricted API
           at com.sun.midp.security.SecurityToken.checkForPermission(+331)
           at com.sun.midp.security.SecurityToken.checkForPermission(+15)
           at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(+20)
           at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+28)
           at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+7)
           at com.sun.midp.io.ConnectionBaseAdapter.checkForPermission(+67)
           at com.sun.midp.io.j2me.http.Protocol.checkForPermission(+17)
           at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+6)
           at javax.microedition.io.Connector.openPrim(+299)
           at javax.microedition.io.Connector.open(+15)
           at javax.microedition.io.Connector.open(+6)
           at javax.microedition.io.Connector.open(+5)
           at Weather.getConditions(+41)
           at Weather.commandAction(+52)
           at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
           at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
           at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
           at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
           at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+250)

      Plese help me in solving this problem
        • 1. Re: java.lang.SecurityException: Application not authorized to access the restr
          843849
          The emulator is seeing your midlet as untrusted..

          Try using the Nokia emulator or else try adding the following permissions in your jad and see if this helps.

          MIDlet-Permissions: javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http
          MIDlet-Permissions-Opt: javax.microedition.media.Player,javax.microedition.media.Manage,javax.microedition.media.control.VideoControl.getSnapshot,javax.microedition.media.control.RecordControl

          Regards,
          Nagendra
          • 2. Re: java.lang.SecurityException: Application not authorized to access the restr
            843849
            Hi.

            I am using WTK 2.5 and when runing the SIP application, I get this error, may you please help me.

            java.lang.SecurityException: Application not authorized to access the restricted API
            at com.sun.midp.security.SecurityToken.checkForPermission(+459)
            at com.sun.midp.security.SecurityToken.checkForPermission(+15)
            at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(+20)
            at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+28)
            at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+7)
            at com.sun.midp.io.j2me.datagram.Protocol.openPrim(+296)
            at gov.nist.siplite.stack.UDPMessageChannel.sendMessage(+81)
            at gov.nist.siplite.stack.UDPMessageChannel.sendMessage(+22)
            at gov.nist.siplite.stack.ClientTransaction.fireRetransmissionTimer(+68)
            at gov.nist.siplite.stack.Transaction.fireTimer(+62)
            at gov.nist.siplite.stack.SIPTransactionStack$TransactionScanner.run(+629)
            • 3. Re: java.lang.SecurityException: Application not authorized to access the restr
              843849
              I use Netbeans 6.7 and am trying to connect / talk to a web-service thru a MIDlet.

              But it gives an error like the following and refuses to connect.

              java.lang.SecurityException: Application not authorized to access the restricted API
              at com.sun.midp.security.SecurityToken.checkForPermission(SecurityToken.java:368)
              at com.sun.midp.security.SecurityToken.checkForPermission(SecurityToken.java:229)
              at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(MIDletSuiteImpl.java:378)
              at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(MIDletSuiteImpl.java:328)
              at com.sun.midp.io.ConnectionBaseAdapter.checkForPermission(ConnectionBaseAdapter.java:174)
              at com.sun.midp.io.j2me.http.Protocol.checkForPermission(+17)
              at com.sun.midp.io.ConnectionBaseAdapter.openPrim(ConnectionBaseAdapter.java:91)
              at javax.microedition.io.Connector.openPrim(Connector.java:329)
              at javax.microedition.io.Connector.open(Connector.java:222)
              at javax.microedition.io.Connector.open(Connector.java:198)
              at javax.microedition.io.Connector.open(Connector.java:180)


              Can somebody please help !!