jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1755) ClassCastException when registering custom node by XML file
Date Tue, 23 Sep 2008 11:58:44 GMT

    [ https://issues.apache.org/jira/browse/JCR-1755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633702#action_12633702

Jukka Zitting commented on JCR-1755:

Doesn't look like a XML library version issue to me. The failing code in DOMWalker expects
the parent of the currently processed XML node to be an element, but in your case it looks
like it's the top-level XML document.

We probably in any case need to fix that in DOMWalker, but I believe you can work around this
issue by modifying your node type definition files. If my guess is right, your XML file looks
like this:

    <nodeType ...>...</nodeType>

Try wrapping the content in a <nodeTypes/> element, like this:

        <nodeType ...>...</nodeType>

> ClassCastException when registering custom node by XML file
> -----------------------------------------------------------
>                 Key: JCR-1755
>                 URL: https://issues.apache.org/jira/browse/JCR-1755
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: core 1.4.5
>         Environment: Spring 2.5, Spring Modules 0.9, Firefox 3, Tomcat 6, Ubuntu 8.10,
MySql 5
> Repository is deployed as a shared J2EE resource (JNDI).
>            Reporter: Jakub Wozniakowski
>            Priority: Critical
> When trying to register node type from XML file using following code:
> 		JackrabbitNodeTypeManager nodeTypeManager = (JackrabbitNodeTypeManager)workspace.getNodeTypeManager();
> 		for(Resource resource : nodeDefinitions){
> 			System.out.println("** registering node:"+resource);
> 			nodeTypeManager.registerNodeTypes(resource.getInputStream(), JackrabbitNodeTypeManager.TEXT_XML);
> 		}
> we receive such surprise:
> Caused by: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
> 	at org.apache.jackrabbit.core.util.DOMWalker.iterateElements(DOMWalker.java:215)
> 	at org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader.getNodeTypeDefs(NodeTypeReader.java:121)
> 	at org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.registerNodeTypes(NodeTypeManagerImpl.java:257)
> 	at org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.registerNodeTypes(NodeTypeManagerImpl.java:499)
> 	at pl.codeservice.jcr.JcrCustomNodeRegister.registerNodes(JcrCustomNodeRegister.java:41)
> 	at pl.codeservice.jcr.JcrCustomNodeRegister.init(JcrCustomNodeRegister.java:27)
> 	...
> Registering nodes by .cnd files works fine.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message