3 Replies Latest reply on Jan 8, 2013 6:18 PM by muthukumaran_m

    Spring file from a jar is not avilable to other WAR

    muthukumaran_m

      Hello

       

      I have the following deployment

           - CacheScheduler.jar - This has some classes & a spring file "spring/cache-spring-config.xml"

           - TestPortlet.war - This has a spring file "chart_cf.xml" and imports the "spring/cache-spring-config.xml" file from the CacheScheduler.jar using

                <import resource="classpath:spring/cache-spring-config.xml"/>

          

      I have defined the dependency for CacheScheduler.jar in the "jboss-deployment-structure.xml" of TestPortlet.war like

                <module name="deployment.CacheScheduler.jar"></module>

       

      But when I try to deploy the TestPortlet.war I get the following exception

       

      WEB-INF/classes/chart_cf.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOExc

      eption parsing XML document from class path resource [spring/cache-spring-config.xml]; nested exception is java.io.FileN

      otFoundException: class path resource [spring/cache-spring-config.xml] cannot be opened because it does not exist

       

       

      It looks like dependency for the deployment.CacheScheduler.jar only get the classes but not any property or XML file from the jar to the WAR. Is there anything I am missing.

       

      NOTE: Please do not point me to this https://community.jboss.org/wiki/HowToPutAnExternalFileInTheClasspath, I already ready it and I don't want to take that approach as it will take away the dynamic deployment of CacheScheduler.jar from me.

       

      Thanks,

      Muthu

        • 1. Re: Spring file from a jar is not avilable to other WAR
          sfcoy

          Please show your whole jboss-deployment-structure.xml file.

          • 2. Re: Spring file from a jar is not avilable to other WAR
            muthukumaran_m

            Hi Stephen,

             

            Here is my jboss-deployment-structure.xml

             

            <?xml version="1.0"?>

             

            <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

                <deployment>

                    <exclusions>

                        <module name="javaee.api"></module>

                        <module name="org.apache.log4j"></module>

                    </exclusions>

                    <dependencies>

                        <module name="deployment.CacheScheduler.jar"></module>

                        <module name="org.springframework.spring">

                            <imports>

                                <include path="META-INF**"></include>

                                <include path="org**"></include>

                            </imports>

                        </module>

                    </dependencies>

                </deployment>

            </jboss-deployment-structure>

             

            Thanks,

            Muthu

            • 3. Re: Spring file from a jar is not avilable to other WAR
              muthukumaran_m

              It was mybad. I had a typo in the XML file. Fixed it and it worked.

               

              Thanks Stephen for taking your time.