[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - Getting spring WebApplicationContext of another application

advaittrivedi do-not-reply at jboss.com
Fri Nov 30 02:43:27 EST 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109164#4109164

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109164



More information about the jboss-user mailing list