You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sudhan <s....@gmail.com> on 2007/04/03 00:20:49 UTC

Re: nodetype.ConstraintViolationException: no matching property definition found for {}

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 <po...@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.


Re: nodetype.ConstraintViolationException: no matching property definition found for {}

Posted by Sudhan <s....@gmail.com>.
I am getting  org.apache.jackrabbit.rmi.client.ClientNodeTypeManager when i
do the suggested stuff.

But i do not know how to register my cnd file for RMI client. I had
typecasted to ClientJackrabbitNodeTypeManager but again i am getting
ClassCast Exception.

is there a way to register cnd when the ws.getNodeTypeManager() is returning
ClientNodeTypeManager ??

thanks,

Sudhan


Brian Thompson-5 wrote:
> 
> What does
> 
> session.getWorkspace().getNodeTypeManager().getClass();
> 
> show you?
> 
> That should help you pin down that ClassCastException.
> 
> 
> 
> On 4/2/07, Sudhan <s....@gmail.com> wrote:
>>
>>
>> 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
>>
>>
>>
> 
> 

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


Re: nodetype.ConstraintViolationException: no matching property definition found for {}

Posted by Brian Thompson <el...@gmail.com>.
What does

session.getWorkspace().getNodeTypeManager().getClass();

show you?

That should help you pin down that ClassCastException.



On 4/2/07, Sudhan <s....@gmail.com> wrote:
>
>
> 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
>
>
>