2012-08-22 4 views
1
를 통해 서비스의 경로를 얻을 수

내 코드는 다음과 같다 :WSO2 거버넌스 레지스트리는 레지스트리 API를

public static void main(String[] args) throws MalformedURLException, RegistryException{ 
    System.setProperty("javax.net.ssl.trustStore", "D:/Program Files (x86)/keystores/MyCompany.jks"); 
    System.setProperty("javax.net.ssl.trustStorePassword", "4362976"); 
    System.setProperty("javax.net.ssl.trustStoreType","JKS"); 
    RemoteRegistry registry = new RemoteRegistry(new URL("https://localhost:9443/registry"), "admin", "admin"); 
    ServiceManager serviceManager = new ServiceManager(registry); 
    Service[] services = serviceManager.findServices(new ServiceFilter() { 
     public boolean matches(Service service) throws GovernanceException { 
      String attributeVal = service.getAttribute("interface_transportProtocols"); 

      return (attributeVal != null && attributeVal.equals("HTTPS")); 
     } 
    }); 


    System.out.println(services[0].isActive()); 

} 

예외가 발생

Exception in thread "main" org.wso2.carbon.governance.api.exception.GovernanceException: **A path is not associated with the artifact.** 
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifact.checkRegistryResourceAssociation(GovernanceArtifact.java:570) 
    at org.wso2.carbon.governance.api.services.dataobjects.Service.isActive(Service.java:186) 
    at org.wso2.carbon.registry.ws.client.sample.RemoteReg.main(RemoteReg.java:36) 

누구든지 도와 드릴까요? 정말 고마워.

답변

0

ServiceManager를 초기화하는 데 사용한 레지스트리 인스턴스는 관리 레지스트리의 인스턴스 여야합니다.

예 :

RemoteRegistry registry = new RemoteRegistry(new URL("https://localhost:9443/registry"), "admin", "admin"); 

Registry govRegistry = GovernanceUtils.getGovernanceUserRegistry(registry,"admin"); 

ServiceManager serviceManager = new ServiceManager(govRegistry); 
+0

들으 많은. 그 대답이다. – user1450233

관련 문제