Spring – Using Spring ContextLoaderListener in JBoss config with default wars


I'm trying to use Spring to configure a web app deployed in JBoss. I've added this to the web.xml:


However, I've based my config on the 'default' JBoss config that includes wars such as jmx-console.war, and now these fail to deploy with the error:

[ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

So how can I tell ContextLoaderListener to ignore this error, or at least bypass these particular wars, while still attempting to process my own wars?

Best Solution

You must have your application context at /WEB-INF/applicationContext.xml. As this is application-specific, it should be configured for your applications, not other applications. That is, don't map the ContextLoaderListener at an application server level.

You CAN setup an alternative location, using:


But you can't (and you must not) ignore it.

Related Question