Opencmis CmisPermissionDeniedException



我安装了Alfresco 4.2.c社区版,我试图使用OpenCMIS 0.8连接到它。

下面是执行的代码:
 parameters.put(SessionParameter.USER, username);
 parameters.put(SessionParameter.PASSWORD, password);
 parameters.put(SessionParameter.ATOMPUB_URL, "http://localhost:8081/alfresco/cmisatom");
 parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
 parameters.put(SessionParameter.COMPRESSION, "true");
 this.sessionFactory = (SessionFactoryImpl) SessionFactoryImpl.newInstance();
 List<Repository> repositories = sessionFactory.getRepositories(parameters, null,   thenticationProvider, null);
repositories.get(0).createSession();

然后将会话值存储在Thread Local中。

我第一次运行我的webApplication时,所有的操作都执行得很好。但两个小时后,我得到这个错误:

ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 05120002 Wrapped Exception (with status template): Prohibido
org.springframework.extensions.webscripts.WebScriptException: 05120002 Wrapped Exception (with status template): Forbidden
at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:70)
at org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:240)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
at org.springframework.extensions.webscripts.WebScriptProcessor.executeBody(WebScriptProcessor.java:310)
at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:57)
at org.springframework.extensions.surf.render.RenderService.process(RenderService.java:599)
at org.springframework.extensions.surf.render.RenderService.renderSubComponent(RenderService.java:505)
at org.springframework.extensions.surf.render.RenderService.processComponent(RenderService.java:419)
at org.springframework.extensions.surf.render.bean.ComponentRenderer.body(ComponentRenderer.java:94)
at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
at org.springframework.extensions.surf.render.RenderService.renderComponent(RenderService.java:961)
at org.springframework.extensions.surf.render.RenderService.renderRegionComponents(RenderService.java:900)
at org.springframework.extensions.surf.render.bean.RegionRenderer.body(RegionRenderer.java:105)
at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
at org.springframework.extensions.surf.render.RenderService.renderRegion(RenderService.java:851)
at org.springframework.extensions.directives.RegionDirectiveData.render(RegionDirectiveData.java:91)
at org.springframework.extensions.surf.extensibility.impl.ExtensibilityModelImpl.merge(ExtensibilityModelImpl.java:408)
at org.springframework.extensions.surf.extensibility.impl.AbstractExtensibilityDirective.merge(AbstractExtensibilityDirective.java:169)
at org.springframework.extensions.surf.extensibility.impl.AbstractExtensibilityDirective.execute(AbstractExtensibilityDirective.java:137)
at freemarker.core.Environment.visit(Environment.java:274)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Environment.visit(Environment.java:406)
at freemarker.core.BodyInstruction.accept(BodyInstruction.java:93)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Macro$Context.runMacro(Macro.java:172)
at freemarker.core.Environment.visit(Environment.java:614)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Environment.process(Environment.java:199)
at org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:171)
at org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:438)
at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:57)
at org.springframework.extensions.surf.render.RenderService.processTemplate(RenderService.java:721)
at org.springframework.extensions.surf.render.bean.TemplateInstanceRenderer.body(TemplateInstanceRenderer.java:140)
at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
at org.springframework.extensions.surf.render.bean.PageRenderer.body(PageRenderer.java:85)
at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
at org.springframework.extensions.surf.render.RenderService.renderPage(RenderService.java:762)
at org.springframework.extensions.surf.mvc.PageView.dispatchPage(PageView.java:411)
at org.springframework.extensions.surf.mvc.PageView.renderView(PageView.java:306)
at org.springframework.extensions.surf.mvc.AbstractWebFrameworkView.renderMergedOutputModel(AbstractWebFrameworkView.java:316)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException: Forbidden
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:460)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:617)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:145)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:600)
at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)

当我重新启动我的web应用程序,所有的操作工作正常了。

根据Alfresco OpenCMIS的实现,您需要设置Alfresco ObjectFactory:

// Set the alfresco object factory
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

相关内容

  • 没有找到相关文章

最新更新