AnsweredAssumed Answered

Access Alfresco Repository using JCR and Spring APIs

Question asked by rishidx on Apr 8, 2013
Latest reply on Apr 22, 2013 by rishidx
Hi All,

I am new to Alfresco and only want to connect to Alfresco Repository. I am following this link:
http://wiki.alfresco.com/wiki/Introducing_the_Alfresco_Java_Content_Repository_API

I am using Eclipse Galileo for development and created a Java project on it. I have included every JAR that were available in Alfresco SDK. Initially, When I ran the code


System.out.println("Start");
ApplicationContext appctx = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
System.out.println(" ..Done");


I got error:

<em>org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [alfresco/application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [alfresco/application-context.xml] cannot be opened because it does not exist </em>

for which I added <Alfresco-Tomcat-Folder>/WEB-INF/classes in Projects's classpath in Eclipse and this error got resolved. But now, I am getting a new Error:

<em>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 testPackage.Program1.main(Program1.java:19)
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
</em>

I have also tried the same with Alfresco SDK by importing them to Eclipse Galileo but still getting the same error.
I am working to remove this error from past 3-4 days. Can any one please help me out.

Thanks
Rishi DX

Outcomes