AnsweredAssumed Answered

AlfrescoRuntimeException when adding a controller

Question asked by alex.lu on Aug 2, 2010
Latest reply on Aug 2, 2010 by alex.lu
Hello all,

I'm an Alfresco starter. I've been following Jeff Potts' book. Currently I'm stuck on chapter 6 creating helloworld.get.js. As soon as I create heeloworld.get.js, I receive the following error:

   Web Script Status 500 - Internal Error

The Web Script /alfresco/service/helloworld has responded with a status of 500 - Internal Error.

500 Description:    An error inside the HTTP server which prevented it from fulfilling the request.

Message:   07020095 Wrapped Exception (with status template): 07020094 Transaction must be active and synchronization is required: Thread[http-8080-4,5,main]

Exception:   org.alfresco.error.AlfrescoRuntimeException - 07020094 Transaction must be active and synchronization is required: Thread[http-8080-4,5,main]

org.alfresco.repo.transaction.AlfrescoTransactionSupport.registerSynchronizations(AlfrescoTransactionSupport.java:460)
org.alfresco.repo.transaction.AlfrescoTransactionSupport.getSynchronization(AlfrescoTransactionSupport.java:444)
org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(AlfrescoTransactionSupport.java:237)
org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.getFlushData(DirtySessionMethodInterceptor.java:214)
org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.invoke(DirtySessionMethodInterceptor.java:392)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:154)
org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy9.getNodePair(Unknown Source)
org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNodeServiceImpl.java:148)
org.alfresco.repo.node.db.DbNodeServiceImpl.getPaths(DbNodeServiceImpl.java:2057)
org.alfresco.repo.node.db.DbNodeServiceImpl.getPath(DbNodeServiceImpl.java:2041)
sun.reflect.GeneratedMethodAccessor320.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy11.getPath(Unknown Source)
sun.reflect.GeneratedMethodAccessor320.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
$Proxy12.getPath(Unknown Source)
sun.reflect.GeneratedMethodAccessor320.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:309)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:309)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:275)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:275)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy11.getPath(Unknown Source)
org.alfresco.repo.web.scripts.RepoStore.getPath(RepoStore.java:298)
org.alfresco.repo.web.scripts.RepoStore.getBaseDir(RepoStore.java:263)
org.alfresco.repo.web.scripts.RepoStore.access$000(RepoStore.java:77)
org.alfresco.repo.web.scripts.RepoStore$RepoScriptContent.getPathDescription(RepoStore.java:952)
org.alfresco.repo.web.scripts.RepositoryScriptProcessor$RepositoryScriptLocation.toString(RepositoryScriptProcessor.java:202)
org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:282)
org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:108)
org.alfresco.web.scripts.AbstractWebScript.executeScript(AbstractWebScript.java:819)
org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:90)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:335)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:439)
org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:262)
org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:306)
org.alfresco.web.scripts.servlet.WebScriptServletRuntime.executeScript(WebScriptServletRuntime.java:178)
org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:183)
org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)

Exception:   org.alfresco.web.scripts.WebScriptException - 07020095 Wrapped Exception (with status template): 07020094 Transaction must be active and synchronization is required: Thread[http-8080-4,5,main]

org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)

Server:   Alfresco Enterprise v3.2.0 (r 416) schema 3,400
Time:   02-Aug-2010 10:10:36

Diagnostics:   Inspect Web Script (helloworld.get)

Web script
<webscript> 
<shortname>Hello World</shortname>
<description>Hello world web script</description>
<url>/helloworld?name={name}</url>
<transaction>none</transaction>
</webscript>

Diagnostics
Web Script: helloworld.get
Generated from /alfresco/service/script/helloworld.get on 02-Aug-2010 10:34:10
Script Properties
Id:   helloworld.get
Short Name:   Hello World
Description:   Hello world web script
Authentication:   none
Transaction:   none
Method:   GET
URL Template:   /helloworld?name={name}
Format Style:   any
Default Format:   html
Negotiated Formats:   [undefined]
Implementation:   class org.alfresco.web.scripts.DeclarativeWebScript
Extensions:   [undefined]
Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:extensionwebscripts

File: helloworld.get.desc.xml
<webscript>
<shortname>Hello World</shortname>
<description>Hello world web script</description>
<url>/helloworld?name={name}</url>
<transaction>none</transaction>
</webscript>
File: helloworld.get.html.ftl
<p>Hello, ${args.name}!</p>
File: helloworld.get.js
Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:webscripts

[No implementation files]
Store: classpath:alfresco/extension/templates/webscripts

[No implementation files]
Store: classpath:alfresco/templates/webscripts

[No implementation files]
Store: classpath:alfresco/enterprise/webscripts

[No implementation files]
Store: classpath:alfresco/webscripts

[No implementation files]

Alfresco version: enterprise 3.2.1

I thought it was syntax error. I double checked all files required. Could anyone help, please? Thanks in advance.

Outcomes