cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to load classpath*:alfresco/extension/*-context.xml

diegop
Champ in-the-making
Champ in-the-making
I am starting a new project using Alfresco 3.4a (I used Alfresco 2.1 CE for last 2 years…)

So, I am trying to develope a new custom model.

I wrote my-content-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>

    <!– Registration of new models –>   
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/myContentModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/extension/messages/my-content</value>
            </list>
        </property>       
    </bean>
         
</beans>

and I put my-content-model-context.xml in <TOMCAT_HOME>\shared\classes\alfresco\extension but it doesn't work.

I read this page: http://wiki.alfresco.com/wiki/Overriding_Spring_Configuration
so i renamed my-content-model-context.xml in dev-context.xml and it works.

It all so strange…because I found this in <TOMCAT_HOME>\webapps\alfresco\WEB-INF\classes\alfresco\application-context.xml:
    
….
    <import resource="classpath*:alfresco/extension/*-context.xml"/>          <— attention for this row!!!!!
    <import resource="classpath*:alfresco/deprecated-context.xml"/>
    <import resource="classpath*:alfresco/extension/dev-context.xml" />



So I suppose that my original file <TOMCAT_HOME>\shared\classes\alfresco\extension\my-content-model-context.xml should be read at Alfresco startup….but it is not so!

So, is there some problem? Did i make some mistake?

I don't like to use one only "anomyous" dev-context.xml file to write all my custom Spring beans, for now i found this workaround: import file my-content-model-context.xml from dev-context.xml.

so this is my final dev-context.xml (for now):

<beans>

    <import resource="classpath*:alfresco/extension/my-content-model-context.xml" />

</beans>

but I think that it should be automatic lo load each *-context.xml file in extension folder…but it is not so!

thanks in advance
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
Are you using Tomcat 6.   If so have you remembered to add the shared folder to the classpath?

ssaravanan
Champ in-the-making
Champ in-the-making
Since you have mentioned that
I am starting a new project using Alfresco 3.4a (I used Alfresco 2.1 CE for last 2 years…)
I presume that you are using Tomcat6, if so follow the wiki instruction
http://wiki.alfresco.com/wiki/Install_Tomcat6

Change the value of shared.loader= to the following:
shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
under <TOMCAT_HOME>/conf/catalina.properties file

diegop
Champ in-the-making
Champ in-the-making
yep!

I use Tomcat 6

and i already added this row in catalina.properties:

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

and it (partly) works because dev-context.xml in <TOMCAT_HOME>\shared\classes\alfresco\extension is read

but if I add some *-context.xml (without include it in dev-context.xml by my workaround explained in my first post) is not read  :cry:

EDIT-> I forgot: I followed all steps described in http://wiki.alfresco.com/wiki/Install_Tomcat6