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 >---

Reply via email to