cancel
Showing results for 
Search instead for 
Did you mean: 

v4. Share doesn't work properly with custom content types

alhol
Champ in-the-making
Champ in-the-making
Hello! I'am new to this forum and Alfresco at all, so pls excuse me if something's wrong.
I have a custom model that worked fine in Alfresco 3.4. I've configured both Explorer and Share so that I could create content of my own custom types, modify it etc.
Now I have Alfresco 4.0.d server and it's necessary do the same with it. I've read a lots of docs, wiki, forums and http://ecmarchitect.com/archives/2012/01/09/1509 and done all the things described there. Now, Alfresco Explorer works perfectly (so I can make a conlcusion that my model is fine), but I have troubles with share. "Create content" menu shows all my types (share-documentlibrary-config.xml is configured appropriately). Plus, appearing (when I click on some type) form shows all my custom properties and assocs. But, when i click on "create" the message is displaing:
The item cannot be found. Either it has been removed or it has never existed.
Next, when I'm trying to get into the folder where I just tried to create content item, there are red strip on the top with message:
No items.
At the same time I can see created item in alfresco Explorer. Here is the log:
ERROR [extensions.webscripts.AbstractRuntime] [http-8080-4] Exception from executeScript - redirecting to status template error: 01080003 Wrapped Exception (with status template): 01080010 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js': null
org.springframework.extensions.webscripts.WebScriptException: 01080003 Wrapped Exception (with status template): 01080010 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js': null
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.scripts.ScriptException: 01080010 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js': null
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:195)
   at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1193)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   … 25 more
Caused by: java.lang.NullPointerException
   at org.alfresco.repo.jscript.ScriptNode.createThumbnail(ScriptNode.java:2736)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
   at org.mozilla.javascript.gen.c8._c15(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js:1001)
   at org.mozilla.javascript.gen.c8.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js)
   at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
   at org.mozilla.javascript.gen.c8._c0(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js:1074)
   at org.mozilla.javascript.gen.c8.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c8.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js)
   at org.mozilla.javascript.gen.c8.exec(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
   … 30 more
My types are added to share-documentlibrary-config.xml as they are in share-config-custom.xml. Am I need to do something else? I can provide all configs on demand. I dont need localization or i18n at this time. Any help will be appreciated. Thanks.
13 REPLIES 13

jpotts
World-Class Innovator
World-Class Innovator
My first question is why did you have to edit share-documentlibrary-config.xml? Is there something you wanted to change that couldn't be done through share-config-custom.xml?

Regarding your problem, though, I wonder if it is permissions related? The stack trace makes me think there is a problem when the thumbnail is being created. I have seen reports of people have a problem where thumbnails get created by one user and then when someone else logs in, they don't have access to the thumbnail node.

If you log in as admin, create a brand new test site, a new folder, and a new instance of cm:content, do you have this problem?

Jeff

alhol
Champ in-the-making
Champ in-the-making
Thanks for question, i've just add <create-content> block, i didn't consider that i can do it in share-config-custom.xml, now it's all properly, lets imagine i didn't modify share-documentlibrary-config.xml.
Next, about permissions. They are not related. I am allways logged in as admin.

Let me describe the situation as I see it. I've made some more researches, read your article "Grasping Thumbnails in Alfresco 3" and made a conclusion: The reason is my custom types have no property cm:content. That's why when I create a node of my type, thumbnail Service cant create a proper thumbnail of it. Maybe it is so because created node doesn't have any content and service cant get it's mime type. (I can often see that my nodes have failedThumbnail aspect or don't have any aspects alike at all). Then, when rendering scripts are called node.createThumbnail throws Null Reference exception by the same reason.

Am I right? If it's so, how can i solve this problem? Should i add a cm:content property to all my types? My conceptual model will suffer from it.

jpotts
World-Class Innovator
World-Class Innovator
Does your custom content type extend from cm:content or a descendent of cm:content?

Jeff

alhol
Champ in-the-making
Champ in-the-making
It's a descendent. Though to tell the truth, I don't know how it can be extension. It has <parent>cm:content</parent> tag.

jpotts
World-Class Innovator
World-Class Innovator
If your type inherits from cm:content, then it has a content property. Types inherit their property definitions from parent types. So that is unlikely to be the cause of your problem.

Make sure you've done a hard cache clear in your browser. You don't want to inadvertently be using old client-side JavaScript libraries.

If that doesn't clear it up, I think you need to turn on the Rhino debugger by editing $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/log4j.properties and setting:
log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=on

Then, set a breakpoint in doclist.get.js and see if you can tell exactly what is null.

Jeff

alhol
Champ in-the-making
Champ in-the-making
I thought so too, but Node Browser shows the different information. Here is review of cm:content node:

[img]http://i44.tinypic.com/r8ftap.png[/img]

and here is node of my type :

[img]http://i39.tinypic.com/izaid2.png[/img]

As you can see the first one has property cm:content and the other one doesn't, despite it inherits cm:content type. What does it mean? Is this fault of Node Browser?

Next, about debugging. I can't say what exactly is null, because it seems as exception is generated inside createThumbnail. When I'm reaching invocation of this function:

[img]http://i41.tinypic.com/35n3upe.png[/img]

and trying to step into, exception is thrown:

[img]http://i42.tinypic.com/2jbmnlt.png[/img]

jpotts
World-Class Innovator
World-Class Innovator
Either your type doesn't inherit from cm:content, or you have created the object but haven't set it with any content. For example, if I use CMIS to create a new instance of cm:content without setting any content at all, the cm:content property will not show up in the node browser.

As for debugging, you should set up a remote debugger, like Eclipse, so that you can step into Alfresco's Java source. The createThumbnail method, like every other Alfresco object in JavaScript, ultimately calls Java code.

Jeff

alhol
Champ in-the-making
Champ in-the-making
Exactly! The point is I do not need to set my object with any content! I want it to be just an entity with a set of properties. If I configure share-config-custom.xml to show field cm:content and don't fill it when  object is created, it all works fine. It would be very good just to hide this field. But when I add <hide id="cm:content" /> it works as if I did nothing. Anyway, thank you very much for provided information.

Another one question. After surfing this forum and doing a lots of work, i've finally set up eclipse for remote debugging. As I understand now, to debug Java code createThumbnail invokes, I have to download alfresco sources. Am I Right?

jpotts
World-Class Innovator
World-Class Innovator
Regarding setting up debugging, you can either download the full source tree or just download the SDK. The SDK includes ZIP files of the source. There is a ZIP for each of the Alfresco JARs in the SDK. So once you import the Eclipse projects from the SDK you can then associate the source with each of the Alfresco JARs by pointing to the ZIPs in the $SDK_HOME/src directory.

Jeff