I am developing a midlet to get some data back from a servlet running on my tomcat. I want to use https to get the data back.These are the steps I followed. My tools are
1.netbeans 4.5 , sun WTK emulator , tomcat 6.0 .
What and I did so far ,

1. I uncomment server.xml in tomcat to enable 8443 port .

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />

2. I deleted .keystore file in my home directory and created a new keystore file using the below command.

keytool -genkey -alias tomcat -keyalg RSA

I gave CN name as 127.0.0.1

3.I accessed my servlet using the URL from firefox https://127.0.0.1:8443/secureapp

It told me about a certificate issue and I gave security confirmation and the ceritificate
was downloaded to browser and I got servlet output in browser window.

4.Now I want to connect to servlet using j2me.So I used the below code to get the certificate details.
I am using Netbeans and using emulator provided by SUN,WTK Version 2.5.2.

try {
// Query the server and retrieve the response.
HttpsConnection hc = (HttpsConnection)Connector.open("https://127.0.0.1:8443/secureapp");
SecurityInfo si = hc.getSecurityInfo();
Certificate c = si.getServerCertificate();
String subject = c.getSubject();

String s = "Server certificate subject: \n" + subject;
Alert a = new Alert("Result", s, null, null);
a.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(a, form);
hc.close();
}
catch (Exception ioe) {
Alert a = new Alert("Exception", ioe.toString(), null, null);
a.setTimeout(Alert.FOREVER);
System.out.println(ioe.toString());
mDisplay.setCurrent(a, form);
}

Problem : I could not connect to my servlet.And I get the exception as

javax.microedition.pki.CertificateException: Certificate was issued by an unrecognized entity

I only know that I need to import my certificate to my emulator or something.I googled a lot and could not come to a solution.I tried to import my new keystore and export key to emulator.It simply says error occured while exporting keys.

I need someone to help me import the certificate to my emulator so that I can connect to my servlet by https.I would like an answer from someone who has really done this scenario and successfully used self signed certificate in an emulator.