如何通过JCR API访问Alfresco存储库

时间:2013-04-22 15:26:09

标签: alfresco jcr

我正试图通过JCR API和SpringFramework访问Alfresco Repository,方法是点击此链接:http://wiki.alfresco.com/wiki/Introducing_the_Alfresco_Java_Content_Repository_API

IDE:Eclipse Galileo

System.out.println("Initialising Repository...");
    ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresc/application-context.xml");
    //ApplicationContext context = ApplicationContextHelper.getApplicationContext(); 

    Repository repository = (Repository)context.getBean("JCR.Repository");

             // display information about the repository
     System.out.println("Repository Description...");
             String  [] keys = repository.getDescriptorKeys();
             for (String   key : keys)
             {
                 String   value = repository.getDescriptor(key);
                 System.out.println(" " + key + " = " + value);
         }

并获得此异常:

 Initialising Repository...
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyValueCache' defined in class path resource [alfresco/cache-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'disableSharedCache'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${system.cache.disableImmutableSharedCaches}]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.tcs.alfresco.WikiExample.main(WikiExample.java:20)
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'disableSharedCache'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${system.cache.disableImmutableSharedCaches}]
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:467)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    ... 11 more
Caused by: java.lang.IllegalArgumentException: Invalid boolean value [${system.cache.disableImmutableSharedCaches}]
    at org.springframework.beans.propertyeditors.CustomBooleanEditor.setAsText(CustomBooleanEditor.java:124)
    at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:416)
    at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:388)
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:157)
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
    ... 17 more

我也尝试过alfresco SDK。但得到同样的错误。 http://wiki.alfresco.com/wiki/Alfresco_SDK_4.0

我的露天副本是正确的,因为我能够通过CMIS连接到存储库。请帮助。

由于 仙人

0 个答案:

没有答案