AnsweredAssumed Answered

pb pour enregistrer un custom model dans le Repository

Question asked by ethan on Jul 23, 2010
Latest reply on Jul 30, 2010 by ethan
Bonsoir :)

En m'inspirant des exemples fournis dans le SDK 3.3 de Alfresco, j'ai essayé d'écrire ma propre classe pour me connecter au repository et ajouter des noeuds de contenu.

Voici l'architecture de mon projet sous Eclipse :

ExportJcrToAlfresco
      – src
           –> com.test.exportJCR
                   –> XmlToJcrImporter.java

      – mds-model-context.xml

Et voici le début de ma classe :

ApplicationContext context = new ClassPathXmlApplicationContext("classpath:mds-model-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
SimpleCredentials credentials = new SimpleCredentials("admin",   "admin".toCharArray());      
session = repository.login(credentials);

Quand je teste mon application, j'ai le message d'erreur suivant :

log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'extension.dictionaryBootstrap' defined in class path resource [mds-model-context.xml]: Could not resolve parent bean definition 'dictionaryModelBootstrap'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1110)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1055)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:537)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
   at com.test.exportJCR.XmlToJcrImporter.connectToRepository(XmlToJcrImporter.java:75)
   at com.test.exportJCR.XmlToJcrImporter.importXMLToRepository(XmlToJcrImporter.java:52)
   at com.test.exportJCR.ImportJCR.main(ImportJCR.java:16)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:504)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:827)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1096)
   … 10 more

Il doit y avoir quelque chose de mal configuré mais je ne sais pas vraiment quoi  :(

Ah oui, le contenu de mon fichier mds-model-context.xml :

<?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="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/mdsModel.xml</value>
            </list>
        </property>
    </bean>        
</beans>

Merci par avance :)

Outcomes