0 Replies Latest reply on Nov 30, 2007 2:43 AM by Advait

    Getting spring WebApplicationContext of another application

    Advait Newbie

      I have 4.2.1.GA. I have deployed alfresco.war file. Now I am trying to get the WebApplicationContext of alfresco from another web application AlfrescoWebClient using following code:

      ServletContext alfrescoWebContext = application.getContext("/alfresco");
      System.out.println("alfrescoWebContext=================="+alfrescoWebContext);
      WebApplicationContext alfrescoSpringContext = WebApplicationContextUtils.getRequiredWebApplicationCo
      ntext(alfrescoWebContext);
      out.println(alfrescoSpringContext);
      




      But I am getting this exception:

      java.lang.IllegalStateException: Root context attribute is not of type WebApplicationContext: org.springframework.web.context.support.XmlWebApplicationContext: display name [Root WebApplicationContext]; startup date [Fri Nov 30 12:07:25 GMT+05:30 2007]; root of context hierarchy; config locations [classpath:alfresco/application-context.xml,classpath:alfresco/web-client-application-context.xml,classpath:alfresco/web-scripts-application-context.xml,classpath:web-services-application-context.xml]

      I googled (http://forum.springframework.org/archive/index.php/t-11230.html) and found out that this is due to Classloading problems. I have included same spring jar file in both alfresco.war and AlfrescoWebClient.war. These are the only 2 applications in my jboss that use spring.