AnsweredAssumed Answered

NoSuchBeanDefinitionException

Question asked by nanou on Apr 11, 2008
Latest reply on Apr 16, 2008 by nanou
Hi,

I want to use a bean for jcr repository, but I get this error :

11 avr. 2008 17:37:39 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@b82368: display name [org.springframework.context.support.ClassPathXmlApplicationContext@b82368]; startup date [Fri Apr 11 17:37:39 CEST 2008]; root of context hierarchy
11 avr. 2008 17:37:39 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@b82368]: org.springframework.beans.factory.support.DefaultListableBeanFactory@14da8f4
11 avr. 2008 17:37:39 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@14da8f4: defining beans []; root of factory hierarchy
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'JCR.Repository' is defined
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:968)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
        at MyBeanImpl.<init>(MyBeanImpl.java:29)
        at Test.main(Test.java:21)

In my application, code is :

ApplicationContext context = new ClassPathXmlApplicationContext("classpath*=alfresco/myContext.xml");
this.repository = (Repository)context.getBean("JCR.Repository");

and myContext.xml (I think it's this one which is bad written) contains :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <bean id="JCR.Repository" class="org.alfresco.jcr.repository.RepositoryImpl" init-method="init">
        <property name="serviceRegistry"><ref bean="ServiceRegistry"/></property>
        <property name="importerComponent"><ref bean="importerComponent"/></property>
        <property name="defaultWorkspace"><value>SpacesStore</value></property>
    </bean>
   
    <bean id="JCR.DictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/model/jcrModel.xml</value>
            </list>
        </property>
    </bean>
   
</beans>

I've tried to replace
SpacesStore
with
myWorkspace
that I've created with alfresco web client, but it doesn't work.

Thanks in advance

Outcomes