我正在开发wso2身份的自定义用户存储管理器。我创建了一个自定义用户存储作为osgi包,并放在wso2服务器目录的dropins文件夹中。当我重新启动服务器获取" ClassNotFoundException"这是我的班级,
package com.xxx.identity.userstore.internal;
import com.xxx.identity.userstore.CustomUserStoreCoordinator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.user.api.UserStoreManager;
public class CustomUserStoreCoordinatorComponent {
private static Log log = LogFactory.getLog(CustomUserStoreCoordinatorComponent.class);
public CustomUserStoreCoordinatorComponent(){
}
public void activate(ComponentContext ctxt) {
CustomUserStoreCoordinator customUserStoreManager = new CustomUserStoreCoordinator();
ctxt.getBundleContext().registerService(UserStoreManager.class.getName(), customUserStoreManager, null);
log.info("Custom User store co-ordinator bundle activated successfully..");
}
public void deactivate(ComponentContext ctxt) {
if (log.isDebugEnabled()) {
log.info("Custom User store co-ordinator bundle successfully deactivated");
}
}
}
这是我的usr-mgt.xml
<UserManager>
<Realm>
<Configuration>
<AddAdmin>true</AddAdmin>
<AdminRole>admin</AdminRole>
<AdminUser>
<UserName>admin</UserName>
<Password>admin</Password>
</AdminUser>
<EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in this role sees the registry root -->
<Property name="isCascadeDeleteEnabled">true</Property>
<Property name="dataSource">jdbc/WSO2CarbonDB</Property>
</Configuration>
<!-- Following is the configuration for internal JDBC user store. This user store manager is based on JDBC.
In case if application needs to manage passwords externally set property
<Property name="PasswordsExternallyManaged">true</Property>.
In case if user core cache domain is needed to identify uniquely set property
<Property name="UserCoreCacheIdentifier">domain</Property>.
Furthermore properties, IsEmailUserName and DomainCalculation are readonly properties.
Note: Do not comment within UserStoreManager tags. Cause, specific tag names are used as tokens
when building configurations for products.
-->
<UserStoreManager class="com.xxx.identity.userstore.CustomUserStoreCoordinator">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.JDBCTenantManager</Property>
<Property name="ReadOnly">false</Property>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="UsernameJavaRegEx">^[\S]{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">^[\S]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="CaseInsensitiveUsername">true</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="IsBulkImportSupported">false</Property>
<Property name="PasswordDigest">SHA-256</Property>
<Property name="StoreSaltedPassword">true</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="UserNameUniqueAcrossTenants">false</Property>
<Property name="maxActive">50</Property>
<Property name="maxWait">60000</Property>
<Property name="minIdle">5</Property>
</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>
我错过了什么?
答案 0 :(得分:0)
我的OSGI捆绑包现已成功部署。这里的问题是依赖项没有与bundle一起打包,并且在没有它们的情况下部署bundle会在日志中抛出不同的错误,但是调试时只发现问题并将依赖项放在正确的文件夹中,现在一切都按预期工作。