wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
841 stars 784 forks source link

org.wso2.carbon.registry.core.exceptions.RegistryException: Unable to connect to Data Source in Sharing the user stores #2472

Closed ShanikaWickramasinghe closed 6 years ago

ShanikaWickramasinghe commented 6 years ago

Suggested Labels: APIM 2.2.0 Type/Bug Priority/Highest Severity/Critical

Affected Product Version: APIM 2.1.0 Update6 pack

OS, DB, other environment details and versions:
MYSQL 5.7 jdbc connector - mysql-connector-java-5.1.34 jdk - 1.8.0_121 ubuntu 16.04

Description: Followed tutorial [1] and followed the mentioned configurations. Observed the following exception in the backend

SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. [2018-01-18 12:10:56,602] ERROR - RegistryContext Unable to get instance of the registry context org.wso2.carbon.registry.core.exceptions.RegistryException: Unable to connect to Data Source at org.wso2.carbon.registry.core.config.RegistryConfigurationProcessor.populateRegistryConfig(RegistryConfigurationProcessor.java:165) at org.wso2.carbon.registry.core.config.RegistryContext.(RegistryContext.java:462) at org.wso2.carbon.registry.core.config.RegistryContext.(RegistryContext.java:443) at org.wso2.carbon.registry.core.config.RegistryContext.getBaseInstance(RegistryContext.java:322) at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.getEmbeddedRegistryService(RegistryCoreServiceComponent.java:589) at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.buildRegistryService(RegistryCoreServiceComponent.java:522) at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.activate(RegistryCoreServiceComponent.java:126) 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.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260) at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146) at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345) at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620) at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197) at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343) at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433) at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:69) at org.wso2.carbon.user.core.internal.BundleCheckActivator.start(BundleCheckActivator.java:61) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2097) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2022) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278) at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182) at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701) at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635) at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188) at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127) at org.wso2.carbon.registry.core.config.RegistryConfigurationProcessor.populateRegistryConfig(RegistryConfigurationProcessor.java:149) ... 43 more Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Observation When i use the jdbc:mysql://apim-rdbms:3306/apimdb??useSSL=false as the URL with the parameter useSSL=false in the configurations sharing the user stores and sharing the registry space in master-datasource.xml,registry.xml,and usr-mgt.xml this issue was not observed.

Related Issues: https://wso2.org/jira/browse/APIMANAGER-4987

[1]. https://docs.wso2.com/display/AM2xx/Log+in+to+the+API+Store+using+Social+Media

bhathiya commented 6 years ago

Could you please explain "Followed tutorial [1] and followed the mentioned configurations. Observed the following exception in the backend SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification."?

ShanikaWickramasinghe commented 6 years ago

Followed tutorial [1]. In Tutorial [1] under Configure Facebook Login with Identity Server step 2 It is directing to link [2]. According to Link 2 I did the configurations mentioned under the topic sharing the user store and sharing the registry space. Mysql version that I used was MYSQL 5.7 .When I use Mysql 5.7 and define the url as below

jdbc:mysql://localhost:3306/um_db

Observed the above exception that I have mentioned. But When i use the url as below

jdbc:mysql://localhost:3306/um_db??**useSSL=false**

with the parameter useSSL=false in the configurations sharing the user stores and sharing the registry space in master-datasource.xml,registry.xml,and usr-mgt.xml this issue was not observed.

[1]. https://docs.wso2.com/display/AM2xx/Log+in+to+the+API+Store+using+Social+Media [2]. https://docs.wso2.com/display/AM2xx/Configuring+Identity+Server+as+IDP+for+SSO

dushaniw commented 6 years ago

Hi, I have tested the above use case in wso2-apim-2.5.0 beta and mysql 5.7.22 with mysql-connector-java-5.1.34 and could not reproduce. Hence closing the issue. Please reopen if it occurs again.

tgtshanika commented 6 years ago

Closing the issue as per above comment.