title: Spring inside war cannot find classpath resource in an inner jar file
body: <p>I have a project organized like this:</p>
  
  <pre><code>core
    -- /src/main/resources/company/config/spring-config.xml
  webapp
    -- /WEB-INF/applicationContext.xml
  </code></pre>
  
  <p>The webapp depends on <code>core.jar</code>, which is included correctly in <code>WEB-INF/lib</code> when I deploy.</p>
  
  <p>In <code>web.xml</code> I have:</p>
  
  <pre><code>&lt;param-value&gt;
      /WEB-INF/applicationContext.xml
  &lt;/param-value&gt;
  </code></pre>
  
  <p>And in <code>applicationContext.xml</code> I have:</p>
  
  <pre><code>&lt;import resource="classpath:/company/config/spring-config.xml" /&gt;
  </code></pre>
  
  <p>But when I run, I get this error:</p>
  
  <pre><code>2012-10-04 20:03:39,156 [localhost-startStop-1] springframework.web.context.ContextLoader ERROR: Context initialization failed
  org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/company/config/spring-config.xml]
  Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [company/config/spring-config.xml]; nested exception is java.io.FileNotFoundException: class path resource [company/config/spring-config.xml] cannot be opened because it does not exist
      at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
  ....
  Caused by: java.io.FileNotFoundException: class path resource [company/config/spring-config.xml] cannot be opened because it does not exist
      at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:142)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
  ... 36 more
  </code></pre>
  
  <p>When <code>spring-config.xml</code> is in webapp, everything works fine.</p>
  
  <p>I noticed the leading <code>/</code> is removed from some of the errors on the stack trace, and I wonder if this has anything to do with it.</p>
  
  <p>Also, I am (unfortunately) using Spring 2.5, if that matters.</p>