AnsweredAssumed Answered

How to call the node-service when my AMP starts up?

Question asked by hbf on Jan 18, 2008
Latest reply on Feb 28, 2008 by stijndereede

My AMP preloads some data (the country tags that are currently in use, to be precise). I've first implemented "lazy caching" in the sense that the data is loaded/fetched only when some code asks for it.

This does not work however, as some client code is asking for the data within an afterCommit() handler. The result is

13:29:01,257 User:admin ERROR [repo.transaction.AlfrescoTransactionSupport] After completion (committed) listener exception: 
   listener: org.myorg.module.myapp.service.MyService@c937c8
org.alfresco.error.AlfrescoRuntimeException: onCommit cache modifications are not allowed.
   at org.alfresco.repo.cache.TransactionalCache.put(
   at org.alfresco.repo.ownable.impl.OwnableServiceImpl.getOwner(
   at sun.reflect.GeneratedMethodAccessor266.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
   at $Proxy14.hasPermission(Unknown Source)

Therefore my question: What is the easiest way to run a few queries against the nodeService after AMP startup? I tried to do it from within my init-method="init" bean initialization method, but it seems no transaction is set up at this point yet.

Thanks for any hint,