Проблема развертывания кластеризации WSO2 APIM 2.0 при создании токена доступа

Я развернул 2 узла диспетчера ключей, 2 узла pub-store, 1 узел диспетчера шлюза и 2 рабочих узла шлюза на одном сервере, а также развернул nginx для балансировки нагрузки. Когда я пытаюсь сгенерировать токен доступа к приложению, он сообщает об ошибке ниже:

2016-08-29 03:10:59,558 [-] [http-nio-9443-exec-5] ERROR subscription-add:jag org.jaggeryjs.scriptengine.exceptions.ScriptException: Error while obtaining the application access token for the application:DefaultApplication
2016-08-29 03:29:37,439 [-] [http-nio-9443-exec-45] ERROR AMDefaultKeyManagerImpl Error while creating tokens - sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:533)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
    at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.getNewApplicationAccessToken(AMDefaultKeyManagerImpl.java:360)
    at org.wso2.carbon.apimgt.impl.APIConsumerImpl.renewAccessToken(APIConsumerImpl.java:867)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIConsumer.renewAccessToken(UserAwareAPIConsumer.java:36)
    at org.wso2.carbon.apimgt.hostobjects.APIStoreHostObject.jsFunction_refreshToken(APIStoreHostObject.java:4120)
...
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
    ... 90 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)

и в узлах pub-store я использовал WSClient для проверки ключа и использовал

<AuthManager>
    <!-- Server URL of the Authentication service -->
    <ServerURL>https://km.devzone.com/services/</ServerURL>
    <!-- Admin username for the Authentication manager. -->
    <Username>${admin.username}</Username>
    <!-- Admin password for the Authentication manager. -->
    <Password>${admin.password}</Password>
    <!-- Indicates whether the permissions checking of the user (on the Publisher and Store) should be done
       via a remote service. The check will be done on the local server when false. -->
    <CheckPermissionsRemotely>false</CheckPermissionsRemotely>
</AuthManager>

Какова возможная проблема с конфигурацией?


person Emman Sun    schedule 29.08.2016    source источник


Ответы (1)


Это происходит, когда у вас нет сертификата менеджера ключей в хранилище доверенных сертификатов. Чтобы исправить это, экспортируйте общедоступный сертификат из файла jks узла Keymanager и импортируйте его в client-truststore.jks узла хранилища.

person Bee    schedule 29.08.2016
comment
После того, как я импортировал сертификат, он сообщает TID: [-1234] [] [2016-08-29 05:19:07,759] INFO {org.wso2.carbon.core.internal.permission.update.PermissionUpdater} — кеш разрешений обновлен для клиента -1234 {org.wso2.carbon.core.internal.permission.update.PermissionUpdater} TID: [-1234] [] [2016-08-29 05:19:19,471] ОШИБКА {JAGGERY.site.blocks.subscription .subscription-add.ajax.subscription-add:jag} — java.lang.RuntimeException: произошла ошибка при вызове конечной точки токена: код ошибки HTTP: 500 {JAGGERY.site.blocks.subscription.subscription-add.ajax.subscription-add :jag} - person Emman Sun; 29.08.2016
comment
генератор токенов доступа к моему магазину со страницы магазина: curl -k -d grant_type=password&username=Username&password=Password -H Авторизация: Basic VFVQeHFJTTlHWjNEX0wxNU9FdTFjbzNScTdFYTpxZHZqZnBzdGRtMU0yWU5lYTYxZlZTamFmTzhh api.devzone.cs.com/token . где api.devzone.cs.com — URL-адрес балансировки нагрузки рабочего узла моего шлюза. И я не могу найти подробный журнал ошибок в журналах pub-store. - person Emman Sun; 29.08.2016
comment
Я нашел журнал ошибок с рабочего узла шлюза, ему также необходимо импортировать сертификат в client-truststore.jks узла шлюза. спасибо! - person Emman Sun; 29.08.2016