AnsweredAssumed Answered

Having issue in accessing the Custom model

Question asked by mayankjoshi on Jan 30, 2007
Hi,
I am new to Alfresco world. I am having some issues:
This is what I have done till now:
1) I have created a custom model test_AspectModel.xml and testInstanceModel.xml
2) I have created a myModel-context.xml
3) Copied these files to <tomcat>/shared/classes/alresco/extension
4) This is the defination of the contxt file

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

<beans>
<import resource="classpath:alfresco/jcr-context.xml" />
    <!– Registration of new models –>   
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="JCR.DictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/test_AspectModel.xml</value>
            <value>alfresco/extension/testInstanceModel.xml</value>
            </list>
        </property>
    </bean>
         
</beans>

Now I want to access this model throug a standalone java program. Add a few nodes and then populate a Tree like structure.

This is what I am doing in my java program:
ApplicationContext context = new ClassPathXmlApplicationContext("file:/C:/projects/test/Alfrescoserver2/tomcat/shared/classes/alfresco/extension/custom-model-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
      System.out.println("After repo");
Now when  I execute this program I get the following error:

before Contexnt
12:52:08,875 ERROR [transform.magick.AbstractImageMagickContentTransformer] ImageMagickContentTransformer not available: Failed to execute command: imconvert "C:\DOCUME~1\info\LOCALS~1\Temp\Alfresco\ImageMagickContentTransformer_init_source_16272.gif"  "C:\DOCUME~1\info\LOCALS~1\Temp\Alfresco\ImageMagickContentTransformer_init_target_16273.png"
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in URL [file:/C:/projects/test/Alfrescoserver2/tomcat/shared/classes/alfresco/extension/myModel-context.xml ]: Initialization of bean failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: Could not find bootstrap model alfresco/extension/test_AspectModel.xml
org.alfresco.service.cmr.dictionary.DictionaryException: Could not find bootstrap model alfresco/extension/test_AspectModel.xml
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:91)
   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 com.test.AccessRepository.<init>(AccessRepository.java:29)
   at com.test.AccessRepository.main(AccessRepository.java:22)

Kindly Help!!!!

Outcomes