finos / symphony-bdk-java

The Symphony BDK (Bot Developer Kit) for Java helps you to create production-grade Chat Bots and Extension Applications on top of the Symphony REST APIs.
https://symphony-bdk-java.finos.org
Apache License 2.0
23 stars 69 forks source link

SymBotAuth.kmAuthClient doesn't use proxy settings #3

Closed gonzalad closed 5 years ago

gonzalad commented 6 years ago

Hello,

I have an error when using config.json config with a proxy :

UnknownHostException: xxx-api.symphony.com.

kmAuthClient doesn't use proxy settings (see https://github.com/SymphonyPlatformSolutions/symphony-api-client-java/blob/9a8c4f141c6b9e30609800d462d6218b97b41f0e/src/main/java/authentication/SymBotAuth.java#L37)

Sample config.json:

{
  "sessionAuthHost": "xxx-api.symphony.com",
  "sessionAuthPort": 443,
  "keyAuthHost": "xxx-api.symphony.com",
  "keyAuthPort": 443,
  "podHost": "xxx-api.symphony.com",
  "podPort": 443,
  "agentHost": "xxx-api.symphony.com",
  "agentPort": 443,
  "botCertPath": "C:\\keys\\",
  "botCertName": "bot",
  "botCertPassword": "changeit",
  "botEmailAddress": "BOT-EMAIL-ADDRESS",
  "appCertPath": "",
  "appCertName": "",
  "appCertPassword": "",
  "proxyURL": "http://proxy:8080",
  "proxyUsername": "user",
  "proxyPassword": "pwd"
}

Full stacktrace:

10:38:36.759 [main] INFO authentication.SymBotAuth - KM auth
Disconnected from the target VM, address: '127.0.0.1:50289', transport: 'socket'
Exception in thread "main" javax.ws.rs.ProcessingException: java.net.UnknownHostException: xxx-api.symphony.com
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252)
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684)
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343)
    at authentication.SymBotAuth.kmAuthenticate(SymBotAuth.java:141)
    at authentication.SymBotAuth.authenticate(SymBotAuth.java:83)
    at com.xxx.chatbot.symphony.BotExample.<init>(BotExample.java:42)
    at com.xxx.chatbot.symphony.BotExample.main(BotExample.java:16)
Caused by: java.net.UnknownHostException: xxx-api.symphony.com
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:399)
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
    ... 14 more
herrhilmi commented 5 years ago

Hello @gonzalad, My reply is quite late, I hope you fix your issue in between. Actually, this is a normal behaviour since KM module's usually deployed on-premise. So, no need for a proxy.

gonzalad commented 5 years ago

Hi @herrhilmi, I stumbled on this issue when working for my previous company.

Our app was deployed in our europe datacenter and called our company datacenter in Asia. Hence the need to setup the proxy. I fixed that by patching symphony-api-client-java source code alas.

Cheers, Adrian