WSO2 GReg 5.1.0 - 使用带有API的查询搜索不起作用

时间:2016-01-26 08:49:36

标签: java wso2carbon

我尝试使用 GovernanceUtils 类并按照文档'Searching using a Query'的建议调用方法findGovernanceArtifacts(String query, Registry registry, String mediaType)来搜索治理工件。

当我这样做时,我将获得具有以下堆栈跟踪的NullPointerException。 如果我在 GovernanceArtifactManager GenericArtifactManager 上使用任何其他提议的方法调用,也会发生同样的情况。

java.lang.NullPointerException
    at org.wso2.carbon.user.core.authorization.AuthorizationKey.checkAttributesAreEqual(AuthorizationKey.java:117)
    at org.wso2.carbon.user.core.authorization.AuthorizationKey.equals(AuthorizationKey.java:62)
    at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:1023)
    at org.wso2.carbon.caching.impl.CacheImpl.containsKey(CacheImpl.java:256)
    at org.wso2.carbon.user.core.authorization.AuthorizationCache.isUserAuthorized(AuthorizationCache.java:150)
    at org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager.isUserAuthorized(JDBCAuthorizationManager.java:160)
    at org.wso2.carbon.registry.core.jdbc.realm.RegistryAuthorizationManager.isUserAuthorized(RegistryAuthorizationManager.java:195)
    at org.wso2.carbon.registry.indexing.service.ContentBasedSearchService.isAuthorized(ContentBasedSearchService.java:297)
    at org.wso2.carbon.registry.indexing.service.ContentBasedSearchService.searchContentInternal(ContentBasedSearchService.java:257)
    at org.wso2.carbon.registry.indexing.service.ContentBasedSearchService.searchByAttribute(ContentBasedSearchService.java:279)
    at org.wso2.carbon.registry.indexing.internal.IndexingServiceComponent$AttributeSearchServiceImpl.search(IndexingServiceComponent.java:164)
    at org.wso2.carbon.registry.indexing.internal.IndexingServiceComponent$AttributeSearchServiceImpl.search(IndexingServiceComponent.java:158)

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您是否首先加载了治理工件?

GovernanceUtils.loadGovernanceArtifacts((UserRegistry)gov);

请在此处查看示例实施https://github.com/wso2/product-greg/blob/master/modules/samples/ws-client/src/org/wso2/carbon/registry/ws/client/sample/SampleWSRegistrySearchClient.java