aegif / NemakiWare

Light-weight, highly customizable CMIS server powered by NoSQL

Home Page:http://nemakiware.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetObjectByPath does not work for items

nicolas-raoul opened this issue · comments

The item /.system/groups/company-42 exists in NemakiWare, but /core/atom/bedroom/path?path=%2F.system%2Fgroups%2Fcompany-42 returns error 404:

screenshot from 2016-09-08 13-21-06

GET /core/atom/bedroom/path?path=%2F.system%2Fgroups%2Fcompany-42&filter=&includeAllowableActions=true&includeACL=false&includePolicyIds=false&includeRelationships=none&renditionFilter=cmis%3Anone HTTP/1.1
User-Agent: Apache-Chemistry-OpenCMIS/0.14.0 (Java 1.8.0_91; Linux 4.4.0-36-generic)
Authorization: Basic YWRtaW46YWRtaW4=
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

HTTP/1.1 404 Not Found
Cache-Control: private, max-age=0
Server: Apache-Chemistry-OpenCMIS/0.13.0
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 08 Sep 2016 04:00:21 GMT

190f
<html><head><title>Apache Chemistry OpenCMIS - objectNotFound error</title><style><!--H1 {font-size:24px;line-height:normal;font-weight:bold;background-color:#f0f0f0;color:#003366;border-bottom:1px solid #3c78b5;padding:2px;} BODY {font-family:Verdana,arial,sans-serif;color:black;font-size:14px;} HR {color:#3c78b5;height:1px;}--></style></head><body><h1>HTTP Status 404 - <!--exception-->objectNotFound<!--/exception--></h1><p><!--message-->[object path:/.system/groups/company-42]The specified object is not found<!--/message--></p><hr noshade='noshade'/><!--stacktrace--><pre>
org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: [object path:/.system/groups/company-42]The specified object is not found
    at jp.aegif.nemaki.cmis.aspect.impl.ExceptionServiceImpl.objectNotFound(ExceptionServiceImpl.java:315)
    at jp.aegif.nemaki.cmis.aspect.impl.ExceptionServiceImpl.objectNotFoundByPath(ExceptionServiceImpl.java:336)
    at sun.reflect.GeneratedMethodAccessor307.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
    at com.sun.proxy.$Proxy42.objectNotFoundByPath(Unknown Source)
    at jp.aegif.nemaki.cmis.service.impl.ObjectServiceImpl.getObjectByPath(ObjectServiceImpl.java:119)
    at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
    at jp.aegif.nemaki.util.spring.aspect.log.JsonLogger.aroundMethodBody(JsonLogger.java:172)
    at jp.aegif.nemaki.util.spring.aspect.log.JsonLogger.aroundMethod(JsonLogger.java:88)
    at sun.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at com.sun.proxy.$Proxy48.getObjectByPath(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
    at com.sun.proxy.$Proxy48.getObjectByPath(Unknown Source)
    at jp.aegif.nemaki.cmis.factory.CmisService.getObjectByPath(CmisService.java:577)
    at org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper.getObjectByPath(ConformanceCmisServiceWrapper.java:918)
    at org.apache.chemistry.opencmis.server.impl.atompub.ObjectService$GetObjectByPath.serve(ObjectService.java:517)
    at org.apache.chemistry.opencmis.server.shared.Dispatcher.dispatch(Dispatcher.java:92)
    at org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.dispatch(CmisAtomPubServlet.java:244)
    at org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.service(CmisAtomPubServlet.java:193)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

</pre><!--/stacktrace--><hr noshade='noshade'/></body></html>
0

Workaround:

    /**
     * Get a given group's item from NemakiWare.
     */
    private Item getGroup(String groupName) {
        // We can not use getObjectByPath because of https://github.com/aegif/NemakiWare/issues/234
        // So we use a workaround via getChildren. Less efficient but at least it works.
        Item item = null;
        Folder groupsFolder = (Folder)nemakiWareSession().getObjectByPath("/.system/groups");
        for (CmisObject group : groupsFolder.getChildren()) {
            if(groupName.equals(group.getName())) {
                item = (Item)group;
            }
        }
        return item;
    }