Interesting. I'll try that. However, I don't think that will make a difference
because when I printed the entries into getApplicablePropertyDef I noticed a
difference. These are from the embedded Jackrabbit:
getApplicablePropertyDef({http://powerlender.com/ns}accessGroups, 0, false)
getApplicablePropertyDef({http://powerlender.com/ns}createUser, 0, false)
getApplicablePropertyDef({http://www.jcp.org/jcr/1.0}data, 2, false)
getApplicablePropertyDef({http://www.jcp.org/jcr/1.0}mimeType, 0, false)
getApplicablePropertyDef({http://www.jcp.org/jcr/1.0}lastModified, 5, false)
getApplicablePropertyDef({http://powerlender.com/ns}contactBy, 0, false)
getApplicablePropertyDef({http://powerlender.com/ns}contactDate, 0, false)
getApplicablePropertyDef({http://powerlender.com/ns}contactType, 3, false)
getApplicablePropertyDef({http://powerlender.com/ns}ref, 0, false)
And these are from the JCR-RMI server:
getApplicablePropertyDef({http://powerlender.com/ns}accessGroups, 1, false)
getApplicablePropertyDef({http://powerlender.com/ns}createUser, 1, false)
getApplicablePropertyDef({http://www.jcp.org/jcr/1.0}data, 2, false)
getApplicablePropertyDef({http://www.jcp.org/jcr/1.0}mimeType, 1, false)
getApplicablePropertyDef({http://www.jcp.org/jcr/1.0}lastModified, 5, false)
getApplicablePropertyDef({http://powerlender.com/ns}contactBy, 1, false)
getApplicablePropertyDef({http://powerlender.com/ns}contactDate, 1, false)
getApplicablePropertyDef({http://powerlender.com/ns}contactType, 3, false)
getApplicablePropertyDef({http://powerlender.com/ns}ref, 1, false)
Why is the type different? Should it make a difference?
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Tobias Bocanegra
Sent: Friday, February 24, 2006 8:45 AM
To: [email protected]
Subject: Re: JCR-RMI NodeType/Property problem
hi
the reference property must be set using the node directly:
contact.setProperty(JCRContact.PROP_REFERENCE, node);
regards, toby
On 2/24/06, Ashley Martens <[EMAIL PROTECTED]> wrote:
> I have an issue with JCR-RMI.
>
> I have a custom nodetype:
> <pl = 'http://powerlender.com/ns'>
> [pl:contact] > nt:base
>
> /* Properties */
> - pl:contactDate (string) = '' mandatory
> - pl:contactBy (string) = '' mandatory
> - pl:contactType (long) = '0' mandatory
> - pl:ref (reference)
>
> When I create a node of this type and assign values to the properties under
> an embedded Jackrabbit instance it works fine. However, when I run the same
> code through JCR-RMI I get an error.
>
> Code:
> Node contact = contacts.addNode("test-attachment",
> JCRContact.NT_CONTACT);
> contact.setProperty(JCRContact.PROP_CONTACT_BY, "PL");
> contact.setProperty(JCRContact.PROP_CONTACT_DATE,
> "2005-12-26");
> contact.setProperty(JCRContact.PROP_CONTACT_TYPE, 1);
> contact.setProperty(JCRContact.PROP_REFERENCE,
> node.getUUID()); <-- Error occurs here
>
> Error from JCR-RMI client.
> javax.jcr.nodetype.ConstraintViolationException: no matching property
> definition found for {http://powerlender.com/ns}ref
> at
> org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:103)
> at
> org.apache.jackrabbit.rmi.server.ServerNode.setProperty(ServerNode.java:249)
>
> Error from JCR-RMI server:
> javax.jcr.nodetype.ConstraintViolationException: no matching property
> definition found for {http://powerlender.com/ns}ref
> at
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicablePropertyDef(EffectiveNodeType.java:797)
> at
> org.apache.jackrabbit.core.NodeImpl.getApplicablePropertyDefinition(NodeImpl.java:887)
> at
> org.apache.jackrabbit.core.NodeImpl.getOrCreateProperty(NodeImpl.java:433)
> at
> org.apache.jackrabbit.core.NodeImpl.getOrCreateProperty(NodeImpl.java:403)
> at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2014)
> at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2042)
> at
> org.apache.jackrabbit.rmi.server.ServerNode.setProperty(ServerNode.java:247)
>
> When I looked in the EffectiveNodeType class I noticed that the error occurs
> when the class cannot find the property definition, but when I look in the
> custom_nodetypes.xml file in my repository the nodetype and the property
> definition look good.
>
> - <nodeType hasOrderableChildNodes="false" isMixin="false" name="pl:contact"
> primaryItemName="">
> - <supertypes>
> <supertype>nt:base</supertype>
> </supertypes>
> - <propertyDefinition autoCreated="false" mandatory="true" multiple="false"
> name="pl:contactDate" onParentVersion="COPY" protected="false"
> requiredType="String">
> - <defaultValues>
> <defaultValue />
> </defaultValues>
> </propertyDefinition>
> - <propertyDefinition autoCreated="false" mandatory="true" multiple="false"
> name="pl:contactBy" onParentVersion="COPY" protected="false"
> requiredType="String">
> - <defaultValues>
> <defaultValue />
> </defaultValues>
> </propertyDefinition>
> - <propertyDefinition autoCreated="false" mandatory="true" multiple="false"
> name="pl:contactType" onParentVersion="COPY" protected="false"
> requiredType="Long">
> - <defaultValues>
> <defaultValue>0</defaultValue>
> </defaultValues>
> </propertyDefinition>
> <propertyDefinition autoCreated="false" mandatory="false" multiple="false"
> name="pl:ref" onParentVersion="COPY" protected="false"
> requiredType="Reference" />
> </nodeType>
>
--
-----------------------------------------< [EMAIL PROTECTED] >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---