nmd
Apr 7th, 2007, 08:44 AM
My problem appears when I move my application from development (WinXP) to staging (Linux, Fedora).
In my web.xml, I define the following:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/resources/spring/operator_profiles.xml
/WEB-INF/classes/resources/spring/services.xml
</param-value>
</context-param>
When I instantiate the FileSystemXmlApplicationContext with a String array containing the above values, I get the following error:
org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from file [/opt/java/apache-tomcat-5.5.12/bin/opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml]; nested exception is java.io.FileNotFoundException: opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml (No such file or directory)
org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:180)
org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:148)
org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:129)
org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:145)
org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:81)
org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:89)
org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:262)
org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:89)
org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:74)
se.lbsoft.ff.util.SpringUtil.getBeanFactory(Spring Util.java:50)
opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml is the correct absolute path of the file, but Spring seems to be looking for /opt/java/apache-tomcat-5.5.12/bin/opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml. The absolute path to the Spring configuration files seems to get appended to the directory where I am when running TOMCAT_HOME/bin/startup.sh. It works fine if i run startup.sh from root (/).
Am I doing something wrong? I'd rather not be forced to run Tomcat from a specific location.
Regards,
Lauri Lehtinen
LB Software
In my web.xml, I define the following:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/resources/spring/operator_profiles.xml
/WEB-INF/classes/resources/spring/services.xml
</param-value>
</context-param>
When I instantiate the FileSystemXmlApplicationContext with a String array containing the above values, I get the following error:
org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from file [/opt/java/apache-tomcat-5.5.12/bin/opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml]; nested exception is java.io.FileNotFoundException: opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml (No such file or directory)
org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:180)
org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:148)
org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:129)
org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:145)
org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:81)
org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:89)
org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:262)
org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:89)
org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:74)
se.lbsoft.ff.util.SpringUtil.getBeanFactory(Spring Util.java:50)
opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml is the correct absolute path of the file, but Spring seems to be looking for /opt/java/apache-tomcat-5.5.12/bin/opt/java/tomcat/webapps/ff71/WEB-INF/classes/resources/spring/operator_profiles.xml. The absolute path to the Spring configuration files seems to get appended to the directory where I am when running TOMCAT_HOME/bin/startup.sh. It works fine if i run startup.sh from root (/).
Am I doing something wrong? I'd rather not be forced to run Tomcat from a specific location.
Regards,
Lauri Lehtinen
LB Software