Author |
Message
|
vikas.bhu |
Posted: Mon Sep 27, 2010 2:44 am Post subject: java.security.NoSuchAlgorithmException: Algorithm SunX509 no |
|
|
Disciple
Joined: 17 May 2009 Posts: 159
|
java.security.NoSuchAlgorithmException: Algorithm SunX509 not available'.
Hi,
We had a custom java node in the MB code, which has been successfully deployed on two different environments.
The code runs fine on one environment, but fails on the other with the following error.
The jar files of the external custom node deployed on the jplugin folder of the env is same in both the cases.
Following is the code fragment where the flow fails:
public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
try
{
TrustManager[] trustAllCerts = getTrustManager();
KeyManagerFactory kmf;
KeyStore ks;
char[] passphrase = this.getKeyStorePassWd().toCharArray();
kmf = KeyManagerFactory.getInstance("SunX509");
ks = KeyStore.getInstance("jks");
ks.load(new FileInputStream(this.getCaStoreFileName()), passphrase);
kmf.init(ks, passphrase);
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(kmf.getKeyManagers(), trustAllCerts, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
SocketFactory socketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
return socketFactory.createSocket(host, port);
}
catch (Exception ex) {
throw new UnknownHostException("Problems to connect/createSocket1 " + host + ", " + ex.toString());
}
}
/**
Please explain if there is some configuration issues or missing jar files in the runtime which throws this exception. |
|
Back to top |
|
 |
napier |
Posted: Mon Sep 27, 2010 6:47 am Post subject: |
|
|
 Apprentice
Joined: 09 Oct 2007 Posts: 48 Location: USA
|
Is this exception on HP-UX? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Sep 27, 2010 7:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
X509 is not an Algorithm! It is a format! get with the SSL program!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
vikas.bhu |
Posted: Mon Sep 27, 2010 9:52 pm Post subject: |
|
|
Disciple
Joined: 17 May 2009 Posts: 159
|
it is comming on windows.
even the java_home is pointing correctly.
and the3 jar file in ext folder are placed properly.
we have removed the jar files with production one,but still not working. |
|
Back to top |
|
 |
vikas.bhu |
Posted: Tue Sep 28, 2010 2:19 am Post subject: |
|
|
Disciple
Joined: 17 May 2009 Posts: 159
|
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Sep 28, 2010 6:55 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
vikas.bhu wrote: |
any clue please...
kmf = KeyManagerFactory.getInstance("SunX509");
|
This is your problem. the getInstance method requires an algorithm and what you supplied is a format...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
napier |
Posted: Tue Sep 28, 2010 9:48 am Post subject: |
|
|
 Apprentice
Joined: 09 Oct 2007 Posts: 48 Location: USA
|
We have similar exception on HP-UX. We modified the list of security provider preference order in java.security file to resolve the issue. |
|
Back to top |
|
 |
vikas.bhu |
Posted: Wed Sep 29, 2010 12:30 am Post subject: |
|
|
Disciple
Joined: 17 May 2009 Posts: 159
|
what exactly you changed in that file? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Sep 29, 2010 11:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
try
Code: |
kmf = KeyManagerFactory.getInstance("TLS"); |
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
napier |
Posted: Wed Sep 29, 2010 11:20 am Post subject: |
|
|
 Apprentice
Joined: 09 Oct 2007 Posts: 48 Location: USA
|
We changed sun.security.provider.Sun preference from 2 to 4. |
|
Back to top |
|
 |
|