AnsweredAssumed Answered

Connection of Alfresco Repository through JCR

Question asked by lakshya on Jan 22, 2009
Latest reply on Mar 4, 2009 by wassim
Hello,
I am trying the following code :

public class LoginAlfresco {
      public static void main(String[] args) throws Exception {
      System.out.println("Initialising Repository…");
      ApplicationContext context = new ClassPathXmlApplicationContext("classpath:/alfresco/application-context.xml");
      Repository repository = (Repository)context.getBean("JCR.Repository");
      String[] keys =repository.getDescriptorKeys();      
      Session session=repository.login(new SimpleCredentials("admin","admin".toCharArray()));
      }
}

when I try to connect to alfresco repository, I am getting the following exception :
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'JCR.Repository' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:340)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:906)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:642)
at de.tarent.momeLearnClient.JCRTest.testGettingRepository(JCRTest.java:49)
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)

I did not found either alfresco-jcr.jar or repository.jar to implement JCR API

Can anyone help me  regarding this.

Outcomes