AnsweredAssumed Answered

Service Registry Implementation??? Not Found in Spring

Question asked by felipe on Mar 31, 2006
Latest reply on Jul 30, 2006 by seshu
Hi,
I've tried a simple example in order to connect to the Alfresco's Repository.

ApplicationContext context = new ClassPathXmlApplicationContext("ws/bean.xml");
// Retrieve Repository
Repository repository = (Repository)context.getBean("JCR.Repository");

I've a structure like this (package ws) with a spring config file bean.xml
//bean.xml
<bean id="JCR.Repository" class="org.alfresco.jcr.repository.RepositoryImpl" init-method="init">
  <property name="serviceRegistry">
    <ref bean="ServiceRegistry"/>
  </property>
  <property name="defaultWorkspace">
    <value>SpacesStore</value>
  </property>
</bean>

The error is :
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JCR.Repository' defined in class path resource [ws/bean.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Service Registry has not been specified.
java.lang.IllegalStateException: Service Registry has not been specified.
   at org.alfresco.jcr.repository.RepositoryImpl.init(RepositoryImpl.java:108)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1093)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1063)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:63)
   at ws.Simple.main(Simple.java:17)


The problem is: <ref bean="ServiceRegistry"/> ???
Where is the implementation of the interface(if there is one) that is referenced by this spring bean?
and if there isn't

How can I do?

Thanks for your reply.

Outcomes