AnsweredAssumed Answered

How to use NodeService in FilterServlet ?

Question asked by haevele on Jun 25, 2009
Hi, i have a problem with a Servlet Filter, that i am developing. The Filter is properly configured in web.xml.
The NodeService is injected by Spring. But when I try to use the NodeService inside the doFilter(…) method of my servlet,

StoreRef contentStoreRef = new StoreRef("workspace", "SpacesStore");
NodeRef rootNode = this.nodeService.getRootNode(contentStoreRef);
I get an
org.alfresco.error.AlfrescoRuntimeException: Transaction must be active and synchronization is required: Thread[http-8080-1,5,main]

I use labs3 latestStable

The Filter is configured like this in web.xml:

<filter>
      <filter-name>Test Redirect Filter</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      <init-param>
         <param-name>targetBeanName</param-name>
         <param-value>testRedirectFilter</param-value>
      </init-param>
      <init-param>
         <param-name>targetFilterLifecycle</param-name>
         <param-value>true</param-value>
      </init-param>
</filter>

Do you have any ideas, how I can call the nodeService safely inside the servlet ?

Thank you very much

Outcomes