• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Sun WTK Emulator & HTTPS

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All.

When i try connect to any url starting with "https://" from emulator i get IOException:

java.io.IOException: Alert (2,40)
- com.sun.midp.ssl.Record.rdRec(), bci=231
- com.sun.midp.ssl.Handshake.getNextMsg(), bci=14
- com.sun.midp.ssl.Handshake.rcvSrvrHello(), bci=2
- com.sun.midp.ssl.Handshake.doHandShake(), bci=26
- com.sun.midp.ssl.SSLStreamConnection.<init>(), bci=172
- com.sun.midp.io.j2me.https.Protocol.connect(), bci=253
- com.sun.midp.io.j2me.http.Protocol.streamConnect(), bci=20
- com.sun.midp.io.j2me.http.Protocol.startRequest(), bci=9
- com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=35
- com.sun.midp.io.j2me.http.Protocol.flush(), bci=29
- com.sun.midp.io.BaseOutputStream.flush(), bci=8
- dc.a(), bci=114
- kp.a(), bci=218
- kp.a(), bci=234
- ak.a(), bci=26
- of.b(), bci=20
- da.run(), bci=14



Reproduced on Sun WTK Emulator and Java ME SDK 3.0 Emulator. (on real device app works just fine)
Can anybody help me?
Thanks.
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTTPS depends on certificate negotiation. It could be that the emulator isn't successful at authorizing the certificate it recieves from the HTTPS site. --(I know my web browser certainly complains with security error prompts when I visit https website addresses that mistakenly send a certificate for their unsecure, regular http domain name address.)

There is an exception you can catch: javax.microedition.pki.CertificateException which is a subclass of IOException. You might really be catching a CertificateException rather than an IOException, and CertificateException can tell you more about what's going wrong.
 
Alex Al
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Walter Gabrielsen Iii wrote:HTTPS depends on certificate negotiation. It could be that the emulator isn't successful at authorizing the certificate it recieves from the HTTPS site. --(I know my web browser certainly complains with security error prompts when I visit https website addresses that mistakenly send a certificate for their unsecure, regular http domain name address.)

There is an exception you can catch: javax.microedition.pki.CertificateException which is a subclass of IOException. You might really be catching a CertificateException rather than an IOException, and CertificateException can tell you more about what's going wrong.



Thanks for reply.
Nope. It is not CertificateException - i've tested on another server with wrong certificate and saw CertificateException, but in my case it is definitely IOException.

Little clarifications:
1) this exception i get not on Connector.open(url) but on connection.openInputStream()
2) seems to on some https-servers it works fine without any exception. Still don't understand why it doesnt like my server
3) just in case i tried to import server certificate to wtk - not helps
4) application works correctly with my https-server on Symbian3 SDK Emulator

Any ideas?
Thanks.
 
Walter Gabrielsen Iii
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tracked down a website that documents com.sun.midp.ssl.Record from your error stack trace, above.

So, from your error message, your program is calling rdRec(), to read a value, where something is going wrong, and then it calls Alert(2,40). In other words, Fatal (2) Handshake failure alert type (40).

Perhaps, print out the exception message, getMessage(), and see what it says.
 
Walter Gabrielsen Iii
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have some questions:

1. Are you using the Java ME 3.0 SDK along with Java SE 6 or 7, which?

2. Have you added API Permissions properties?

Projects window (right-click your project)>> Properties (from menu):
Application Descriptor >> API Permissions

Add:

javax.microedition.io.Connector.https

3. Do you have an example of code where the error is happening?

4. Could it be that your Operating System's firewall is blocking the SDK application or Java?
 
Alex Al
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Walter Gabrielsen Iii wrote:I have some questions:

1. Are you using the Java ME 3.0 SDK along with Java SE 6 or 7, which?

2. Have you added API Permissions properties?

Projects window (right-click your project)>> Properties (from menu):
Application Descriptor >> API Permissions

Add:

javax.microedition.io.Connector.https

3. Do you have an example of code where the error is happening?

4. Could it be that your Operating System's firewall is blocking the SDK application or Java?



1. Java SE 6
2. javax.microedition.io.Connector.https exists in jad/manifest
3. Code is very simple and common, there is nothing special
4. I think no because it works fine with some https-servers.

But.. I dont have time to fight with this issue - i wrote simple http->https proxy and use it.
IAC thank for your help!
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic