Probulem JavaScript API processTemplate

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2007 03:31 AM

I could use the JavaScript API processTemplate on the Alfresco-community-tomcat-1.4.0 and 2.0.0.
Now, I have installed the Alfresco-community-tomcat-2.1.0.
The following script can not execute on Alfresco, only 2.1.0.
Input form<html><head><title>***** ex_listDocsSpace.html *****</title></head><body><form method="POST" action="http://vaio-sugai:8080/alfresco/command/script/execute" accept-charset="UTF-8" ><br>JavaScript call from HTML form<br><br><input type="text" name="scriptPath" size="100" value="/Company Home/User Homes/ex_listDocsSpace.js"><br><br><input type="text" name="spacePath" size="100" value="User Homes"><br><br><input type="text" name="templatePath" size="100" value="User Homes/ex_listDocsSpace.ftl"><br><br><input type="submit"></form></body></html>[JavaScript code]var arg = new Array();arg = args;var script = arg["scriptPath"];var spacePath = arg["spacePath"];var templatePath = arg["templatePath"];var result = "args check !" + "<br>";result += "arg[script] : " + script + "<br>";result += "arg[spacePath] : " + spacePath + "<br>";result += "arg[templatePath] : " + templatePath + "<br><br>"; // 10space = userhome;var spaceNode = space.childByNamePath(spacePath);if ( spaceNode == null) { result += "spaceNode not found !" + "<br>"; } else { result += "spaceNode.name = " + spaceNode.name + "<br>";}// Get templateNode var templateNode = space.childByNamePath(templatePath);result += "templateNodeName = " + templateNode.name + "<br>";// set spaceNode to current spacespace = spaceNode;// Execute processTemplate var outString = new String("");outString += space.processTemplate(templateNode);result += outString + "<br>"; result;[Template]<#– Renders list of all the documents in the Space –> <table> <#list space.children as child> <#if child.isDocument> <tr><td>${child.properties.name}</td></tr> </#if> </#list> </table>
- system error messages
org.alfresco.error.AlfrescoRuntimeException: Error during command servlet processing: Failed to execute script 'workspace://SpacesStore/90f0221e-5142-11dc-a12e-7f4bdf46ace9': Failed to execute script 'workspace://SpacesStore/90f0221e-5142-11dc-a12e-7f4bdf46ace9': Wrapped org.alfresco.service.cmr.repository.TemplateException (AlfrescoScript#28 )
caused by:
org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'workspace://SpacesStore/90f0221e-5142-11dc-a12e-7f4bdf46ace9': Failed to execute script 'workspace://SpacesStore/90f0221e-5142-11dc-a12e-7f4bdf46ace9': Wrapped org.alfresco.service.cmr.repository.TemplateException (AlfrescoScript#28 )
caused by:
org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'workspace://SpacesStore/90f0221e-5142-11dc-a12e-7f4bdf46ace9': Wrapped org.alfresco.service.cmr.repository.TemplateException (AlfrescoScript#28 )
caused by:
org.alfresco.error.AlfrescoRuntimeException: Wrapped org.alfresco.service.cmr.repository.TemplateException (AlfrescoScript#28 )
caused by:
org.mozilla.javascript.WrappedException: Wrapped org.alfresco.service.cmr.repository.TemplateException (AlfrescoScript#28 )
caused by:
org.alfresco.service.cmr.repository.TemplateException
caused by:
java.lang.NullPointerException
Are there any changes ?
Please advice me.
Labels:
- Labels:
-
Archive
13 REPLIES 13

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2007 04:33 AM
Suleyman
I am studying SDK, too.
I wait for the next release of Niightly build.
I hope that it is released in approximately 10 days.
regards
I am studying SDK, too.
I wait for the next release of Niightly build.
I hope that it is released in approximately 10 days.
regards

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 08:36 AM
The merge has happened today:
http://issues.alfresco.com/browse/CHK-1289
It should be in tonights nightly build.
Kevin
http://issues.alfresco.com/browse/CHK-1289
It should be in tonights nightly build.
Kevin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2007 12:14 AM
Is there a work around for this?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2007 05:33 AM
There is no workaround as it requires a code change. I have made the fixed .class file available here.
You will need to stop the server, then replace the class file org\alfresco\repo\processor\TemplateServiceImpl.class in the repository.jar file inside the alfresco.war file - then repack the jar into the war and restart the server.
Hope this helps,
Kevin
You will need to stop the server, then replace the class file org\alfresco\repo\processor\TemplateServiceImpl.class in the repository.jar file inside the alfresco.war file - then repack the jar into the war and restart the server.
Hope this helps,
Kevin
