AnsweredAssumed Answered

Can't find 'application-context.xml'

Question asked by doblek on Oct 17, 2006
Latest reply on Mar 25, 2009 by atsjzh

I have the following code inside a portlet:

ApplicationContext app_ctx = ApplicationContextHelper.getApplicationContext();

//Getting Service Registry
final ServiceRegistry reg = (ServiceRegistry) app_ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);

if (reg.isServiceProvided(ServiceRegistry.NODE_SERVICE)){
     //Create a user transaction explicitly
     TransactionService trx_srvc = reg.getTransactionService();
     TransactionWork trx_wrk = new TransactionWork(){
           public NodeRef doWork() throws Exception{
                 //Get Node Service from registry
                 NodeService node_srvc = reg.getNodeService();
                 //Authenticate as admin
                 AuthenticationService authenticationService = reg.getAuthenticationService();
                 authenticationService.authenticate("admin", "admin".toCharArray());
                 //Create store
                 StoreRef users_store = CreateStore(node_srvc, store_name);
                 //Crete folder in store
                 NodeRef folder_ref = AddFolderToStore(node_srvc, users_store, folder_name);
                 return folder_ref;
TransactionUtil.executeInUserTransaction(trx_srvc, trx_wrk);

But I think it crashes when creating the first ApplicationContext object, because I get the following error stack:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [alfresco/application-context.xml]; nested exception is class path resource [alfresco/application-context.xml] cannot be opened because it does not exist class path resource [alfresco/application-context.xml] cannot be opened because it does not exist
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
   at org.alfresco.util.ApplicationContextHelper.getApplicationContext(
   at p2.processAction(

However, I have this application-context.xml under the following directory: $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco. And also, it's referenced in Alfresco's web.xml file as value for contextConfigLocation parameter.

What am I doing wrong?

Any help would be very much appreciated.

Thanks in advance,