cancel
Showing results for 
Search instead for 
Did you mean: 

Template Processor - Rollback Exception

nyronian
Champ in-the-making
Champ in-the-making
after running the following command in the template processor

               templateService.processTemplate(
                     formTemplateNodeRef.toString(),
                     model,
                     writer);

I get the following exception:

org.springframework.transaction.UnexpectedRollbackException: Transaction rolled
back because it has been marked as rollback-only
        at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.commit(AbstractPlatformTransactionManager.java:618)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.
commitTransactionAfterReturning(TransactionAspectSupport.java:307)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:117)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:210)
        at $Proxy89.processTemplate(Unknown Source)
        at com.tlhc.wc.servlet.PageProcessor.processTemplateRequest(PageProcesso
r.java:270)
        at com.tlhc.wc.servlet.PageProcessor$ProcessDownloadContentWork.doWork(P
ageProcessor.java:430)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(Au
thenticationUtil.java:260)
        at com.tlhc.wc.servlet.PageProcessor.service(PageProcessor.java:114)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)

I have searched the logs and in localhost.xxxx-xx-xx.log I get the following every time I request the page:

 SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/jsp/error.jsp]
java.lang.IllegalStateException
   at org.apache.coyote.Response.reset(Response.java:296)
   at org.apache.catalina.connector.Response.reset(Response.java:645)
   at org.apache.catalina.connector.Response.reset(Response.java:909)
   at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:356)
   at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:212)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:134)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)


I'm not sure why I am getting it.  This is a servlet I created myself as I wished to add a few things the the data model and how I look up the template from the url args before processing it.  The error started occuring when I modified the servlet to extend GuestTemplateContentServlet and tried processing the template as guest.  I was origonally forcing an "Admin" login and it worked fine.  The other point is, even with the rollback status, the template processes everything perfectly, I can't find anything wrong with the output.

I realize there probably isn't enough here to pinpoint the problem but I am looking for some technique in tracking this down.  I can't find any information on the error other than it occurred and something is marking the UserTransaction for rollback without throwing an exception.  The processing appears to be just fine except for this.

Thank you for your help.
1 REPLY 1

kevinr
Star Contributor
Star Contributor
It's probable that code in the template is accessing nodes that the Guest user does not have access to? It looks like the exception is getting wrapped by the RollBack exception - we have fixed the issue for 2.2dev so that you actually see the real exception again rather than this annoying rollback exception. It might be worth trying this with a nightly build to see if the actual exception pops out.

Thanks,

Kevin