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] Unable to retrieve all versions of an item
Date Tue, 26 Feb 2008 20:51:09 GMT
Hi Xavier,

Following the stack strace on the ObjectConverterImpl on 293 line, it is not
possible to find the mapping descriptor for the type nt:unstructured. The
mapping descriptor contains all the information on how to map a node to a
pojo (and vice versa). I don't understand why it executes this code in your
case (mapping objects into nt:unstructured). The condition on line 285
should be true. Can you check if the node type ocm:discriminator is created
and if it is apply to your node ?

br,
Christophe

On Tue, Feb 26, 2008 at 3:10 PM, Xavier Coulon <xcoulon@gmail.com> wrote:

> Hello,
>
> I want to retrieve all versions of an item given its path.
> The code I have is here to list versions and put each item version in a
> list:
>
> public List<Content> retrieveVersions(String path) {
>        List<Content> versions = new ArrayList<Content>();
>        VersionIterator versionIterator = jcrMappingTemplate.getAllVersions
> (path);
>        while (versionIterator.hasNext()) {
>            Version version = (Version) versionIterator.next();
>            LOG.info("version found : " + version.getName() + " - "
>                    + version.getPath() + " - "
>                    + version.getCreated().getTime());
>            versions.add((Content)jcrMappingTemplate.getObject(path,
> version.getName()));
>
>        }
>        return versions;
>    }
>
> And the Content class itself (pretty simple, used to store images for now)
> :
>
> @Node(jcrType="nt:unstructured",
>        jcrMixinTypes = "mix:versionable,mix:referenceable,mix:lockable")
> public class Content {
>
>    /** Node path in the CR */
>    @Field(path=true)
>    private String path;
>
>    @Field(uuid=true)
>    private String uuid;
>
>    @Field(jcrName = "test:lastModified")
>    private Calendar lastModified;
>
>    /** content title */
>    @Field(jcrName = "test:title")
>    private String title = null;
>
>    @Field(jcrName = "test:mimeType")
>    private String mimeType;
>
>    @Field(jcrName = "test:data")
>    private byte[] data;
>
>    ... getters + setters....
> }
>
>
>
> When I run the code in a JUnit test, I get the following stacktrace :
>
> org.springmodules.jcr.JcrSystemException: Repository access exception;
> nested exception is
> org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException:
> Node
> type: nt:unstructured has no descriptor.
>    at
>
> org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate.convertMappingAccessException
> (JcrMappingTemplate.java:289)
>    at org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate$1.doInJcr(
> JcrMappingTemplate.java:170)
>    at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:76)
>    at org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate.execute(
> JcrMappingTemplate.java:163)
>    at org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate.getObject(
> JcrMappingTemplate.java:225)
>    at sample.service.impl.ContentServiceImpl.retrieveVersions(
> ContentServiceImpl.java:105)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
> AopUtils.java:301)
>    at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint
> (ReflectiveMethodInvocation.java:182)
>    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (
> ReflectiveMethodInvocation.java:149)
>    at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
> TransactionInterceptor.java:106)
>    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (
> ReflectiveMethodInvocation.java:171)
>    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
> JdkDynamicAopProxy.java:204)
>    at $Proxy16.retrieveVersions(Unknown Source)
>    at sample.service.ContentServiceTestCase.testGetAllVersions(
> ContentServiceTestCase.java:188)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at org.springframework.test.context.junit4.SpringTestMethod.invoke(
> SpringTestMethod.java:198)
>    at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(
> SpringMethodRoadie.java:274)
>    at org.springframework.test.context.junit4.SpringMethodRoadie$2.run(
> SpringMethodRoadie.java:207)
>    at
>
> org.springframework.test.context.junit4.SpringMethodRoadie.runBeforesThenTestThenAfters
> (SpringMethodRoadie.java:254)
>    at
>
> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions
> (SpringMethodRoadie.java:234)
>    at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(
> SpringMethodRoadie.java:204)
>    at org.springframework.test.context.junit4.SpringMethodRoadie.run(
> SpringMethodRoadie.java:146)
>    at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod
> (SpringJUnit4ClassRunner.java:151)
>    at org.junit.internal.runners.JUnit4ClassRunner.runMethods(
> JUnit4ClassRunner.java:51)
>    at org.junit.internal.runners.JUnit4ClassRunner$1.run(
> JUnit4ClassRunner.java:44)
>    at org.junit.internal.runners.ClassRoadie.runUnprotected(
> ClassRoadie.java:27)
>    at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java
> :37)
>    at org.junit.internal.runners.JUnit4ClassRunner.run(
> JUnit4ClassRunner.java:42)
>    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(
> JUnit4TestReference.java:38)
>    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(
> TestExecution.java:38)
>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:460)
>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:673)
>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
> RemoteTestRunner.java:386)
>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
> RemoteTestRunner.java:196)
> Caused by:
> org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException:
> Node
> type: nt:unstructured has no descriptor.
>    at
>
> org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl.getClassDescriptorByNodeType
> (AbstractMapperImpl.java:188)
>    at
>
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.getObject
> (ObjectConverterImpl.java:293)
>    at
> org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.getObject(
> ObjectContentManagerImpl.java:313)
>    at
> org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate$6.doInJcrMapping(
> JcrMappingTemplate.java:228)
>    at org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate$1.doInJcr(
> JcrMappingTemplate.java:168)
>    ... 39 more
>
> What is the descriptor I need to add ?
>
> Thank you in advance
> Xavier
>

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