Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Problem with Intial Context with t3s protocal

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

I am trying to connect to the secured access url througg my POJO using Weblogic server. But I am getting error related with the problem in reading the license file as following:

"IP address of secured access url" was not trusted causing SSL handshake failure. Check the certificate chain to determine if it should be trusted or not. If it should be trusted, then update the client trusted CA configuration to trust the CA certificate that signed the peer certificate chain. If you are connecting to a WLS server that is using demo certificates (the default WLS server behavior), and you want this client to trust demo certificates, then specify -Dweblogic.security.TrustKeyStore=DemoTrust on the command line for this client.>



"IP address of secured access url" = actually the url which I trying to access.



I am using the below code:

URL url;

HttpsURLConnection connection;



this.keyStoreFile = fileName;

this.keystorePassword = keystorePassword;



try {



// ########### set trust manager

SSLContext sc = SSLContext.getInstance("SSLv3");

TrustManager[] tma = {new CertDownload()};

sc.init(null, tma, null);

SSLSocketFactory ssf = sc.getSocketFactory();

HttpsURLConnection.setDefaultSSLSocketFactory(ssf);

// ###########



// hostname verifier

HostnameVerifier hv = new HostnameVerifier() {

public boolean verify(String urlHostName, SSLSession session) {

System.out.println("Warning: URL Host: " + urlHostName

+ " vs. " + session.getPeerHost());

return true;

}

};

HttpsURLConnection.setDefaultHostnameVerifier(hv);



} catch (Exception e) {

System.out

.println("Error occurred when configuring the HttpsURLConnection : "

+ e.getMessage());

throw e;

}



try {

System.out.println("EndPoint is: " + endPoint);

url = new URL(endPoint);

connection = (HttpsURLConnection) url.openConnection();

connection.connect();

Certificate[] certs = connection.getServerCertificates();

System.out.println("Number of certificates: " + certs.length);

for (int i = 0; i < certs.length; i++) {

System.out.println("Server certificate type"

+ certs[i].getType());



addToKeyStore(certs[i], alias);

}

System.out.println("Successfully downloaded certificates.");

} catch (Exception e) {

System.out

.println("Error occurred while downloading certificate to KeyStore: "

+ e.getMessage());

throw e;

}



Properties properties = new Properties();

properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

properties.put(Context.PROVIDER_URL, "t3s://Ip address:port no");

InitialContext context = new InitialContext(properties);




Please advise me for the above issue... early respose would be grateful to me...



 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic