Eclipse报错:Setting property 'source' to 'org.eclipse.jst.jee.server:test1' did no
最近把Eclipse的maven插件从m2eclipse更新到m2e后出了一些莫名其妙的的问题。今天又出了一个,就是Eclipse新建的Maven Web project在tomcat里启动后报错,具体报错信息如下:
- 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:test1' did not find a matching property.
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:test1' did not find a matching property.
对于这个问题,网上很多人给出的原因和解决方案如下:
不过我按这种方式操作后发现还是会报这个问题,除了这种方式之外网上也没有什么参考资料了,这个问题纠结了我几天。仔细检查工程结构后发现我的工程根目录下生成了一个WebContent文件夹。具体截图如下:
一般来说正常的maven项目的web资源文件都是默认位于src/main/webapp下,WebContent只是普通的Dynamic Web project使用的默认Web文件目录。而我这个工程竟然同时生成了这两个目录,而且两个目录下都有WEB-INF文件夹。这个是不是问题的根源呢?
为了排查,我又重新新建了一个maven web project,工程名为test2。新建完后发现并没有生成WebContent文件夹。我们都知道,Eclipse中建Maven Web工程需要添加Project Facets。具体步骤如下图所示:
1.右键--Properties
2.选择Project Facets,然后点击右边的Convert to faceted from...
3.在弹出的窗口中选择Dynamic Web Module
4.如上图所示在窗口下方还有一个Further configuration available...,点击后弹窗如下,打开完后终于找到了原因所在,在这一步需要设置工程的content directory,如果不设置,目录名称默认就是WebContent。
前一步我是没有设置,所以才会生成默认的WebContent目录。
添加完Facets后,把test2工程部署在tomcat启动,发现之前的错误已经不存在了。
解决完问题后,心里还是有点不踏实,问题的根源到底是什么呢。逐一比对了两个工程的文件内容后终于发现了区别所在。区别在于工程.settings文件夹下。.settings目录下的文件附图如下:
上图高亮的部分的两个文件就是区别所在。
其中.jsdtscope中有一行定义:
- <classpathentry kind="src" path="WebContent"/>
<classpathentry kind="src" path="WebContent"/>
而test2工程的定义如下:
- <classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="src/main/webapp"/>
另外org.eclipse.wst.common.component文件中定义了工程的wb-resource
- <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
test2工程的定义如下:
- <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
综上所述,推测tomcat在部署工程时会去查找.settings中定义的配置。如果配置有问题,则会报错。上面的问题,只要把test1工程.settings目录下对应的两个文件的配置修改后重新部署就能正常启动了。
Eclipse报错:Setting property 'source' to 'org.eclipse.jst.jee.server:test1' did no的更多相关文章
- Eclipse报错:Setting property 'source' to 'org.eclipse.jst.jee.server:xx' did not find a matching property
Shell代码 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to ' ...
- Setting property 'source' to 'org.eclipse.jst.jee.server [问题点数:40分]
链接地址:http://bbs.csdn.net/topics/390131469 警告: [SetContextPropertiesRule]{Context} Setting property ' ...
- tomcat Setting property 'source' to 'org.eclipse.jst.jee.server
很不爽,好好的项目不知道突然怎么了... 启动tomcat出个错,,,,, setting property 'source' to 'org.eclipse.jst.jee.server:jeesi ...
- eclipse下启动tomcat出现Setting property 'source' to 'org.eclipse.jst.jee.server: '错误的解决办法
在eclipse中启动tomcat时出现Setting property 'source' to 'org.eclipse.jst.jee.server:你的站点名' did not find a ...
- 从0开始学Java——eclipse下运行servlet程序警告:Setting property 'source' to 'org.eclipse.jst.jee.server:类名' did not find a matching property.
在使用Eclipse 创建第一个 Servlet之后,并且配置好了tomcat,然后Run on server的之后,提示标题所示错误: 警告: [SetContextPropertiesRule]{ ...
- Setting property 'source' to 'org.eclipse.jst.jee.server
警告: [SetPropertiesRule] Setting property 'source' to 'org.eclipse.jst.jee.server:project' did not fi ...
- 用eclipse javaEE编程时,不管什么程序都会出现这个错误[SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:bookstore' did not find
用eclipse javaEE编程时,不管什么程序都会出现这个错误[SetContextPropertiesRule]{Context} Setting property 'source' to 'o ...
- 配置servers时,错误:Setting property 'source' to 'org.eclipse.jst.jee.server:hczm' did not find a matching property
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.e ...
- 警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:JsonBlog' did not find a matching property.
这个问题困扰很久了,逛了很多论坛,终于得以解决 我的控制台错误如下: 五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log ...
随机推荐
- php返回json,xml,JSONP等格式的数据
php返回json,xml,JSONP等格式的数据 返回json数据: header('Content-Type:application/json; charset=utf-8'); $arr = a ...
- English sentence
For a better environment, we should teach our children to put litter/garbage/trash into dustbin/dust ...
- C# using 三种使用方式
http://www.cnblogs.com/fashui/archive/2011/09/29/2195061.html 1.using指令. using 命名空间名字.例如: using Syst ...
- [MongoDB] 高可用架构方案
一.缘由: 众所周知,Mongodb是在高速发展期,一些特性架构难免会发生变化.这里就总结下,我目前所知道的Mongodb 的高可用架构都有哪些.目前Mongodb版本3.2. 二.结构介绍: 1.R ...
- java 线程的使用
java 线程的使用 //线程的使用 //需要记三个单词 //1.Thread 线程的类名 //2. Runnable 线程的接口 //3. start 执行线程 //使用继承线程类的方式实现线程 c ...
- Java 开发必会的 Linux 命令
作为一个Java开发人员,有些常用的Linux命令必须掌握.即时平时开发过程中不使用Linux(Unix)或者mac系统,也需要熟练掌握Linux命令.因为很多服务器上都是Linux系统.所以,要和服 ...
- fgets读取文件时的注意事项
1 文本文件 a.txt 内容如下 2 c代码 FILE *fil; if (!(fil = fopen("/home/rudy/projects/paser/a.txt", &q ...
- 每天一个 Linux 命令(4):mkdir
linux mkdir 命令用来创建指定的名称的目录,要求创建目录的用户在当前目录中具有写权限,并且指定的目录名不能是当前目录中已有的目录. 1.命令格式: mkdir [选项] 目录- 2.命令功能 ...
- yum 部署nginx
第一步,在/etc/yum.repos.d/目录下创建一个源配置文件nginx.repo: cd /etc/yum.repos.d/ vim nginx.repo 填写如下内容: [nginx ...
- 剑指offer习题集1
1.打印二叉树 程序很简单,但是其中犯了一个小错误,死活找不到,写代码要注意啊 这里左右子树,要注意是node->left,结果写成root->left vector<int> ...