2
votes

I'm running 3 images for API-M and API-M Analytics in Docker:

  • wso2am:3.0.0-centos7 is image for API-M (link)

  • wso2am-analytics-worker:3.0.0-centos7 is image for API-M Analytics Worker (link)

  • wso2am-analytics-dashboard:3.0.0-centos7 is image for API-M Analytics Dashboard (link)

The problem is I dont know how to configure containers which run these images.

  • wso2am:3.0.0-centos7 -> container named am ( IP:172.17.0.3) ports:

    0.0.0.0:5672->5672/tcp, 0.0.0.0:7611->7611/tcp, 0.0.0.0:7711->7711/tcp, 0.0.0.0:8243->8243/tcp, 0.0.0.0:8280->8280/tcp, 0.0.0.0:9099->9099/tcp, 0.0.0.0:9443->9443/tcp, 0.0.0.0:9611->9611/tcp, 0.0.0.0:9711->9711/tcp, 0.0.0.0:9763->9763/tcp, 0.0.0.0:9999->9999/tcp, 0.0.0.0:10397->10397/tcp, 0.0.0.0:11111->11111/tcp

  • wso2am-analytics-worker:3.0.0-centos7 -> container named worker (IP:172.17.0.2). Port:

    0.0.0.0:7071->7071/tcp, 0.0.0.0:7444->7444/tcp, 0.0.0.0:7612->7612/tcp, 0.0.0.0:7712->7712/tcp, 0.0.0.0:9091->9091/tcp, 0.0.0.0:9444->9444/tcp, 0.0.0.0:9612-9613->9612-9613/tcp, 0.0.0.0:9712-9713->9712-9713/tcp

  • wso2am-analytics-dashboard:3.0.0-centos7 -> container named dashboard ( IP:172.17.0.4). Port:

    0.0.0.0:7613->7613/tcp, 0.0.0.0:7713->7713/tcp, 9613/tcp, 0.0.0.0:9643->9643/tcp, 9713/tcp

I configured [apim.analytics] section of the /wso2am-3.0.0/repository/conf/deployment.toml in container am:

[apim.analytics]
enable = true
#store_api_url = "https://localhost:7444"
#username = "$ref{super_admin.username}"
#password = "$ref{super_admin.password}"
#event_publisher_type = "default"
#event_publisher_impl = "org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher"
#publish_response_size = true

... and auth.configs section of /wso2am-analytics-3.0.0/conf/dashboard/deployment.yaml in container dashboard:

auth.configs:
  type: apim
  ssoEnabled: true
  properties:
    adminScope: apim_analytics:admin_carbon.super
    allScopes: apim_analytics:admin apim_analytics:product_manager apim_analytics:api_developer apim_analytics:app_developer apim_analytics:devops_engineer apim_analytics:analytics_viewer apim_analytics:everyone openid apim:api_view apim:subscribe
    adminServiceBaseUrl: https://172.17.0.3:9443
    adminUsername: admin
    adminPassword: admin
    kmDcrUrl: https://172.17.0.3:9443/client-registration/v0.15/register
    kmTokenUrlForRedirection: https://172.17.0.3:9443/oauth2
    kmTokenUrl: https://172.17.0.3:9443/oauth2
    kmUsername: admin
    kmPassword: admin
    portalAppContext: analytics-dashboard
    businessRulesAppContext : business-rules
    cacheTimeout: 900
    baseUrl: https://localhost:9643
    grantType: authorization_code
    publisherUrl: https://172.17.0.3:9443
    #storeUrl: https://172.17.0.3:9443

So after I configured and restared these containers, the error shows in container am is:

[2020-01-14 04:16:39,026]  WARN - DataEndpointGroup No receiver is reachable at reconnection, will try to reconnect every 30 sec
[2020-01-14 04:16:39,030] ERROR - DataEndpointConnectionWorker Error while trying to connect to the endpoint. Cannot borrow client for ssl://localhost:7712
org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException: Cannot borrow client for ssl://localhost:7712
        at org.wso2.carbon.databridge.agent.endpoint.DataEndpointConnectionWorker.connect(DataEndpointConnectionWorker.java:147) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.wso2.carbon.databridge.agent.endpoint.DataEndpointConnectionWorker.run(DataEndpointConnectionWorker.java:59) [org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: org.wso2.carbon.databridge.agent.exception.DataEndpointSecurityException: Error while trying to connect to ssl://localhost:7712
        at org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftSecureClientPoolFactory.createClient(ThriftSecureClientPoolFactory.java:81) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.wso2.carbon.databridge.agent.client.AbstractClientPoolFactory.makeObject(AbstractClientPoolFactory.java:39) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212) ~[commons-pool_1.5.6.wso2v1.jar:?]
        at org.wso2.carbon.databridge.agent.endpoint.DataEndpointConnectionWorker.connect(DataEndpointConnectionWorker.java:137) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        ... 6 more
Caused by: org.apache.thrift.transport.TTransportException: Could not connect to localhost on port 7712
        at org.apache.thrift.transport.TSSLTransportFactory.createClient(TSSLTransportFactory.java:273) ~[libthrift_0.12.0.wso2v1.jar:?]
        at org.apache.thrift.transport.TSSLTransportFactory.getClientSocket(TSSLTransportFactory.java:173) ~[libthrift_0.12.0.wso2v1.jar:?]
        at org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftSecureClientPoolFactory.createClient(ThriftSecureClientPoolFactory.java:64) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.wso2.carbon.databridge.agent.client.AbstractClientPoolFactory.makeObject(AbstractClientPoolFactory.java:39) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212) ~[commons-pool_1.5.6.wso2v1.jar:?]
        at org.wso2.carbon.databridge.agent.endpoint.DataEndpointConnectionWorker.connect(DataEndpointConnectionWorker.java:137) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        ... 6 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_222]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_222]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_222]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_222]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_222]
        at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_222]
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666) ~[?:1.8.0_222]
        at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:426) ~[?:1.8.0_222]
        at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) ~[?:1.8.0_222]
        at org.apache.thrift.transport.TSSLTransportFactory.createClient(TSSLTransportFactory.java:269) ~[libthrift_0.12.0.wso2v1.jar:?]
        at org.apache.thrift.transport.TSSLTransportFactory.getClientSocket(TSSLTransportFactory.java:173) ~[libthrift_0.12.0.wso2v1.jar:?]
        at org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftSecureClientPoolFactory.createClient(ThriftSecureClientPoolFactory.java:64) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.wso2.carbon.databridge.agent.client.AbstractClientPoolFactory.makeObject(AbstractClientPoolFactory.java:39) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212) ~[commons-pool_1.5.6.wso2v1.jar:?]
        at org.wso2.carbon.databridge.agent.endpoint.DataEndpointConnectionWorker.connect(DataEndpointConnectionWorker.java:137) ~[org.wso2.carbon.databridge.agent_5.2.12.jar:?]
        ... 6 more

... and the error shows in container dashboard when I go to this link https://localhost:9643/analytics-dashboard ( it redirects to https://localhost:9643/analytics-dashboard/login?referrer=%2F):

[2020-01-14 03:24:42,837]  INFO {org.apache.axis2.transport.http.HTTPSender} - Unable to sendViaPost to url[https://172.17.0.3:9443/services/AuthenticationAdmin] javax.net.ssl.SSLException: hostname in certificate didn't match: <172.17.0.3> != <localhost> OR <localhost>
        at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:435)
        at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:304)
        at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:277)
        at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:186)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:712)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:223)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:82)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:459)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.wso2.carbon.authenticator.stub.AuthenticationAdminStub.login(AuthenticationAdminStub.java:1343)
        at org.wso2.analytics.apim.idp.client.LoginAdminServiceClient.authenticate(LoginAdminServiceClient.java:48)
        at org.wso2.analytics.apim.idp.client.ApimIdPClient.init(ApimIdPClient.java:140)
        at org.wso2.analytics.apim.idp.client.ApimIdPClient.login(ApimIdPClient.java:350)
        at org.wso2.carbon.analytics.auth.rest.api.impl.LoginApiServiceImpl.loginAppNamePost(LoginApiServiceImpl.java:146)
        at org.wso2.carbon.analytics.auth.rest.api.LoginApi.loginAppNamePost(LoginApi.java:82)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.wso2.msf4j.internal.router.HttpMethodInfo.invokeResource(HttpMethodInfo.java:187)
        at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:143)
        at org.wso2.msf4j.internal.MSF4JHttpConnectorListener.dispatchMethod(MSF4JHttpConnectorListener.java:218)
        at org.wso2.msf4j.internal.MSF4JHttpConnectorListener.lambda$onMessage$57(MSF4JHttpConnectorListener.java:129)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

[2020-01-14 03:24:42,865] ERROR {org.wso2.analytics.apim.idp.client.ApimIdPClient} - Error occurred while creating Login admin Service Client.

I followed this tutorial link: https://apim.docs.wso2.com/en/latest/Learn/Analytics/configuring-apim-analytics/. But it seems too hard to understand and what all steps I need to do if I rung these products in Docker.

So, I need some references, or something show all files I need to configure ( deployment.tolm, deployment.yaml or api-manager.xml, ... I dont know the significance of each file).

Thank you very much.

2
can anyone confirm the solution of this issueVivek

2 Answers

1
votes

Seems there is a connection issue to the analytics node from the AM container. That's why it shows this exception.

[2020-01-14 04:16:39,030] ERROR - DataEndpointConnectionWorker Error while trying to connect to the endpoint. Cannot borrow client for ssl://localhost:7712

For that, you need to configure correct analytics URLs in the repository/conf/deployment.toml as below.

[[apim.analytics.url_group]]
analytics_url =["tcp://172.17.0.2:7612"]
analytics_auth_url =["ssl://172.17.0.2:7712"]
type = "loadbalance"

Dashboard container you face certificate issue and hostname verification issue when dashboard tries to connect to the APIM. This is due to the hostname of the target URL and certificate CN is mismatched. For that please generate new certificates for you deployment and installed them in AM/Analytics keystores and trustores[1].

[1]https://apim.docs.wso2.com/en/latest/Learn/Analytics/configuring-apim-analytics/#step-6-configure-keystores

0
votes