Connecting to F5 i control API through JAVA code

I am getting error while connecting to F5 device. I guess probable reason is certificate (Caused by: java.lang.Exception: Truststore file does not exist:). Can anybody help me… how can i get this certificate…

AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException

faultSubcode:

faultString: java.net.SocketException: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

faultActor:

faultNode:

faultDetail:

{WebServices - Axis}stackTrace:java.net.SocketException: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:7)

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:11)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at iControl.SystemFailoverBindingStub.get_failover_state(SystemFailoverBindingStub.java:274)

at f5Admin.F5Admin.connectToF5(F5Admin.java:419)

at f5Admin.F5Admin.main(F5Admin.java:1343)

Caused by: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

at java.security.Provider$Service.newInstance(Provider.java:889)

at sun.security.jca.GetInstance.getInstance(GetInstance.java:299)

at sun.security.jca.GetInstance.getInstance(GetInstance.java:237)

at javax.net.ssl.SSLContext.getInstance(SSLContext.java:25)

at javax.net.ssl.SSLContext.getDefault(SSLContext.java:15)

at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:17)

at org.apache.axis.components.net.JSSESocketFactory.initFactory(JSSESocketFactory.java:61)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)

… 15 more

Caused by: java.lang.Exception: Truststore file does not exist: C:\Documents and Settings\gxsing\.keystore

at com.ibm.jsse2.tc.a(tc.java:59)

at com.ibm.jsse2.kc.f(kc.java:19)

at com.ibm.jsse2.kc.(kc.java:16)

at java.lang.J9VMInternals.newInstanceImpl(Native Method)

at java.lang.Class.newInstance(Class.java:1325)

at java.security.Provider$Service.newInstance(Provider.java:875)

… 22 more

{WebServices - Axis}hostname:PHXJ04968711

java.net.SocketException: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at iControl.SystemFailoverBindingStub.get_failover_state(SystemFailoverBindingStub.java:274)

at f5Admin.F5Admin.connectToF5(F5Admin.java:419)

at f5Admin.F5Admin.main(F5Admin.java:1343)

Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:7)

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:11)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

… 12 more

Caused by: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

at java.security.Provider$Service.newInstance(Provider.java:889)

at sun.security.jca.GetInstance.getInstance(GetInstance.java:299)

at sun.security.jca.GetInstance.getInstance(GetInstance.java:237)

at javax.net.ssl.SSLContext.getInstance(SSLContext.java:25)

at javax.net.ssl.SSLContext.getDefault(SSLContext.java:15)

at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:17)

at org.apache.axis.components.net.JSSESocketFactory.initFactory(JSSESocketFactory.java:61)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)

… 15 more

Caused by: java.lang.Exception: Truststore file does not exist: C:\Documents and Settings\user1\.keystore

at com.ibm.jsse2.tc.a(tc.java:59)

at com.ibm.jsse2.kc.f(kc.java:19)

at com.ibm.jsse2.kc.(kc.java:16)

at java.lang.J9VMInternals.newInstanceImpl(Native Method)

at java.lang.Class.newInstance(Class.java:1325)

at java.security.Provider$Service.newInstance(Provider.java:875)

… 22 more

Mar 1, 2012 11:15:51 AM F5Admin connectToF5

SEVERE: ERROR: Could not connect to F5java.net.SocketException: java.security.NoSuchAlgorithmException: SSLContext Default implementation not found:

Mar 1, 2012 11:15:51 AM F5Admin Main

SEVERE: Failed to connect to F5

Mar 1, 2012 11:15:51 AM F5Admin exitF5Admin

Are you using the iControl library for Java that I built?

If not, what library are you using?

I ran into the truststore issue due to the self-signed certs that the BIG-IP uses. I implemented a trust provider in that library that I documented in this blog post:

Hope this gives you enough to get you going. If you aren’t using my library, I’d love to hear what other Java toolkit you are using.

-Joe

Hi Joe,

Thanks for the reply. Sorry i was not able to reply for some time. So i used your Xtrust install class. But it seems that i already have provider : ‘XTrustJSSE version 1.0’.

I used this code:

public static void install()

{

java.security.Provider name = Security.getProvider(NAME);

int flag = 0;

if(Security.getProvider(NAME) == null)

{

flag=1;

Security.insertProviderAt(new XTrustProvider(), 2);

Security.setProperty(“ssl.TrustManagerFactory.algorithm”,

TrustManagerFactoryImpl.getAlgorithm());

}

if(flag==0){

System.out.println(“Not installed”);

System.out.println("Security Provider is : "+name);

}

}

Output is :

Not installed

Security Provider is : XTrustJSSE version 1.0

How did you solve your problem ?

I face the following error. Any ideas ?

AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException

faultSubcode:

faultString: java.net.SocketException: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

faultActor:

faultNode:

faultDetail:

{WebServices - Axis}stackTrace:java.net.SocketException: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:7)

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:11)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at iControl.LocalLBPoolBindingStub.get_list(LocalLBPoolBindingStub.java:1533)

at bigIPF5LoadBalancer.LoadBalancerPolicy.createPool(LoadBalancerPolicy.java:94)

at bigIPF5LoadBalancer.Test.main(Test.java:69)

Caused by: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

at javax.net.ssl.SSLJsseUtil.b(SSLJsseUtil.java:20)

at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:36)

at org.apache.axis.components.net.JSSESocketFactory.initFactory(JSSESocketFactory.java:61)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)

… 15 more

{WebServices - Axis}hostname:tpmoutbound9

java.net.SocketException: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at iControl.LocalLBPoolBindingStub.get_list(LocalLBPoolBindingStub.java:1533)

at bigIPF5LoadBalancer.LoadBalancerPolicy.createPool(LoadBalancerPolicy.java:94)

at bigIPF5LoadBalancer.Test.main(Test.java:69)

Caused by: java.net.SocketException: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:7)

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:11)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

… 12 more

Caused by: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

at javax.net.ssl.SSLJsseUtil.b(SSLJsseUtil.java:20)

at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:36)

at org.apache.axis.components.net.JSSESocketFactory.initFactory(JSSESocketFactory.java:61)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)

… 15 more

I added the following line of code to get rid of the above error ; but now i face the trustore file missing problem :. I am using iControl Assembly 10.2 Java

Security.setProperty(“ssl.SocketFactory.provider”, “com.ibm.jsse2.SSLSocketFactoryImpl”);

AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException

faultSubcode:

faultString: java.net.SocketException: java.lang.Exception: Truststore file does not exist: C:\Users\Administrator\.keystore

faultActor:

faultNode:

faultDetail:

{WebServices - Axis}stackTrace:java.net.SocketException: java.lang.Exception: Truststore file does not exist: C:\Users\Administrator\.keystore

at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:7)

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:11)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at iControl.LocalLBPoolBindingStub.get_list(LocalLBPoolBindingStub.java:1533)

at bigIPF5LoadBalancer.LoadBalancerPolicy.createPool(LoadBalancerPolicy.java:102)

at bigIPF5LoadBalancer.Test.main(Test.java:69)

Caused by: java.lang.Exception: Truststore file does not exist: C:\Users\Administrator\.keystore

at com.ibm.jsse2.tc.a(tc.java:55)

at com.ibm.jsse2.kc.f(kc.java:14)

at com.ibm.jsse2.kc.(kc.java:23)

at com.ibm.jsse2.kc.e(kc.java:8)

at com.ibm.jsse2.SSLSocketFactoryImpl.(SSLSocketFactoryImpl.java:5)

at java.lang.J9VMInternals.newInstanceImpl(Native Method)

at java.lang.Class.newInstance(Class.java:1328)

at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:21)

at org.apache.axis.components.net.JSSESocketFactory.initFactory(JSSESocketFactory.java:61)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)

… 15 more

{WebServices - Axis}hostname:tpmoutbound9

java.net.SocketException: java.lang.Exception: Truststore file does not exist: C:\Users\Administrator\.keystore

at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at iControl.LocalLBPoolBindingStub.get_list(LocalLBPoolBindingStub.java:1533)

at bigIPF5LoadBalancer.LoadBalancerPolicy.createPool(LoadBalancerPolicy.java:102)

at bigIPF5LoadBalancer.Test.main(Test.java:69)

Caused by: java.net.SocketException: java.lang.Exception: Truststore file does not exist: C:\Users\Administrator\.keystore

at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:7)

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:11)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

… 12 more

Caused by: java.lang.Exception: Truststore file does not exist: C:\Users\Administrator\.keystore

at com.ibm.jsse2.tc.a(tc.java:55)

at com.ibm.jsse2.kc.f(kc.java:14)

at com.ibm.jsse2.kc.(kc.java:23)

at com.ibm.jsse2.kc.e(kc.java:8)

at com.ibm.jsse2.SSLSocketFactoryImpl.(SSLSocketFactoryImpl.java:5)

at java.lang.J9VMInternals.newInstanceImpl(Native Method)

at java.lang.Class.newInstance(Class.java:1328)

at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:21)

at org.apache.axis.components.net.JSSESocketFactory.initFactory(JSSESocketFactory.java:61)

at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)

… 15 more

We were able to solve this problem by having jks keystore setup in our websphere servers. alternate is use signer certificates in websphere. In local you can add certificates manually.