Spring module can't access resource file from custom module

Latest response

I created a custom spring module with spring jars and module.xml:

<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
    <resources>
    <resource-root path="spring-context-2.5.5.jar"/>
        <resource-root path="xbean-spring-3.4.3.jar"/>
        <resource-root path="spring-beans-2.5.5.jar"/>
        <resource-root path="spring-aop-2.5.5.jar"/>
        <resource-root path="spring-core-2.5.5.jar"/>
    </resources>
    <dependencies>
        <module name="org.custom">
        <module name="javax.api"/>
        <module name="javax.jms.api"/>
        <module name="javax.annotation.api"/>
        <module name="org.apache.commons.logging"/>
    </dependencies>
</module>

and another custom module: org.custom, with a custom jar, and a folder config containing config/config.xml

<module xmlns="urn:jboss:module:1.1" name="org.custom">
    <resources>
       <resource-root path="config"/>
    <resource-root path="custom.jar"/>
     </resources>
    <dependencies>
        <module name="org.springframework.spring"/>
    </dependencies>
</module>

I declared both modules as global modules in standalone.xml and also as dependancies for my ear application in jboss-deployment-structure.xml:

<jboss-deployment-structure>
  <deployment>
    <dependencies>
      <module name="org.springframework.spring"/>
      <module name="org.custom" slot="main"/>
    </dependencies>
  </deployment>
</jboss-deployment-structure>

At startup my application use custom module, that use spring to load config.xml. But spring can't access custom.xml file:

Caused by: java.io.FileNotFoundException: class path resource [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)
        ... 31 more

I tried to access config.xml directly from my application using classloader, and it's ok.
I can't modify custom.jar it's a tier dependancy, it calls spring load with param 'config.xml', I can't force a path.

Why Spring can't access it?

Using Jboss EAP 6.3.0, and spring 2.5.5

An help?

Thanks.

Responses

Hi

Apologies for the delay in updating you.

Can you try adding a to your custom module dependencies in the Spring module to where the config.xml lives:

 <dependencies>
        <module name="org.custom">
            <imports>
                <include path="META-INF/config/config.xml"/>
            </imports>
        <module name="javax.api"/>

Let us know if that helps?

Regards Mustafa