It's not a secret anymore!*
The moose likes Java Micro Edition and the fly likes Code (49) - Application authorization failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Code (49) - Application authorization failure"" Watch "Code (49) - Application authorization failure"" New topic
Author

Code (49) - Application authorization failure"

Anuja arathi
Greenhorn

Joined: Oct 29, 2003
Posts: 7
Hi,
I am getting "Code (49) - Application authorization failure. [javax.microedition.io.Connector.sms]". error when I execute the SMSDemo MIDlet that comes along with the J2ME Wireless Tool Kit 2.0.
I have added the API permission for "javax.micoedition.io.connector.sms". Still I am getting the same probelm. I have written MIDLETS to send an SMS, which are also getting the same error when executed.
I have posted this im many forums but haven't got any answer.Could someone please help me in solving this.
Thanks,
arathi
Carlos Quiroz
Greenhorn

Joined: Oct 27, 2003
Posts: 14
Hi
It seems you may have WTK missconfigured. Can you check in which security domain are you executing the emulator? This is in Edit/Preferences/Security
If your security domain is minimum you may get that kind of errors. Try setting it to the maximum
Also adding the permissions to the jar is not enough. You have to also sign the MIDlet.
Hope it helps
Regards
Anuja arathi
Greenhorn

Joined: Oct 29, 2003
Posts: 7
Thanks Carlos,
The security domain is set to maximum and the Midlet has been signed (following the procedure given in user guide of WTK) . When executed the Midlet through "run viaOTA", I am getting the following error
"OTA Error Code (6) - The CA that issued the content provider certificate is unknown. [C=My Company;O=myserver]".

WHen I run the application locally , I am getting the following error.

java.lang.SecurityException: Application not authorized to access the restricted API
at com.sun.midp.security.SecurityToken.checkForPermission(+295)
at com.sun.midp.security.SecurityToken.checkForPermission(+20)
at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(+51)
at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+23)
at com.sun.midp.io.j2me.sms.Protocol.openPrimInternal(+436)
at com.sun.midp.io.j2me.sms.Protocol.openPrim(+8)
at javax.microedition.io.Connector.openPrim(+121)
at javax.microedition.io.Connector.open(+15)
at javax.microedition.io.Connector.open(+6)
at javax.microedition.io.Connector.open(+5)
at example.sms.SMSReceive.startApp(+35)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+266)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)

Thanks again,
Arathi
Carlos Quiroz
Greenhorn

Joined: Oct 27, 2003
Posts: 14
Hi
The error you are getting is because the certificate used to sign is probably not obtained from a "well-known" certificate authority. I guess you made the certificate yourself?
In any case when you do that WTK automatically adds the certificate to its own CA list and that gives the impression that it works right away
If you only want to test, don't sign the MIDlet and set the security model to maximum.
Carlos Quiroz
Greenhorn

Joined: Oct 27, 2003
Posts: 14
Hi again
For the second error try to remove the permission request (Again only for testing) and run the MIDlet
Then it has to run. Are you using WTK with which emulator? Sun's, Nokia?
BR
Carlos
Anuja arathi
Greenhorn

Joined: Oct 29, 2003
Posts: 7
Hi ,
I don't know how to unsign the MIDlet once signed with a certificate.
I have executed another MIDlet (sms send/receive) which was not signed and with security set to maximum. I am still getting the same error "OTA Error Code (49) ".
Second problem is still ocurring even after removing the permissions.
I am using Sun's emulator. What I want to do is to send and receive and SMS through MIDlet.
Carlos, I have another question. I want to create a scenario, where the user sends an SMS (to SMS gateway) and in response can I send a MIDlet ? Is this possible?
Thanks ,
Arathi.
Carlos Quiroz
Greenhorn

Joined: Oct 27, 2003
Posts: 14
>I don't know how to unsign the MIDlet once signed with a certificate.
Basically just delete the MIDlet-Jar-SHA1 and all the MIDlet-Certificate-XXX
entries in your jad file
I think the WTK will also clean that when invoking the clean command
>I have executed another MIDlet (sms send/receive) which was not signed and >with security set to maximum. I am still getting the same error "OTA Error >Code (49) ".
Very strange. Can you install any MIDlet using OTA? I just tested my own sms midlet and worked fine
>Carlos, I have another question. I want to create a scenario, where the >user sends an SMS (to SMS gateway) and in response can I send a MIDlet ? Is >this possible?
That's a bit outside the scope of midlets. I believe is in general not possibl, but it should be possible using MMS. OTOH you could send an SMS that includes a url pointing to your MIDlet location
Regards
Anuja arathi
Greenhorn

Joined: Oct 29, 2003
Posts: 7
Carlos, I am able to execute a sample application "mmademo"(which comes with WTK) through "run via OTA" . It executed properly without any errors.
What is the Network you configured?. edit->preferences->network configuration. I have set it to http/1.1.
I have installed the WTK in some other directory and tried to execute the SMSDemo and am still getting the same problem. I don't know where else to look.
Thanks a lot for your help !!!
Arathi
Anuja arathi
Greenhorn

Joined: Oct 29, 2003
Posts: 7
Hi Again,
Carlos, I was able to run a MIDLET which sends an SMS through "Run Via OTA". I feel the problem is with the MIDLET which receives SMS. Could you please run any sample MIDlet to receive SMS.
But my MIDlet which sends an SMS is stuck when i send the SMS to WMA console. If you have any sample code which is working can you send it to "r_anuja@hotmail.com". Thanks a lot .
Arathi.
Carlos Quiroz
Greenhorn

Joined: Oct 27, 2003
Posts: 14
Originally posted by Anuja arathi:
Hi Again,
Carlos, I was able to run a MIDLET which sends an SMS through "Run Via OTA". I feel the problem is with the MIDLET which receives SMS. Could you please run any sample MIDlet to receive SMS.
But my MIDlet which sends an SMS is stuck when i send the SMS to WMA console. If you have any sample code which is working can you send it to "r_anuja@hotmail.com". Thanks a lot .
Arathi.

You just need to create an sms connection and add a message listener
like this
connection = "sms://:4545" //some port number
conn = (MessageConnection) Connector.open(connection);
conn.setMessageListener(alistner);
When you get a message you get a message to you listener
Testing this is a bit more tricky but with WTK you can use the WMA console to send messages either text or binary. Enable the network monitor, that shows the sms coming in and out
Another simple tip is that if your MIDlet sends and receives messages you can send a message to your own number, in WTK that's typicallly +5550000
There are two examples of using WMA in Forum Nokia at
http://www.forum.nokia.com/main/1,6566,1_0_15,00.html
Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code (49) - Application authorization failure"