# Connecting to F5 i control API through JAVA code

**URL:** <https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070>\
**Category:** Technical Forums\
**Tags:** icontrol, dev, devops\
**Created:** [March 1, 2012, 5:45pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070 "2012-03-01T17:45:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurpreet\_40964](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@Gurpreet\_40964](https://community.f5.com/u/Gurpreet_40964)\
**Post date:** [March 1, 2012, 5:45pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070/1 "2012-03-01T17:45:11Z")

</div>

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/](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](http://xml.apache.org/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](http://xml.apache.org/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

---

<div class="post-metadata">

**Author:** ![Joe\_Pruitt](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/joe_pruitt/32/8438_2.png) [@Joe\_Pruitt](https://community.f5.com/u/Joe_Pruitt)\
**Post date:** [March 1, 2012, 5:59pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070/2 "2012-03-01T17:59:48Z")

</div>

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

> **[DevCentral - An F5 Technical Community](https://community.f5.com/)**
>
> DevCentral is an online technical community where engineers and practitioners collaborate, share knowledge, and solve problems related to F5 technologies and industry trends.

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:

> **[DevCentral - An F5 Technical Community](https://community.f5.com/)**
>
> DevCentral is an online technical community where engineers and practitioners collaborate, share knowledge, and solve problems related to F5 technologies and industry trends.

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

---

<div class="post-metadata">

**Author:** ![Gurpreet\_40964](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@Gurpreet\_40964](https://community.f5.com/u/Gurpreet_40964)\
**Post date:** [March 6, 2012, 6:02pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070/3 "2012-03-06T18:02:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hasan\_35483](https://avatars.discourse-cdn.com/v4/letter/h/aca169/32.png) [@Hasan\_35483](https://community.f5.com/u/Hasan_35483)\
**Post date:** [April 20, 2012, 12:11pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070/4 "2012-04-20T12:11:02Z")

</div>

How did you solve your problem ?

I face the following error. Any ideas ?

AxisFault

faultCode: {[http://schemas.xmlsoap.org/soap/envelope/](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](http://xml.apache.org/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](http://xml.apache.org/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

---

<div class="post-metadata">

**Author:** ![Hasan\_35483](https://avatars.discourse-cdn.com/v4/letter/h/aca169/32.png) [@Hasan\_35483](https://community.f5.com/u/Hasan_35483)\
**Post date:** [April 20, 2012, 2:02pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070/5 "2012-04-20T14:02:09Z")

</div>

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/](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](http://xml.apache.org/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](http://xml.apache.org/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

---

<div class="post-metadata">

**Author:** ![Gurpreet\_40964](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@Gurpreet\_40964](https://community.f5.com/u/Gurpreet_40964)\
**Post date:** [June 14, 2013, 9:04pm UTC](https://community.f5.com/t/connecting-to-f5-i-control-api-through-java-code/23070/6 "2013-06-14T21:04:42Z")

</div>

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.
