Using HttpsURLConnection
Hello evertbody I have a problem programming a channel, I'm using Portal 6.1 running under Applicatrion Server 7, also in this instance is running Identity Server.
The channel must connecto to a utl using https, but URL.openConnection return a
com.iplanet.services.comm.https.HttpsURLConnection
insted of a javax.net.ssl.HttpsURLConnection, I have been reading and this is because the
-Djava.protocol.handler.pkgs=com.iplanet.services.comm
in the Application Server JVM Settings, so how can I get a javax.net.ssl.HttpsURLConnection, or what should I do, i can't find any documentation for the com.iplanet.services.comm.https.HttpsURLConnection class
Thanks for your help
Are you using the URL-Sraper Channel?
if Yes =>
Does it work properly with a "normal" HTTP connection to
another resource ?
You might have a problem with the proxy settings.
hth,
Ulf
Similar Messages
-
How to call a WebService method using HttpsURLConnection?
Hi,
I want to know how i could use HttpsURLConnection to call a WebService method.
I can use the following:
String endpoint = "https://xyz:8443/axis/services/MSecurity";
System.setProperty("javax.net.ssl.keyStore", keyStorepath);
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
System.setProperty("javax.net.ssl.trustStore", trustStorePath);
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStorePassword", trustpass);
//Call Web Service
URL url = new URL(endpoint);
MSecuritySoapBindingStub service = new MSecuritySoapBindingStub(url, null);
//get list of people
String[] vo = service.getVO();
for (int i = 0; i < vo.length; i++) {
System.out.println(vo);
However, loading my cert. this way is not flexible. Therefore, I am using SSLContext to initialize my keystore and truststore and then I am using the following to connect to my webservice:
SSLContext sc = SSLContext.getInstance("SSLv3");
sc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
SSLSocketFactory ssf = sc.getSocketFactory();
URL url = new URL(endpoint);
HttpsURLConnection htp = (HttpsURLConnection) url.openConnection();
htp.setSSLSocketFactory(ssf);
However, I do not know how I could use the "htp" object to call the getVO() method above.Use Apache Axis to do SOAP in Java.
Nobody can just mail you the code. You first have to create java source files from the web service via its WSDL file. -
ClassCastException using HttpsURLConnection with Tomcat 4.1.27
Hi,
I try to open an SSL connection using HttpsURLConnection that works fine with a standalone application (see code fragment):
import javax.net.ssl.HttpsURLConnection;
import java.net.*;
import java.io.*;
URL website = new URL( "https://aSampleSSLSite" );
HttpsURLConnection connection = ( HttpsURLConnection ) website.openConnection();
Using the same code in Tomcat 4.1.27 and Struts 1.1 throws a java.lang.ClassCastException while trying to use website.openConnection().
What is the difference?Hi,
I'm using JDK 1.4.2 and haven't installed JSSE separately at all. Actually I really use javax.net.ssl.HttpsURLConnection. However, I tried com.sun.net.ssl.HttpsURLConnection as well and got a 'java.net.SocketException: Default SSL context init failed' instead of.
Oddly enough the code works fine in a standalone application. -
VM: 1.4.x
Container: JBoss 4.x (Servlet)
I'm trying to POST to a trusted site using HttpsURLConnection, but I'm not sure what the format of the request params is. I have tried the GET-style as in:
name1=value1&name2=value2and line separated as in:
name1=value1\n
name2=value2\nbut none seem to work. My suspicion is that the parameters are malformed. Here is the code (note the loop):
HttpsURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/html; charset=UTF-8");
conn.setDoInput(true);
conn.setDoOutput(true);
while(keys.hasNext()){
String name = (String)keys.next();
String value = (String)data.get(name);
char ch = keys.hasNext()?'&':'\n';
postData.append(name + "=" + URLEncoder.encode(value, "UTF-8") + ch);
out = new PrintWriter(conn.getOutputStream());
out.print(postData.toString().getBytes());
out.flush();Then use BufferedReader to read the response, which seems to be working fine.
My questions is, how should the request params be printed in a (SSL) POST request?
ThanksHi,
there is a library called HTTPClient available for free on:
http://jakarta.apache.org/commons/httpclient/
It supports time out, besides a bunch of other features.
Also HTTPS is straight forward, as soon as the underlying JSSE
installation is done. -
Tunneling Problem using HttpsUrlConnection
Hi,
I had gone through forums regarding this topic and still i am facing the same problem using the HttpsUrlConnection. We are working behind a proxy so we have to make a proxy authorization if we want to connect to a server in the internet.
But in case of HttpUrlConnection, everything works
fine. But if we do the same with a HttpsUrlConnection, the authentication fails. It throws an IOException
with the message
Unable to tunnel through 192.9.100.10:80.
Proxy returns "HTTP/1.1 407 Proxy authentication required"
Sample code as follows,
The following code doesn't have any problem becos it works fine with HttpUrlConnection and also it is working without proxyserver for https as well.
This is running under MSVM.
I don't want to use SSLSocketFactory and i need to use following layout(i.e only with Httpsurlconnection)
Is there any way to make work with proxyserver? Or can't we do this at all?
System.setProperty("proxySet","true");
System.setProperty("https.proxyHost","proxyIP");
System.setProperty("https.proxyPort","80");
OutputStream os = null;
OutputStreamWriter osw = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader br = null;
URL url;
String line = null;
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
String login = proxyUserName+":"+proxyPassWord;
String encodedLogin = new sun.misc.BASE64Encoder().encode(login.getBytes());
url = new URL("https://www.verisign.com");
HttpsURLConnection con = null;
con =(HttpsURLConnection) url.openConnection();
con.setRequestProperty("Proxy-Authorization", encodedLogin);
con.setRequestMethod("GET");
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(false);
con.connect();
os = con.getOutputStream();
osw = new OutputStreamWriter(os);
osw.write("SampleMsg");
osw.flush();
osw.close();
is = con.getInputStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
while ( (line = br.readLine()) != null)
System.out.println("line: " + line);
Can any one help me regarding this?I need a reply very urgently.
Thanks,
Prabhakaran RHope this help.
Note to change the properties to fit your system, and use the supported package ( JSSE, JRE1.5.......).
You can use URLConnection for both HTTP or HTTPS protocol.
import java.io.*;
import java.net.*;
import java.security.*;
import java.util.*;
import javax.net.ssl.*;
public class testSSL9 {
public testSSL9() {
byte[] data = httpConnection();
System.out.println(new String(data));
public static void main(String[] args) {
Properties sysprops = System.getProperties();
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// sysprops.put("java.protocol.handler.pkgs",
// "com.sun.net.ssl.internal.www.protocol");
sysprops.put("java.protocol.handler.pkgs",
"javax.net.ssl.internal.www.protocol");
sysprops.put("javax.net.ssl.trustStore",
"D:/jdk1.4/jre/lib/security/cacerts");
sysprops.put("javax.net.debug", "ssl,handshake,data,trustmanager");
sysprops.put("https.proxyHost", "172.16.0.1");
sysprops.put("https.proxyPort", "3128");
sysprops.put("https.proxySet", "true");
sysprops.put("http.proxyHost", "172.16.0.1");
sysprops.put("http.proxyPort", "3128");
sysprops.put("proxySet", "true");
testSSL9 testSSL91 = new testSSL9();
private byte[] httpConnection() {
try {
URL url = null;
// String strurl = "https://www.verisign.com";
String strurl = "https://central.sun.net";
// String strurl = "http://www.yahoo.com"; --> use: HttpURLConnection
url = new URL(strurl);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
HttpsURLConnection.setFollowRedirects(false);
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.connect();
InputStream stream = null;
BufferedInputStream in = null;
ByteArrayOutputStream bytearr = null;
BufferedOutputStream out = null;
try {
stream = connection.getInputStream();
in = new BufferedInputStream(stream);
bytearr = new ByteArrayOutputStream();
out = new BufferedOutputStream(bytearr);
catch (Exception ex1) {
System.out.println(ex1);
System.out.println("Server reject connection...sory");
int i = 0;
while ( (i = in.read()) != -1) {
out.write(i);
out.flush();
stream.close();
in.close();
bytearr.close();
out.close();
return bytearr.toByteArray();
catch (Exception ex) {
ex.printStackTrace();
return null;
} -
Classcast exception while using HttpsURLConnection
I am using java1.3. I have downloaded all the jars in JSSE..however when i am using the HttpsURLConnection class i get ClassCase exception at
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
I don't get any error while compiling however get the error when executing
Any help on this will greatly appricated.
Thanks
SudhaMagic, that worked for me.
Now the real question is why did it work. My code worked fine under JRE 1.3.1, but when I remove jsse.jar from my classpath and upgraded to JRE 1.4.1 it broke. By commenting out the System.setProperty it now works. Strange.
Cheers,
Paul -
Using HttpsURLConnection Error - from Web Dynpro
I have this case where I need to connect to a https site using SSL api.
I'd created a java class to connect to the https site using the normal "javax.net.ssl" package provided by J2SE api. And this work successfully.
However, there will be a problem if i trigger an action from the view to call for this java class, there will be an error.
One thing which i found weird is :
1.) If i use the normal java class to connect to the https site, it uses this connection protocol :
sun.net.www.protocol.https.DelegateHttpsURLConnection:https://server/test/test1.jsp (Works successfully)
But
If I call this java class from a view, it uses this connection protocol :
iaik.protocol.https.HttpsURLConnection:https://server:443/test/test1.jsp (Unable to work)
How am i to make the web dynpro to use this "javax.net.ssl" api? I tried removing two of these library file :
iaik_jsse.jar
iaik_ssl.jar
but the error still occurs.
Does anyone have any idea how to solve this problem? Thanks.Hi jo lum
did you solve the problem? I am facing the same. Maybe you can give me a hint.
Thank you in advance
Martin -
Help downloading a file using HttpsURLConnection
Hi All,
I am trying to connect to a page that is actually a cgi page and download a file from there using the httpsURLConnection.
When I run the URL from the browser, I get an authentication challenge...I authenticate, then I get the Download file box where I can download the file.
When I run my code to connect to the URL using the httpsURLConnection, I'm able to authenticate using post then what comes back is the html for the front page. (like an index page or something).
Is this even possible? Any help would be greatly appreciated.
Here's some of the code...
URL url = new URL ("https://.... /file.cgi?.....");
HttpsURLConnection c = null;
c = (HttpsURLConnection)url.openConnection();
c.setRequestMethod("POST");
c.setRequestProperty("Authorization", "Basic " + BasicAuth.encode(user, password));
c.setRequestProperty("User-Agent", "Mozilla/4.0(compatible)");
c.setRequestProperty("Content-Disposition", "attachment;filename=\"events.csv\"");
c.setRequestProperty("Content-Type", "application/x-csv");
c.setRequestProperty( "Accept", "application/x-csv");
c.connect();
//System.out.println(c.getContentEncoding());
System.out.println("Response code: " +c.getResponseCode());
InputStream in = c.getInputStream();
StringBuffer b = new StringBuffer();
BufferedReader r = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = r.readLine()) != null)
b.append(line);
String s = b.toString();
System.out.println(s);I just noticed that the page it brings back is exactly the page that I get in the browser when I do not type the attributes after the https://---.cgi?.
For example the url is ....cgi?subcmd=Download
So, is there some place I can set these attributes within the java code that isn't in the url field? -
Servlet/Tomcat using HTTPsUrlConnection error
Hello all,
I am fairly new to java/tomcat and am attempting to develop an SSO connection. When I get to the following line of code in my servlet
HttpsURLConnection httpConn = (HttpsURLConnection)sso.openConnection();
I receive the following error:
SingleSignOn threw exception
java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
Any help is much appreciated.
Regards,
--Omar
Edited by: user7041419 on Nov 17, 2010 3:26 PMYes that is one of the issues I have. Thanks for the assistance.
-
Using keytool to import a certificate
I'm trying to import in the samplecacerts file a seft signed certificate generated for test purposes on my test web server.
The command I issued was:
keytool -import -alias mycert -file mycert.cer -keystore samplecacerts -trustcacert -storepass changeitand the answer was:
keytool error: Signature not availableIf I accept this certificate using my class that implements the interface X509TrustManager and getting data using HttpsURLConnection all works fine.
I used two methods to export the certificate:
1. I exported it after accepting it in Ienternet Explorer
2. I wrote it from the method isServerTrusted as suggested by Aseem in his sample code (http://forum.java.sun.com/thread.jsp?forum=9&thread=14884&start=25&range=1&hilite=false&q=)
The two generated files are identical.
Anyone can help me?
Thank
AldoI am having the same problem - and I don't understand the one reply you got.
So here goes. WHY can I easily import a self-signed certificate as a "trusted root" in IE, but I cannot import the same certificate into my cacerts file using keytool.exe? Keytool always gives the error, "Signature not available".
Can someone please tell me what the heck I am supposed to do? All I want to do is be able to connect to an https URL in my Java code and read the contents. I "trust" the darn server, but the keytool utility doesn't seem to "trust" me....
BTW, yes I am using JSSE, it's not a code problem it's a keytool problem. -
ClassCastException in HttpsURLConnection
I try to connect to https://verisign.com using HttpsURLConnection..and i get :
Exception in thread "main" java.lang.ClassCastException: com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl
at URLReader.main(URLReader.java:22)
code:
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
System.setProperty("javax.net.ssl.trustStore","/home/httpd/servlets/cacerts");
URL verisign = new URL("https://www.verisign.com/");
HttpsURLConnection cx =(HttpsURLConnection)verisign.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(verisign.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
Is this problem connected with wrong certificate?
But why is it a CastException?
Please help thanks.Had this one.
You probably use the new class:
javax.net.ssl.HttpsURLConnection and verisign uses
older com.sun.net.ssl.HttpsURLConnection. -
HttpsURLConnection class cast exception problem
Hy everyone,
I have next java code to send xml file over https.
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
// Install the all-trusting trust manager
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (Exception e) {
e.printStackTrace();
//Make the output file for xml response
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_kk-mm-ss");
_xmlResponseIme = dateFormat.format(new Date());
try {
if (createOutXML(_xmlResponseIme)){
this.set_xmlResponseIme(_xmlResponseIme);
} catch (IOException e2) {
//System.out.println("SSLClient :: createOutXML catch");
e2.printStackTrace();
//translate request.xml file to String
File xmlRequest = new File(_path + "/XMLFiles/request.xml");
String xmlFile="";
try {
xmlFile = this.getStringFromXMLFile(xmlRequest);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
this.registerMyHostnameVerifier();
try {
path = "https://"+host+_config.getString("path");
url = new URL(path);
} catch (MalformedURLException e1) {
e1.printStackTrace();
try {
conn = (javax.net.ssl.HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded;charset=Cp1250");
conn.setDoInput(true);
conn.setDoOutput(true);
//conn.setDefaultUseCaches(false);
conn.setRequestProperty("xml", xmlFile);
conn.setAllowUserInteraction(true);
System.out.println("Response kod = " + conn.getResponseCode());
} catch (IOException e2) {
e2.printStackTrace();
try {
//receive answer
InputStream in = conn.getInputStream();
FileOutputStream fout;
fout = new FileOutputStream(_xmlOut);
StringBuffer sb = new StringBuffer();
Reader reader = new InputStreamReader(in, "Cp1250");
int c;
while ((c = in.read()) != -1){
sb.append((char) c);
fout.write((byte) c);
String document = sb.toString();
System.out.println(document);
fout.close();
in.close();
} catch (IOException e3) {
e3.printStackTrace();
Problem is that on one WebSphere Application Server 6 is everithing OK, but on another I receive error :
On both server I have same jdk.
Error 500: com.ibm.net.ssl.internal.www.protocol.https.HttpsURLConnection
in line
conn = (javax.net.ssl.HttpsURLConnection) url.openConnection();
Where is the problem ??Sorry, should have been:
javax.net.ssl.trustStore=path/to/etc/etc/DummyServerTrustFile.jks
javax.net.ssl.trustStorePassword=WebAS
Didn't get it to actually work like that though. trustStore & trustStorePassword were always null when I ran my program under WAS5.1.
Here is what I did. If running from command line using WAS5.1 as JRE, first setup the environment:
set JAVA_HOME=C:\Program Files\IBM\SDP70\runtimes\base_v51\java\jre
java -Djava.protocol.handler.pkgs=com.ibm.net.ssl.internal.www.protocol myProgramIndependent of whether running from command line or in RAD7, code in program:
System.setProperty("javax.net.ssl.trustStore",
"C:\\Program Files\\IBM\\SDP70\\runtimes\\base_v51\\etc\\DummyServerTrustFile.jks");
System.setProperty("javax.net.ssl.trustStorePassword","WebAS");(would be better to be able to specify trustStorePassword in WAS than in code though,
but works as such)
One can use some other file but I just added the certificate to DummyServerTrustFile.jks.
Then, unlike I said, one CAN use the HttpsURLConnection, like this:
com.ibm.net.ssl.internal.www.protocol.https.HttpsURLConnection conn = null;
URL urli = new URL("https://some.address.com");
conn = (com.ibm.net.ssl.internal.www.protocol.https.HttpsURLConnection)urli.openConnection();
Note this uses classes from C:\Program Files\IBM\SDP70\runtimes\base_v51\java\jre\lib\ibmjsseprovider.jar, so it needs to be in classpath when compiling.
Now this way I didn't get a cast exception from using HttpsURLConnection. The point is one can't instantiate javax.net.ssl.HttpsURLConnection, because RAD7's WAS5.1 can't cast it into its own class (wish it could).
Also, I still couldn't use the javax.net.ssl.HttpsURLConnection.setHostnameVerifier method, because com.ibm.net.ssl.internal.www.protocol.https.HttpsURLConnection doesn't have it... So the result was pretty much the same as using a HttpURLConnection as I previously instructed. Well, I don't really need that method in practice, but I suppose one might need it in some situation. The IBM URL I quoted said WAS5.1 doesn't really compare DNS host name with the certificate host name though, so I suppose one doesn't need to programmatically set a dummy HostnameVerifier in WAS5.1. -
Problem with HttpsURLConnection
Hello,
I have a problem when I use HttpsURLConnection. I have this code:
import java.security.*;
import com.sun.net.ssl.*;
import javax.net.ssl.*;
import javax.net.*;
import java.net.*;
import java.io.*;
import java.util.*;
import javax.net.ssl.HttpsURLConnection;
public class ConexionPrueba
public static void main (String[] args) {
try {
URL URL = new URL("https://194.140.2.144:7002/recepcionXML/recepcionLOC");
System.getProperties().put("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
javax.net.ssl.HttpsURLConnection HttpCon = (javax.net.ssl.HttpsURLConnection) URL.openConnection();
System.out.println("me he conectado a: " + HttpCon.toString());
HttpCon.setDoOutput( true );
HttpCon.setDoInput( true );
HttpCon.setRequestMethod( "POST" );
HttpCon.setRequestProperty("server-protocol", "HTTP/1.1");
HttpCon.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
HttpCon.setUseCaches(false);
FileWriter fd = new FileWriter("resultado_localizacion.xml");
BufferedReader bufferInput = null;
bufferInput = new BufferedReader(new InputStreamReader(HttpCon.getInputStream()));
String str = bufferInput.readLine();
while (str != null) {
fd.write(str);
if (str.equals("</GPPM_IT>"))
break;
str = bufferInput.readLine();
} catch (SSLHandshakeException e2) {
e2.printStackTrace();
}catch (Exception e) {
e.printStackTrace();
public ConexionPrueba() {}
public void conectar() {
try {
// System.getProperties().setProperty("java.protocol.handler.pkgs", "HTTPClient");
//String resultado = (String) System.getProperties().get("java.protocol.handler.pkgs");
//System.out.println("resultado es: " + resultado);
//Handler handler = new Handler();
//System.out.println("creando el handler: " + handler.toString());
URL httpURL = new URL("https://194.140.2.144:7002/recepcionXML/recepcionLOC?CLIENT=patricia&CLIENT_PASSWD=patricia&USERID=34678625168&USERID_TYPE=MSISDN");
Conectar conectar = new Conectar(httpURL);
conectar.connect();
System.out.println("la url a la que voya a llamar es: " + httpURL.toString());
// System.out.println("estoy pasando despues de crear la url");
//URLConnection con = handler.openConnection(httpURL);
//System.out.println("pasando por detras de URLConnection");
//HTTPConnection con = new HTTPConnection("https", "https://194.140.2.144:7002/recepcionXML/recepcionLOC?CLIENT=patricia&CLIENT_PASSWD=patricia&USERID=34678625168&USERID_TYPE=MSISDN", -1);
// HTTPConnection con = new HTTPConnection(httpURL);
//System.out.println("pasando despues de abrir una URL Connection");
//HTTPConnection con = new HTTPConnection(httpURL);
//Cogemos por post lo que hay en el response
HTTPResponse rsp = con.Post("c:/jswdk101/jswdk-1.0.1/respuesta_localizacion.xml");
//URLConnection con = httpURL.openConnection();
// System.out.println("intentando conectarme....");
// con.setDoInput(true);
// con.setDoOutput(true);
* Recojo el fichero que me ha enviado Localizacion
/* FileWriter fd = new FileWriter(fichero_salida);
// Recojo la respuesta del servlet
BufferedReader bufferInput = null;
// bufferInput = new BufferedReader(new InputStreamReader(con.getInputStream()));
bufferInput = new BufferedReader(new InputStreamReader(rsp.getInputStream()));
String str = bufferInput.readLine();
while (str != null) {
fd.write(str);
if (str.equals("</GPPM_IT>"))
break;
str = bufferInput.readLine();
} catch (Exception e){
e.printStackTrace();
When i run this class, I have this exception:
javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(DashoA6275)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:58)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:562)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA6275)
at ConexionPrueba.main(ConexionPrueba.java:35)
I hope that you can help me. Thanks,
PatriciaTry reading this documentation: http://developer.java.sun.com/developer/technicalArticles/Security/secureinternet2/
-
Hi,
I am trying to use HttpsURLConnection uisng
URL u = new URL("https://vdcvcvb..");
javax.net.ssl.HttpsURLConnection conn = (javax.net.ssl.httpsURLConnection) u.openConnection();
When i compile. i get error as:
cannot resolve symbol.
I think i need to include some jar file in classpath. WHat is
the jar file and where i can find it. Any help is
greatly apprecited.
ThanksGive the entire error message please.
-
ClassCastException while instantiate HttpsURLConnection
When I try to instantiate an HttpsURLConnection from an URL instance called "Server,"
HttpsURLConnection conn =(HttpsURLConnection) server.openConnection();I got the following exception:
java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection incompatible with javax.net.ssl.HttpsURLConnection
May I know if there is anyway to solve it? I have to use HttpsURLConnection.
Thank you!Hi,
you did not provide your import statements contained in the class. Please check which class named HttpsURLConnection you are trying to import.
Maybe your import refers to sun.net.www.protocol.http..., which is imcompatible with the one in javax.net.ssl....
Bye.
Maybe you are looking for
-
Hi, anyone knows how to calculate the size of a 9000 records on 28 columns report that is pulled from a Universe into Excel through Live Office? I am interested in 3 type of sizes: - Maximum Character Stream Size MB - Binary Stream Maximum Size MB -
-
Hai everyone, Is it possible for me to display a pdf file in an applet or an application?? if yes , please give me a link where i can get the informatio about .. thanx Peter Iyer
-
How do I convert footage from my iPhone to edit in final cut pro?
I have some video's that I shot with my iPhone 3Gs and also hidef video that I shot from my iPhone 4. When I try to edit these in FCP, it makes me render every time I slow the footage or put any effect on the footage. Is there a way to just convert t
-
Where is the duplex-button??
Hi! I need a duplex print, but there is no button to choose this option. I have a mac and my printer is a duplex printer, the Reader is Version 11.0.10. The only way is to click the button "printer". But in this way I leave the adobe-print-window and
-
Split screen edit in FCPX?
I'm having trouble figuring out how to do a split screen edit in Final Cut Pro X. Anyone know how?