aspose file tools*
The moose likes BEA/Weblogic and the fly likes Problem with Intial Context with t3s protocal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Problem with Intial Context with t3s protocal" Watch "Problem with Intial Context with t3s protocal" New topic
Author

Problem with Intial Context with t3s protocal

Milind Chaudhari
Greenhorn

Joined: Jul 28, 2011
Posts: 2
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...



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Intial Context with t3s protocal