Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Tomcat服务器上的Eclipse中执行SpringWeb项目时出现问题_Eclipse_Tomcat_Maven 2_Spring Mvc_M2eclipse - Fatal编程技术网

在Tomcat服务器上的Eclipse中执行SpringWeb项目时出现问题

在Tomcat服务器上的Eclipse中执行SpringWeb项目时出现问题,eclipse,tomcat,maven-2,spring-mvc,m2eclipse,Eclipse,Tomcat,Maven 2,Spring Mvc,M2eclipse,我有一个SpringWeb项目,它使用Maven来编译/构建。建设这个项目没有问题。我试图在Tomcat(v6)服务器上的Eclipse(3.3.2)中运行该项目 作为Spring项目的一部分,我在WEB-INF目录中有一个Spring-servlet.xml文件。此文件包括另一个具有数据源配置的资源xml文件 <import resource="classpath:${datasourceInclude}.xml"/> 基本上,当我启动Tomcat时,它会尝试从/src/main

我有一个SpringWeb项目,它使用Maven来编译/构建。建设这个项目没有问题。我试图在Tomcat(v6)服务器上的Eclipse(3.3.2)中运行该项目

作为Spring项目的一部分,我在WEB-INF目录中有一个Spring-servlet.xml文件。此文件包括另一个具有数据源配置的资源xml文件

<import resource="classpath:${datasourceInclude}.xml"/>
基本上,当我启动Tomcat时,它会尝试从/src/main/webapp/WEB-INF文件夹中选择spring-servlet.xml,该文件夹包含${datasourceInclude}变量


谁能告诉我如何解决这个问题,这样我就不必更改spring-servlet.xml并添加硬代码值来代替${datasourceInclude}变量。

谁负责解析spring xml中的属性/变量名称?这是通过Maven在编译时完成的,还是应该在运行时完成?如果在运行时,您是否正在使用Spring的
属性PlaceHolderConfigure

尝试将
war:inplace
添加到Maven项目配置页面中为资源筛选执行的目标列表中

右键单击项目上的,然后转到属性>Maven>生命周期映射,并将
war:inplace
添加到目标中,以便在资源更改时调用,如下所示:


这是由Maven在编译时完成的。我已经指定了几个maven概要文件,用于加载具有变量值的资源包文件。那么,当从Eclipse运行时,您希望它如何工作?您是否在Eclipse中使用Maven插件,如M2E?是的,我在Eclipse中使用Maven插件M2E。我的问题是如何配置Eclipse以在spring-servlet.xml文件加载到Tomcat之前更改它中的变量。我也有同样的问题,STS 2.7,m2eclipse,在本例中,Tomcat 7现在在内部使用,还有其他想法为什么不调用它或者如何跟踪问题吗?升级到STS 2.8,并支持新的m2e,过滤效果很好,开箱即用-
<import resource="classpath:datasourceLocal.xml"/>
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:${datasourceInclude}.xml]
Offending resource: ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [${datasourceInclude}.xml]; nested exception is java.io.FileNotFoundException: class path resource [${datasourceInclude}.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
...
...