I am running WSO2 Identity Server 5.7.0. I am deploying a new instance of it in a different environment with a different set of backing databases. In the process of the WSO2 startup, it appears the User Manager Core bundle is failing to start.
The error is:
[2019-07-10 18:30:16,596] ERROR {org.wso2.carbon.user.core.util.DatabaseUtil} - Database Error - The connection attempt failed.
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
at org.postgresql.Driver.makeConnection(Driver.java:454)
at org.postgresql.Driver.connect(Driver.java:256)
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:730)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:664)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:200)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:158)
at org.wso2.carbon.user.core.common.DefaultRealm.populateProfileAndClaimMaps(DefaultRealm.java:442)
at org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:124)
at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:264)
at org.wso2.carbon.user.core.common.DefaultRealmService.<init>(DefaultRealmService.java:102)
at org.wso2.carbon.user.core.common.DefaultRealmService.<init>(DefaultRealmService.java:115)
at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:72)
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: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.postgresql.core.PGStream.<init>(PGStream.java:70)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:91)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
... 33 more
[2019-07-10 18:30:16,599] ERROR {org.wso2.carbon.user.core.internal.Activator} - Cannot start User Manager Core bundle
org.wso2.carbon.user.core.UserStoreException: Cannot initialize the realm.
at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:274)
at org.wso2.carbon.user.core.common.DefaultRealmService.<init>(DefaultRealmService.java:102)
at org.wso2.carbon.user.core.common.DefaultRealmService.<init>(DefaultRealmService.java:115)
at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:72)
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: org.wso2.carbon.user.core.UserStoreException: Database Error - The connection attempt failed.
at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:168)
at org.wso2.carbon.user.core.common.DefaultRealm.populateProfileAndClaimMaps(DefaultRealm.java:442)
at org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:124)
at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:264)
... 19 more
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
at org.postgresql.Driver.makeConnection(Driver.java:454)
at org.postgresql.Driver.connect(Driver.java:256)
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:730)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:664)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:200)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:158)
... 22 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.postgresql.core.PGStream.<init>(PGStream.java:70)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:91)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
... 33 more
It appears that the connections to the databases are initializing successfully before this error appears, so I'm not sure what the issue is.
Here are the logs regarding the datasources:
[2019-07-10 17:48:59,688] DEBUG {org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent} - Initializing system data sources...
[2019-07-10 17:48:59,834] DEBUG {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Adding data source: WSO2_CARBON_DB
[2019-07-10 17:48:59,835] DEBUG {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Registering data source: WSO2_CARBON_DB
[2019-07-10 17:49:00,089] DEBUG {org.wso2.carbon.context.internal.CarbonContextDataHolder} - Loading JNDI Initial Context Factory: org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory
[2019-07-10 17:49:00,106] DEBUG {org.wso2.carbon.context.internal.CarbonContextDataHolder} - Unload Tenant Task: org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext$ContextCleanup
Task was registered.
[2019-07-10 17:49:00,190] DEBUG {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Adding data source: WSO2_METRICS_DB
[2019-07-10 17:49:00,191] DEBUG {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Registering data source: WSO2_METRICS_DB
[2019-07-10 17:49:00,255] DEBUG {org.wso2.carbon.context.internal.CarbonContextDataHolder} - Loading JNDI Initial Context Factory: org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory
[2019-07-10 17:49:00,323] DEBUG {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Adding data source: BPS_DS
[2019-07-10 17:49:00,324] DEBUG {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Registering data source: BPS_DS
[2019-07-10 17:49:00,385] DEBUG {org.wso2.carbon.context.internal.CarbonContextDataHolder} - Loading JNDI Initial Context Factory: org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory
[2019-07-10 17:49:00,391] DEBUG {org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent} - System data sources successfully initialized
[2019-07-10 17:49:00,392] DEBUG {org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent} - ServerConfigurationService acquired
[2019-07-10 17:49:00,393] DEBUG {org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent} - DataSourceServiceComponent activated
My question is which configurations are relevant to the step of the process that is failing. Is this an issue with the datasources connection, the LDAP connection, or something else?
Thanks for your help.
Edit:
master-datasources.xml:
<?xml version="1.0" encoding="UTF-8"?>
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>
<datasources>
<datasource>
<name>WSO2_CARBON_DB</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>${master.datasources.url}</url>
<username>${master.datasources.username}</username>
<password>password</password>
<driverClassName>org.postgresql.Driver</driverClassName>
<maxActive>80</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
<testOnBorrow>true</testOnBorrow>
<defaultAutoCommit>true</defaultAutoCommit>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>
</datasources>
</datasources-configuration>
user-mgt.xml:
<UserManager xmlns:svns="http://org.wso2.securevault/configuration">
<Realm>
<Configuration>
<AddAdmin>false</AddAdmin>
<AdminRole>admin</AdminRole>
<AdminUser>
<UserName>${user.mgt.admin.username}</UserName>
<Password>placeholder</Password>
</AdminUser>
<!-- By default users in this role sees the registry root-->
<EveryOneRoleName>everyone</EveryOneRoleName>
<Property name="isCascadeDeleteEnabled">true</Property>
<Property name="initializeNewClaimManager">false</Property>
<Property name="dataSource">jdbc/WSO2CarbonDB</Property>
</Configuration>
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
<Property name="ConnectionURL">${user.mgt.connection.url}</Property>
<Property name="ConnectionName">${user.mgt.connection.name}</Property>
<Property name="ConnectionPassword">password</Property>
<Property name="AnonymousBind">false</Property>
<Property name="UserSearchBase">${user.mgt.search.base}</Property>
<Property name="UserEntryObjectClass">customer</Property>
<Property name="UserNameAttribute">cn</Property>
<Property name="UserNameSearchFilter">(&(objectClass=top)(cn=?))</Property>
<Property name="UserNameListFilter">(objectClass=top)</Property>
<Property name="UserDNPattern"/>
<Property name="DisplayNameAttribute"/>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="GroupSearchBase">ou=Groups,dc=cse-renaissance,dc=equifax,dc=com</Property>
<Property name="GroupEntryObjectClass">groupOfNames</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="RoleDNPattern">cn={0},ou=Groups,dc=cse-renaissance,dc=equifax,dc=com</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="BackLinksEnabled">false</Property>
<Property name="UsernameJavaRegEx">[a-zA-Z0-9._\-|//]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password length should be within 5 to 30 characters</Property>
<Property name="RolenameJavaRegEx">[a-zA-Z0-9._\-|//]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="IsBulkImportSupported">false</Property>
<Property name="EmptyRolesAllowed">true</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="kdcEnabled">false</Property>
<Property name="defaultRealmName">WSO2.ORG</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ConnectionPoolingEnabled">false</Property>
<Property name="LDAPConnectionTimeout">5000</Property>
<Property name="ReadTimeout"/>
<Property name="RetryAttempts"/>
</UserStoreManager>
<AuthorizationManager class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
<Property name="AdminRoleManagementPermissions">/permission</Property>
<Property name="AuthorizationCacheEnabled">true</Property>
<Property name="GetAllRolesOfUserEnabled">false</Property>
</AuthorizationManager>
</Realm>
</UserManager>
The ${user.mgt.connection.url} has the form ldap://DOMAIN:389.
The datasources urls are of the form jbdc:postgresql://DOMAIN:5432/master.
I have verified that I am able to make a connection to the databases and this LDAP instance from the machine this is running on, so it is not a firewall issue.
I have also been able to start up WSO2 with this configuration with a different LDAP and set of databases.
I'm looking for more clarification about which database/LDAP instance that WSO2 is trying to connect to during the realm initialization, so that I can identify which part of the config the issue is with.
Have a look "dataSource" property in user-mgt.xml and you will find JNDI name of the relevant data source search for the same name in master-datasource.xml there you will get corresponding DB connection parameters. You can verify connection by using some external database client. Either LDAP or JDBC you need to have healthy database connection. If you can attache user-mgt.xml and master-datasource.xml after removing sensitive data like DB password exact problem can be tracked.
Related
I'm following the wso2 gmail connector tutorial here but getting the error,
ERROR - MediatorFactoryFinder Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}gmail
I followed all the steps mentioned, got my gmail credentials and configured the mediators in the sequence.
What am I missing?
The xml,
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="PaymentRequestProcessingSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property description="Get Email ID" expression="json-eval($.patient.email)" name="email_id" scope="default" type="STRING"/>
<call>
<endpoint key="SettlePaymentEP"/>
</call>
<log description="LogPaymentRequestProcessingSequenceRes" level="full">
<property name="type" value="LogPaymentRequestProcessingSequenceRes"/>
<property expression="get-property("INTERNALREQUESTID")" name="internalrequestID"/>
<property expression="get-property("MessageID")" name="messageID"/>
<property expression="." name="message"/>
</log>
<property description="Get Payment Response" expression="json-eval($.)" name="payment_response" scope="default" type="STRING"/>
<gmail.init>
<userId>myEmail</userId>
<accessToken>theAccessToken</accessToken>
<apiUrl>https://www.googleapis.com/gmail</apiUrl>
<clientId>theClientId</clientId>
<clientSecret>theClientSecret</clientSecret>
<refreshToken>theRefreshToken</refreshToken>
</gmail.init>
<gmail.sendMail>
<to>{$ctx:email_id}</to>
<subject>Payment Status</subject>
<messageBody>{$ctx:payment_response}</messageBody>
</gmail.sendMail>
<drop/>
</sequence>
Stacktrace
ERROR {org.apache.synapse.deployers.LibraryArtifactDeployer} - Deployment of synapse artifact failed for synapse libray at : C:\Program Files\WSO2\Enterprise Integrator\6.4.0\tmp\carbonapps\-1234\1546859692950SampeServicesCompositeApplication_1.0.0.car\gmail-connector_3.0.7\gmail-connector-3.0.7.zip : Error while extracting Synapse Library : gmail-connector-3.0.7.zip {org.apache.synapse.deployers.LibraryArtifactDeployer}
org.apache.synapse.SynapseException: Error while extracting Synapse Library : gmail-connector-3.0.7.zip
at org.apache.synapse.libraries.util.LibDeployerUtils.extractSynapseLib(LibDeployerUtils.java:426)
at org.apache.synapse.libraries.util.LibDeployerUtils.createSynapseLibrary(LibDeployerUtils.java:65)
at org.apache.synapse.deployers.LibraryArtifactDeployer.deploy(LibraryArtifactDeployer.java:60)
at org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.deploySynapseLibrary(SynapseAppDeployer.java:355)
at org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.deployArtifacts(SynapseAppDeployer.java:101)
at org.wso2.carbon.application.deployer.internal.ApplicationManager.deployCarbonApp(ApplicationManager.java:272)
at org.wso2.carbon.application.deployer.CappAxis2Deployer.deploy(CappAxis2Deployer.java:72)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:93)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Program%20Files\WSO2\Enterprise%20Integrator\6.4.0\tmp\carbonapps\-1234\1546859692950SampeServicesCompositeApplication_1.0.0.car\gmail-connector_3.0.7\gmail-connector-3.0.7.zip (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at org.apache.synapse.libraries.util.LibDeployerUtils.extract(LibDeployerUtils.java:448)
at org.apache.synapse.libraries.util.LibDeployerUtils.extractSynapseLib(LibDeployerUtils.java:424)
... 23 more
I am totally new to WSO2. I have to create custom user store manger using wso2 api manager. While some word around I am facing an exception as,
TID: [0] [AM] [2016-01-14 16:19:57,732] INFO {org.wso2.carbon.databridge.agent.thrift.AgentHolder} - Agent created ! {org.wso2.carbon.databridge.agent.thrift.AgentHolder}
TID: [0] [AM] [2016-01-14 16:19:57,736] INFO {org.wso2.carbon.databridge.agent.thrift.internal.AgentDS} - Successfully deployed Agent Client {org.wso2.carbon.databridge.agent.thrift.internal.AgentDS}
TID: [0] [AM] [2016-01-14 16:19:59,608] ERROR {org.wso2.carbon.user.core.common.DefaultRealmService} - Cannot initialize the realm. {org.wso2.carbon.user.core.common.DefaultRealmService}
org.wso2.carbon.user.core.UserStoreException: org.wso2.sample.user.store.manager.CustomUserStoreManagerType class java.lang.ClassNotFoundException
I have updated user-mgt.xml as,
<UserStoreManager class="org.wso2.sample.user.store.manager.CustomUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.JDBCTenantManager</Property>
<Property name="ReadOnly">false</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="IsEmailUserName">false</Property>
<Property name="DomainCalculation">default</Property>
<Property name="PasswordDigest">SHA-256</Property>
<Property name="StoreSaltedPassword">true</Property>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="UserNameUniqueAcrossTenants">false</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="SharedGroupEnabled">false</Property>
<Property name="SCIMEnabled">false</Property>
</UserStoreManager>
I have also registered service as,
Public class CustomUserStoreMgtDSComponent{
private static Log log = LogFactory.getLog(CustomUserStoreMgtDSComponent.class);
private static RealmService realmService;
protected void activate(ComponentContext ctxt) {
log.info("Custome Component activated..");
CustomUserStoreManager customUserStoreManager = new CustomUserStoreManager();
ctxt.getBundleContext().registerService(UserStoreManager.class.getName(), customUserStoreManager, null);
log.info("CustomUserStoreManager bundle activated successfully..");
}
protected void deactivate(ComponentContext ctxt) {
if (log.isDebugEnabled()) {
log.debug("Custom User Store Manager is deactivated ");
}
}
protected void setRealmService(RealmService rlmService) {
realmService = rlmService;
}
protected void unsetRealmService(RealmService realmService) {
realmService = null;
}
}
I have also added sample-store.jar inside dropins folder.
Is there any reference guide/link to create custom user store manager through wso2 api manager?
Any help would be highly appreciable.
I am using wso2 esb 4.8.1.
I am trying to add the JDBCUserStoreManager Configuring as Secondary User Stores but unable to add some query related errors occurring.
my configuration is like this
<
UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
<Property name="driverName">oracle.jdbc.OracleDriver</Property>
<Property name="url">jdbc:oracle:thin:#localhost:1521:xe</Property>
<Property name="userName">fff</Property>
<Property name="password">fff</Property>
<Property name="Disabled">false</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="PasswordDigest">SHA-256</Property>
<Property name="ReadGroups">true</Property>
<Property name="ReadOnly">false</Property>
<Property name="IsEmailUserName">false</Property>
<Property name="DomainCalculation">default</Property>
<Property name="StoreSaltedPassword">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="UserNameUniqueAcrossTenants">false</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="UsernameJavaRegEx">^[\S]{5,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="RolenameJavaRegEx">^[\S]{5,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="SelectUserSQL">select fff.AUTHENTICATION.username from kkkk.AUTHENTICATION;</Property>
<Property name="GetRoleListSQL">select fff.AUTHENTICATION.username from kkkk.AUTHENTICATION;</Property>
<Property name="DomainName">TT.com</Property>
<Property name="Description"/>
</UserStoreManager>
its showing success message while adding if i restart the server its giving so many errors.
like
[2014-07-08 17:07:42,620] ERROR - JDBCUserStoreManager Using sql : select fff.AUTHENTICATION.username from fff.AUTHENTICATION;
[2014-07-08 17:07:42,624] ERROR - AbstractUserStoreManager org.wso2.carbon.user.
core.UserStoreException: Invalid column index
[2014-07-08 17:07:42,663] INFO - ServiceBusInitializer Starting ESB...
if i add this configuratin
<Property name="SelectUserSQL">select kkkk.AUTHENTICATION.username from kkkk.AUTHENTICATION;</Property>
<Property name="EmptyRolesAllowed">Allowed</Property>
<Property name="DomainName">TT.com</Property>
again its giving this error
tenant -1234
[2014-07-08 17:49:10,112] ERROR - JDBCUserStoreManager Error while retrieving ro
les from JDBC user store
java.sql.SQLException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.
java:207)
i need to add the data source for this else its work,I am unable to get the issue.
my table is like this
table name:AUTHENTICATION
columnnames: username, password,role
data:system,system,everyone
any help for this.
Thanks in advance,
The cause may be that some of the other SQL queries running are expecting the default WSO2 user store schema as you are using the default shipped JDBCUserStoreManager with a different schema. When you have the need to use a this kind of different user store structure, it is recommended to use a custom user store, which provide you more freedom on handling user store functionality according to your requirement. Following links may be of help to you. (Please note that though document is for Identity Server - 5.0.0, it's valid for ESB 4.8.1 as well.)
[1] - http://docs.wso2.com/display/IS500/Writing+a+Custom+User+Store+Manager
[2] - http://pushpalankajaya.blogspot.com/2013/09/how-to-write-custom-user-store-manager.html
I try to add a sequence which contains a java script mediator as below :
"<sequence name="response">
<script language="js">
mc.setPayloadXML(
<greeting>Hello World</greeting>
);
</script>
<header name="To" action="remove"/>
<property name="messageType" value="application/json" scope="axis2"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<property name="RESPONSE" value="true"/>
<send/>
<log level="full"/>
</sequence>"
*Howerver,it occurs a error once I press the Update Button,the whole function stack is shown in the log, I check the jar "bsf-all,3.0.0.wso2v2" and it really contains the missing class and the jar is shown in the bundles info "bsf-all,3.0.0.wso2v2,../plugins/bsf-all_3.0.0.wso2v2.jar,4,true" :*
"com/sun/phobos/script/javascript/RhinoScriptEngineFactory {org.apache.axis2.rpc.receivers.RPCMessageReceiver}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at ......
Caused by: java.lang.NoClassDefFoundError: com/sun/phobos/script/javascript/RhinoScriptEngineFactory
at org.apache.synapse.mediators.bsf.ScriptMediator.initScriptEngine(ScriptMediator.java:475)
at org.apache.synapse.mediators.bsf.ScriptMediator.initInlineScript(ScriptMediator.java:341)
at org.apache.synapse.mediators.bsf.ScriptMediator.(ScriptMediator.java:146)
at org.apache.synapse.mediators.bsf.ScriptMediatorFactory.createSpecificMediator(ScriptMediatorFactory.java:105)
at org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:91)
at org.apache.synapse.config.xml.MediatorFactoryFinder.getMediator(MediatorFactoryFinder.java:223)
at org.apache.synapse.config.xml.AbstractListMediatorFactory.addChildren(AbstractListMediatorFactory.java:41)
at org.apache.synapse.config.xml.SequenceMediatorFactory.createSpecificMediator(SequenceMediatorFactory.java:87)
at org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:91)
at org.wso2.carbon.mediation.configadmin.ConfigurationValidator.validateSequence(ConfigurationValidator.java:90)
at org.wso2.carbon.mediation.configadmin.ConfigurationValidator.validate(ConfigurationValidator.java:73)
at org.wso2.carbon.mediation.configadmin.ConfigAdmin.validateConfiguration(ConfigAdmin.java:180)
... 61 more
Caused by: java.lang.ClassNotFoundException: com.sun.phobos.script.javascript.RhinoScriptEngineFactory
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
atorg.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoa ..
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 73 more"
I look up the solution about the same issue you given to other person https://wso2.org/jira/browse/ESBJAVA-1685 but it doesn't take effect.And I search Google for the question for a long time ,someone said the error has been fixxed or it is something wrong with OSGI Frame when it sets up,but others has the same problem with me still stick in it , so please give us a complete solution about how to use script mediator in WSO2 AM 1.5,tks a lot !
There is an issue with the bsf jar which we use to provide scripting engine..As an alternative way, you can use enrich/payload factory mediator to achieve above task
I'm getting the following error when I start WSO2 Identity Server 4.1.0:
[2013-02-27 17:00:33,192] ERROR {org.wso2.carbon.identity.mgt.IdentityMgtEventListener} - Error while init identity listener
org.wso2.carbon.user.core.UserStoreException: User store is operating in read only mode. Cannot write into the user store.
at org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager.doSetUserClaimValue(ReadOnlyLDAPUserStoreManager.java:1293)
at org.wso2.carbon.user.core.common.AbstractUserStoreManager.setUserClaimValue(AbstractUserStoreManager.java:823)
at org.wso2.carbon.identity.mgt.IdentityMgtEventListener.<init>(IdentityMgtEventListener.java:68)
at org.wso2.carbon.identity.mgt.internal.IdentityMgtServiceComponent.activate(IdentityMgtServiceComponent.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
...
That means that WSO2 is trying to write in the ldap, but i've configured it to be read only:
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">
<Property name="ReadOnly">true</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="ConnectionURL">ldaps://xxxx:636</Property>
<Property name="ConnectionName">uid=xxx,ou=xx,dc=xx,dc=xx,dc=x</Property>
<Property name="ConnectionPassword">xxxxxx</Property>
<Property name="passwordHashMethod">SHA</Property>
<Property name="UserSearchBase">ou=xx,dc=x,dc=xx,dc=xx</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="ReadLDAPGroups">true</Property>
<Property name="GroupSearchBase">ou=xx,dc=xx,dc=xx,dc=xx</Property>
<Property name="GroupNameListFilter">(objectClass=posixGroup)</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">memberUid</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="maxFailedLoginAttempt">0</Property>
</UserStoreManager>
Am I missing something?
Your read-only user store should contain the 'admin' user, which is specified in the realm configuration section at the top of user-mgt.xml.
<AdminUser>
<UserName>admin</UserName>
<Password>admin</Password>
</AdminUser>
Since it could not be found, WSO2 IS is trying to write it.