AnsweredAssumed Answered

getID CompanyHome NodeRef by GET

Question asked by geyson_santana on Sep 25, 2013
Latest reply on Dec 2, 2013 by geyson_santana
Hello,

I want GetId of company_home nodeRef, but, i get this error:

{
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "08250012 Wrapped Exception (with status template): No NodeLocator is registered with name: company_home", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 08250012 Wrapped Exception (with status template): No NodeLocator is registered with name: company_home",
 
  "callstack" :
  [
       ""      ,"java.lang.IllegalArgumentException: No NodeLocator is registered with name: company_home"
      ,"org.alfresco.repo.nodelocator.NodeLocatorServiceImpl.getNode(NodeLocatorServiceImpl.java:56)"
      ,"org.alfresco.repo.web.scripts.nodelocator.NodeLocatorGet.executeImpl(NodeLocatorGet.java:75)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:235)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:426)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:433)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:495)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:533)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:349)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:722)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)"
      ,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)"
      ,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)"
      ,"org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)"
      ,"org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)"
      ,"org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)"
      ,"org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)"
      ,"java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)"
      ,"java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)"
      ,"java.lang.Thread.run(Thread.java:722)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 08250012 Wrapped Exception (with status template): No NodeLocator is registered with name: company_home"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)"

  ],
 
  "server" : "Community v4.2.0 (4576) schema 6,022",
  "time" : "Sep 25, 2013 12:10:44 PM"
}

java.lang.NullPointerException


My Code is:

private String obterCompanyHome(String authTicket) throws IOException {
            String urlString = "http://127.0.0.1:8080/alfresco/service/api/nodelocator/company_home?alf_ticket=" + authTicket;

            HttpClient client = new HttpClient();
            GetMethod mGet = new GetMethod(urlString);

            int status = client.executeMethod(mGet);
            System.out.println("client.execute: " + status + "\r\n" + mGet.getResponseBodyAsString());

            StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
            ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home");

            try {
                if (rs.length() == 0) {
                    throw new AlfrescoRuntimeException("Didn't find Company Home");
                }
                companyHomeNodeRef = rs.getNodeRef(0);
            } finally {
                rs.close();
            }
            return companyHomeNodeRef.getId().toString();
        }

Someone, can help me? Thanks!

Outcomes