jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudhan <s.kan...@gmail.com>
Subject Re: nodetype.ConstraintViolationException: no matching property definition found for {}
Date Mon, 02 Apr 2007 22:20:49 GMT

Hi,

I created a cnd file exactly given in
http://jackrabbit.apache.org/doc/nodetype/cnd.html

But when i follow the code :

 Session session = ...;
    JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
        session.getWorkspace().getNodeTypeManager();
    // only register the type if it does not yet exist
    if (!manager.hasNodeType("myfile")) {
        manager.registerNodeTypes(
            JackrabbitNodeTypeManager.TEXT_X_JCR_CND,
            <InputStream for reading your CND file>);
    }


I am getting ClassCastException :

java.lang.ClassCastException:
org.apache.jackrabbit.rmi.client.ClientNodeTypeManager

Am I missing something before getting JackrabbitNodeTypeManager instance.

thanks,

Sudhan


Jukka Zitting wrote:
> 
> Hi,
> 
> On 3/14/07, Lubos and Alena Pochman <pochmans@gmail.com> wrote:
>> I would be also interested in that. I would not mind doing it
>> programatically (if I know how 8-).
>> I read JSR-170 spec and jackrabbit website but could not find it,
>> probably
>> did not look hard enough 8-).
> 
> Our documentation is currently quite lacking, so in many cases you
> still need to resort to digging the list archives for the useful bits
> of information. I hope we can change that sooner rather than later,
> but for now you did exactly the right thing by asking the mailing
> list... :-)
> 
> So, the best way to create and register new node types is to first
> define them using the CND format (see
> http://jackrabbit.apache.org/doc/nodetype/cnd.html) and then use the
> custom JackrabbitNodeTypeManager API extension from the jackrabbit-api
> library to register the new types.
> 
> In this case the new node type definition could be something like this:
> 
>     [myfile] > nt:file
>     - RevisionLabel (STRING)
> 
> Once you have the CND file, you can use the JackrabbitNodeTypeManager
> API extension like this to register the node type:
> 
>     import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
> 
>     Session session = ...;
>     JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
>         session.getWorkspace().getNodeTypeManager();
>     // only register the type if it does not yet exist
>     if (!manager.hasNodeType("myfile")) {
>         manager.registerNodeTypes(
>             JackrabbitNodeTypeManager.TEXT_X_JCR_CND,
>             <InputStream for reading your CND file>);
>     }
> 
> Once you've done this, you can replace "nt:file" with "myfile" in your
> original code, and the "RevisionLabel" property will no longer cause
> trouble.
> 
> BR,
> 
> Jukka Zitting
> 
> 

-- 
View this message in context: http://www.nabble.com/nodetype.ConstraintViolationException%3A-no-matching-property-definition-found-for-%7B%7D-tf3391684.html#a9800170
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message