You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Thomas Lustig <th...@futuredesign.at> on 2010/08/15 14:11:55 UTC

Registering new Nodetypes - NodeTypeManagerImpl cannot be cast to JackrabbitNodeTypeManager

Hi all,

I am using Jackrabbit 2.1 and i want to add additional properties to my 
Filenodes nt:file.
For example i would like to store a Reference ID to the corresponding
Database
a new Property like "mynamespace:myreferenceID"

I thought that this would be a standard usecase in Jackrabbit to definde 
and use own nodetypes but till now i was not able to get it working.

I used this example directly from Jackrabbit site:
http://jackrabbit.apache.org/node-types.html#NodeTypes-RegisteringNodeTypes

........ snippet ....
JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
                session.getWorkspace().getNodeTypeManager();
         // Register the custom node types defined in the CND file
         manager.registerNodeTypes(new FileInputStream(cndFileName),
                JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
........

when i run this, i get the following Error:
java.lang.ClassCastException: 
org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl cannot be 
cast to org.apache.jackrabbit.api.JackrabbitNodeTypeManager

Could anyone provide me a working example for registering nodetypes 
directly on serverside? This world be really great help.

Thanking you very much in advance for supporting me

best regards
thomas


Re: Registering new Nodetypes - NodeTypeManagerImpl cannot be cast to JackrabbitNodeTypeManager

Posted by Justin Edelson <ju...@gmail.com>.
It appears you are trying to register nodetypes over DavEX. This isn't currently supported.

On Aug 15, 2010, at 8:11 AM, Thomas Lustig <th...@futuredesign.at> wrote:

> Hi all,
> 
> I am using Jackrabbit 2.1 and i want to add additional properties to my Filenodes nt:file.
> For example i would like to store a Reference ID to the corresponding
> Database
> a new Property like "mynamespace:myreferenceID"
> 
> I thought that this would be a standard usecase in Jackrabbit to definde and use own nodetypes but till now i was not able to get it working.
> 
> I used this example directly from Jackrabbit site:
> http://jackrabbit.apache.org/node-types.html#NodeTypes-RegisteringNodeTypes
> 
> ........ snippet ....
> JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
>               session.getWorkspace().getNodeTypeManager();
>        // Register the custom node types defined in the CND file
>        manager.registerNodeTypes(new FileInputStream(cndFileName),
>               JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
> ........
> 
> when i run this, i get the following Error:
> java.lang.ClassCastException: org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl cannot be cast to org.apache.jackrabbit.api.JackrabbitNodeTypeManager
> 
> Could anyone provide me a working example for registering nodetypes directly on serverside? This world be really great help.
> 
> Thanking you very much in advance for supporting me
> 
> best regards
> thomas
>