cancel
Showing results for 
Search instead for 
Did you mean: 

Service Registry Implementation??? Not Found in Spring

felipe
Champ in-the-making
Champ in-the-making
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.
5 REPLIES 5

felipe
Champ in-the-making
Champ in-the-making
I 've found my error, sorry!!! javascript:emoticon(':roll:')
Rolling Eyes

felipe
Champ in-the-making
Champ in-the-making
I 've found my error, sorry!!!  :roll:

seshu
Champ in-the-making
Champ in-the-making
Felipe/anyone please tell me the solution on implementing ServiceRegistry

Thanks,
Seshu

davidc
Star Contributor
Star Contributor
All of Alfresco's services & components are defined in /alfresco/application-context.xml.  There's no need to redefine the JCR.Repository bean.

seshu
Champ in-the-making
Champ in-the-making
David,

Thanks for the reply. It seems alfresco has to run in the same system to use ServiceRegistry. I have to connect to Alfresco remotely and using webservices API. Any way thanks for your reply.

Thanks,
Seshu