AnsweredAssumed Answered

Error searching a node from a BaseDialogBean implementantion

Question asked by lucagia on Apr 6, 2010
Latest reply on Apr 22, 2010 by derek
Hi people, I'm developing an amp, that has some action-executer and a class that extends BaseDialogBean, called SubsConsDialog. Both action-executer and SubsConsDialog call a static method for searching a file inside a subfolder of Company Home.

         
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
         ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home");
         NodeRef companyHomeNodeRef = null;
         try {
             if (rs.length() == 0)
                throw new AlfrescoRuntimeException("Didn't find Company Home");
            
             companyHomeNodeRef = rs.getNodeRef(0);
         } finally {
            if(rs!=null)
               rs.close();
         }
         if(fileFolderService == null || companyHomeNodeRef == null ) { System.out.println("FFS è null!"); return; }
         /* Create & Retrieve TsrStore & CertStore NodeRef*/
         NodeRef tsrStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.TsrStoreFolder"));
         if(tsrStore!=null && fileFolderService.getFileInfo(tsrStore).isFolder()) {
            tsrStoreNodeRef = tsrStore; // certStore folder already exists
         } else {
            FileInfo fi = fileFolderService.create(companyHomeNodeRef, Messages.getString("ExtStrings.TsrStoreFolder"), ContentModel.TYPE_FOLDER);   
            tsrStoreNodeRef = fi.getNodeRef();
         }
         
         /* Create & Retrieve CerStore NodeRef*/
         NodeRef certStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.CertStoreFolder"));
         if(certStore!=null && fileFolderService.getFileInfo(certStore).isFolder()) {
            certStoreNodeRef = certStore; // certStore folder already exists
         } else {
            FileInfo fi = fileFolderService.create(companyHomeNodeRef, Messages.getString("ExtStrings.CertStoreFolder"), ContentModel.TYPE_FOLDER);   
            certStoreNodeRef = fi.getNodeRef();
         }

At this line:
NodeRef tsrStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.TsrStoreFolder"));

it raises this exception
org.alfresco.error.AlfrescoRuntimeException: 03060002 Transaction must be active
and synchronization is required: Thread[http-8080-1,5,main]
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.registerSync
hronizations(AlfrescoTransactionSupport.java:460)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getSynchroni
zation(AlfrescoTransactionSupport.java:444)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(
AlfrescoTransactionSupport.java:237)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.getF
lushData(DirtySessionMethodInterceptor.java:214)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.invo
ke(DirtySessionMethodInterceptor.java:392)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceIntercept
or.invokeInternal(SingleEntryTransactionResourceInterceptor.java:154)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceIntercept
or.invoke(SingleEntryTransactionResourceInterceptor.java:138)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy9.getNodePair(Unknown Source)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNode
ServiceImpl.java:153)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getChildByName(DbNodeServ
iceImpl.java:1700)
        at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNo
deServiceInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy11.getChildByName(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvoc
ationHandler.invoke(StoreRedirectorProxyFactory.java:221)
        at $Proxy12.getChildByName(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterce
ptor.java:306)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterce
ptor.java:306)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRe
fPropertyMethodInterceptor.java:274)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRe
fPropertyMethodInterceptor.java:274)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy11.getChildByName(Unknown Source)
        at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.searchSimple
(FileFolderServiceImpl.java:342)
        at it.ktec.e130Amp.util.CerStoreManager.init(CerStoreManager.java:86)
        at it.ktec.e130Amp.SubsConsDialog.retrieveListCerts(SubsConsDialog.java:
339)
        at it.ktec.e130Amp.SubsConsDialog.setupAction(SubsConsDialog.java:151)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java
:132)
        at javax.faces.component.UICommand.broadcast(UICommand.java:89)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:9
7)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
71)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(Invoke
ApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl
.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:110)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy191.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.jav
a:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy191.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
        at java.lang.Thread.run(Thread.java:619)

I get this error only when i execute that code from that SubsConsDialog, not when is executed by an action executer.

Thanks in advance for your help

Outcomes