You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Alex Lukin <lu...@stu.cn.ua> on 2008/01/31 20:31:51 UTC

OCM: JcrMappingException Exception: Unknown mixin type ocm:discriminator

Hi, all! Hi, Christophe!

I`m trying to write simple working OCM tesbed for my  evil purposes :)
I stealed ideas and  RepositoryUtils from test suite and my setup is:

        System.out.println("registering repository ... ");
        RepositoryUtil.registerRepository(reponame, 
                "./src/conf/repository.xml", "./repository");
        Repository rep = RepositoryUtil.getRepository(reponame);
        Session ses = RepositoryUtil.login(rep, user, password);
        //registers OCM namespace
        RepositoryUtil.setupSession(ses);

I got exception about node types and I suppose it happend because I do not registered needed node types.
Could you please point me which xml file to use or which piece of code from test I can steal to get rid of exception.

Exception:

org.apache.jackrabbit.ocm.exception.JcrMappingException: Unknown mixin type ocm:discriminator for mapped class class ua.cn.al.jackrabbit.ocm.testbed.nodes.UserNode; nested 
exception is javax.jcr.nodetype.NoSuchNodeTypeException: {http://jackrabbit.apache.org/ocm}discriminator
javax.jcr.nodetype.NoSuchNodeTypeException: {http://jackrabbit.apache.org/ocm}discriminator
        at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(NodeTypeRegistry.java:1012)
        at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(NodeTypeRegistry.java:467)
        at org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.getNodeType(NodeTypeManagerImpl.java:203)
        at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:1011)
        at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:2657)
        at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:206)
        at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:146)
        at org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(ObjectContentManagerImpl.java:406)

PS. My simple testbed with dependance libs available for public on my cvs as netbeans 6 project:

cvs -d :pserver:anoncvs@stalker.stu.cn.ua:/home/cvs login
<ENTER>
cvs -d :pserver:anoncvs@stalker.stu.cn.ua:/home/cvs co jacktabbit-tests-ocm


-- 
SY, Alex Lukin
RIPE NIC HDL: LEXA1-RIPE

Re: OCM: JcrMappingException Exception: Unknown mixin type ocm:discriminator

Posted by Christophe Lombart <ch...@gmail.com>.
On Jan 31, 2008 11:31 PM, Alex Lukin <lu...@stu.cn.ua> wrote:

> Hi again, Christophe!
>
> Thanks, simple test works now after stealing  registerNodeTypes() from
> some tests.
> Well, may be it's good idea to make such system node types and namespaces
> registration automated?


I agree with you. We have to simplify this step.

Christophe

Re: OCM: JcrMappingException Exception: Unknown mixin type ocm:discriminator

Posted by Alex Lukin <lu...@stu.cn.ua>.
Hi again, Christophe!

Thanks, simple test works now after stealing  registerNodeTypes() from some tests.
Well, may be it's good idea to make such system node types and namespaces registration automated?
It is not trivial for regular user to dig it all from tests, cut, paste and register things that must just work.

> Alex,
>
> The node type "ocm:discriminator" is missing in the jcr repository. here is
> the definition :
>
>  <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>
>

-- 
SY, Alex Lukin
RIPE NIC HDL: LEXA1-RIPE

Re: OCM: JcrMappingException Exception: Unknown mixin type ocm:discriminator

Posted by Christophe Lombart <ch...@gmail.com>.
Alex,

The node type "ocm:discriminator" is missing in the jcr repository. here is
the definition :

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

It is used to store the class name for some mapping strategy. For example,
when you map an class into the node type nt:unstructured, it is necessary to
store the classname in order to instantiate the object correctly during a
retrieve. .


On Jan 31, 2008 8:31 PM, Alex Lukin <lu...@stu.cn.ua> wrote:

> Hi, all! Hi, Christophe!
>
> I`m trying to write simple working OCM tesbed for my  evil purposes :)
> I stealed ideas and  RepositoryUtils from test suite and my setup is:
>
>        System.out.println("registering repository ... ");
>        RepositoryUtil.registerRepository(reponame,
>                "./src/conf/repository.xml", "./repository");
>        Repository rep = RepositoryUtil.getRepository(reponame);
>        Session ses = RepositoryUtil.login(rep, user, password);
>        //registers OCM namespace
>        RepositoryUtil.setupSession(ses);
>
> I got exception about node types and I suppose it happend because I do not
> registered needed node types.
> Could you please point me which xml file to use or which piece of code
> from test I can steal to get rid of exception.
>
> Exception:
>
> org.apache.jackrabbit.ocm.exception.JcrMappingException: Unknown mixin
> type ocm:discriminator for mapped class class
> ua.cn.al.jackrabbit.ocm.testbed.nodes.UserNode; nested
> exception is javax.jcr.nodetype.NoSuchNodeTypeException: {
> http://jackrabbit.apache.org/ocm}discriminator<http://jackrabbit.apache.org/ocm%7Ddiscriminator>
> javax.jcr.nodetype.NoSuchNodeTypeException: {
> http://jackrabbit.apache.org/ocm}discriminator<http://jackrabbit.apache.org/ocm%7Ddiscriminator>
>        at
> org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(
> NodeTypeRegistry.java:1012)
>        at
> org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(
> NodeTypeRegistry.java:467)
>        at
> org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.getNodeType(
> NodeTypeManagerImpl.java:203)
>        at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:1011)
>        at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:2657)
>        at
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert
> (ObjectConverterImpl.java:206)
>        at
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert
> (ObjectConverterImpl.java:146)
>        at
> org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(
> ObjectContentManagerImpl.java:406)
>
> PS. My simple testbed with dependance libs available for public on my cvs
> as netbeans 6 project:
>
> cvs -d :pserver:anoncvs@stalker.stu.cn.ua:/home/cvs login
> <ENTER>
> cvs -d :pserver:anoncvs@stalker.stu.cn.ua:/home/cvs co
> jacktabbit-tests-ocm
>
>
> --
> SY, Alex Lukin
> RIPE NIC HDL: LEXA1-RIPE
>