jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart" <christophe.lomb...@gmail.com>
Subject Re: OCM Annotations constraint error
Date Fri, 14 Nov 2008 09:37:32 GMT
If the namespace is well created in the repo, it is also possible to have a
mistake in the property name defined in the mixin type ocm:discriminator.

>From 1.5, the name of the property has been changed into ocm_classname. Here
is a example :

<nodeType name="ocm:discriminator" isMixin="true">
    <supertypes>
      <supertype>nt:base</supertype>
    </supertypes>
    <propertyDefinition name="ocm_classname" requiredType="String"
autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false" />
  </nodeType>

Let me know if you need more help.

Christophe


On Fri, Nov 14, 2008 at 09:39, Boni Gopalan (BioImagene) <
Boni.G@bioimagene.com> wrote:

>
> Try adding this code to the place where you are creating the session.
>
>        NamespaceRegistry nsr =
> session.getWorkspace().getNamespaceRegistry();
>
>        try {
>            String uri = nsr.getURI("ocm");
>
>            if (uri == null) {
>                nsr.registerNamespace("ocm",
> "http://jackrabbit.apache.org/ocm");
>            }
>        } catch (javax.jcr.NamespaceException e) {
>                logger.debug("\n Exception in
> JcrDataSource_registerNodeTypes:=>"+e.getMessage());
>            nsr.registerNamespace("ocm",
> "http://jackrabbit.apache.org/ocm");
>        }
>
> To me it looks like this name space registration is missing.
>
>
>
> -----Original Message-----
> From: majohnst [mailto:matt@lattaoutdoors.com]
> Sent: 14 November 2008 08:03
> To: users@jackrabbit.apache.org
> Subject: OCM Annotations constraint error
>
>
> I am trying to use the OCM annotations in my project. I have setup
> everything
> to be run through Spring 2.5. Everything works correctly, but then I
> converted my code to use OCM annotations and I am starting to have
> problems.
>
> I am using the sample POJO entities from the junit tests: HierarchyNode,
> File, Folder, Resource. When I try to create a new File node, I get an
> error
> about:
>
> javax.jcr.nodetype.ConstraintViolationException: no matching property
> definition found for {}ocm_classname
>
> I have checked and the custom_nodetypes.xml file is being loaded, but I
> don't think it is actually doing anything. I have tried editing the
> custom_nodetypes.xml to name the ocm:classname something else and I have
> even tried not loading the custom_nodetypes.xml. Everytime I get the
> same
> error about the missing ocm_classname.
>
> Has anyone seen this? I haven't been able to find anything about how to
> set
> the ocm:classname.
> --
> View this message in context:
> http://www.nabble.com/OCM-Annotations-constraint-error-tp20493710p204937
> 10.html<http://www.nabble.com/OCM-Annotations-constraint-error-tp20493710p20493710.html>
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message