Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Failed to transform the component?????
SE123
Hi,
I have created a component which given an external java call. The Java call actually hits a URL and get the response in XML the same response we added in doc object and doc object is saved into hashmap. The reason behind saving the doc object in HashMap is to save the unnecessary hits to that URL in regular time interval. We refresh the hashmap in every 30 min. It works fine when I hit the URL after server restart at LS runtime, or after 30 min but let's say if I hit the URL within 30min the external java call fetch the doc(i.e.) XML object from HashMap and return to component.
Hence, from component perspective it is getting document object on every hit whether it is getting from hashmap or either it is getting from that URL.
But I am getting the below error when Java returns doc object from HashMap:
Failed to render component [1266752333829]
java.lang.RuntimeException: Failed to transform the component
at com.interwoven.livesite.runtime.model.page.RuntimeComponent.transform(RuntimeComponent.java:267)
at com.interwoven.livesite.runtime.model.page.RuntimePage.getRenderedComponent(RuntimePage.java:360)
at com.interwoven.livesite.runtime.model.page.RuntimePage.transform(RuntimePage.java:289)
Caused by: org.dom4j.IllegalAddException: The node "org.dom4j.tree.DefaultElement@2cd5a3 [Element: ]" could not be added to the element "Result" because: The Node already has an existing parent of "Result"
at org.dom4j.tree.AbstractElement.addNode(AbstractElement.java:1521)
at org.dom4j.tree.AbstractElement.add(AbstractElement.java:1002)
at com.interwoven.livesite.external.ExternalCall.execute(ExternalCall.java:122)
at com.interwoven.livesite.runtime.model.component.Component.executeExternal(Component.java:391)
at com.interwoven.livesite.runtime.model.page.RuntimeComponent.transform(RuntimeComponent.java:226)
Thanks in advance
Find more posts tagged with
Comments
vpatel
More than likely you are adding an invalid node. Try logging everything: current node, source node that you are adding, target node where you adding a new node, etc. Hopefully that will throw some light on this.
SE123
Thanks for response....
The problem got solved as the Document Object passed to Component was not serialized it was using pass by reference.
AlexC
This is most commonly seen when you try to add content to a Document which is already a child of another Document. Use createCopy() or clone() methods (depending on what you are trying to add).
vpatel
Like Alex said, use createCopy, clone or some similar mechanism. What has usually worked well for me is to "detach()" and then 'add()".
AlexC
Careful with detach() when using a cached Document (such as SiteMap or similar), you may detach it in one thread and break all subsequent calls. On external results the Document is throwaway so it's fine.
vpatel
Alex: agreed. This should be fine for external DCRs.