Java 从 Eclipse 启动 Tomcat 时出现“SetPropertiesRule”警告消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/104854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 08:20:52  来源:igfitidea点击:

"SetPropertiesRule" warning message when starting Tomcat from Eclipse

javaeclipsetomcateclipse-3.4

提问by Das

When I start Tomcat (6.0.18) from Eclipse (3.4), I receive this message (first in the log):

当我从 Eclipse (3.4) 启动 Tomcat (6.0.18) 时,我收到此消息(日志中的第一个):

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server: (project name)' did not find a matching property.

警告:[SetPropertiesRule]{Server/Service/Engine/Host/Context} 将属性“source”设置为“org.eclipse.jst.jee.server:(项目名称)”没有找到匹配的属性。

Seems this message does not have any severe impact, however, does anyone know how to get rid of it?

这个消息似乎没有任何严重影响,但是,有谁知道如何摆脱它?

采纳答案by Swati

The solution to this problem is very simple. Double click on your tomcat server. It will open the server configuration. Under server options check ‘Publish module contents to separate XML files' checkbox. Restart your server. This time your page will come without any issues.

这个问题的解决方法非常简单。双击您的 tomcat 服务器。它将打开服务器配置。在服务器选项下,选中“将模块内容发布到单独的 XML 文件”复选框。重新启动您的服务器。这次您的页面将没有任何问题。

回答by Swati

From Eclipse Newsgroup:

来自Eclipse 新闻组

The warning about the source property is new with Tomcat 6.0.16 and may be ignored. WTP adds a "source" attribute to identify which project in the workspace is associated with the context. The fact that the Context object in Tomcat has no corresponding source property doesn't cause any problems.

关于 source 属性的警告是 Tomcat 6.0.16 的新增内容,可能会被忽略。WTP 添加了一个“源”属性来标识工作区中的哪个项目与上下文相关联。Tomcat 中的 Context 对象没有相应的源属性这一事实不会导致任何问题。

I realize that this doesn't answer how to get rid of the warning, but I hope it helps.

我意识到这并没有回答如何摆脱警告,但我希望它有所帮助。

回答by Swati

I had the same problem with Eclipse 3.4(Ganymede) and dynamic web project.
The message didn't influence successfull deploy.But I had to delete row

我在 Eclipse 3.4(Ganymede) 和动态 Web 项目中遇到了同样的问题。
该消息不影响成功部署。但我不得不删除行

<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>

from org.eclipse.wst.common.component file in .settings folder of Eclipse

来自 Eclipse .settings 文件夹中的 org.eclipse.wst.common.component 文件

回答by Swati

I'm finding that Tomcat can't seem to find classes defined in other projects, maybe even in the main project. It's failing on the filter definition which is the first definition in web.xml. If I add the project and its dependencies to the server's launch configuration then I just move on to a new error, all of which seems to point to it not setting up the project properly.

我发现 Tomcat 似乎无法找到在其他项目中定义的类,甚至可能在主项目中。过滤器定义失败,它是 web.xml 中的第一个定义。如果我将项目及其依赖项添加到服务器的启动配置中,那么我只会继续处理一个新错误,所有这些似乎都表明它没有正确设置项目。

Our setup is quite complex. We have multiple components as projects in Eclipse with separate output projects. We have a separate webapp directory which contains the static HTML and images, as well as our WEB-INF.

我们的设置非常复杂。我们有多个组件作为 Eclipse 中的项目,具有单独的输出项目。我们有一个单独的 webapp 目录,其中包含静态 HTML 和图像,以及我们的 WEB-INF。

Eclipse is "Europa Winter release". Tomcat is 6.0.18. I tried version 2.4 and 2.5 of the "Dynamic Web Module" facet.

Eclipse 是“欧洲冬季版本”。Tomcat 是 6.0.18。我尝试了“动态 Web 模块”方面的 2.4 和 2.5 版。

Thanks for any help!

谢谢你的帮助!

  • Richard
  • 理查德

回答by Swati

Servers tab

服务器选项卡

--> doubleclick servername

--> 双击服务器名

--> Server Options: tick "Publish module contexts to separate XML files"

--> 服务器选项:勾选“发布模块上下文以分隔 XML 文件”

restart your server

重启你的服务器

回答by Radhakant

I am using Eclipse. I have resolved this problem by the following:

我正在使用 Eclipse。我已经通过以下方式解决了这个问题:

  1. Open servers tab.
  2. Double click on the server you are using.
  3. On the server configuration page go to server options page.
  4. Check Serve module without publishing.
  5. Then save the page and configurations.
  6. Restart the server by rebuild all the applications.
  1. 打开服务器选项卡。
  2. 双击您正在使用的服务器。
  3. 在服务器配置页面上,转到服务器选项页面。
  4. 在不发布的情况下检查服务模块。
  5. 然后保存页面和配置。
  6. 通过重建所有应用程序重新启动服务器。

You will not get any this kind of error.

您不会收到任何此类错误。

回答by Arijith

Delete the server instance from Eclipse and create a new one.

从 Eclipse 中删除服务器实例并创建一个新实例。

回答by Bijan

I copied the dynamic Webproject before the issue came up. So, changing the org.eclipse.wst.common.component file in the .settings directory solved the issue for me. The other solutions did not work.

我在问题出现之前复制了动态 Web 项目。因此,更改 .settings 目录中的 org.eclipse.wst.common.component 文件为我解决了这个问题。其他解决方案不起作用。

回答by armyofda12mnkeys

The separate XML solution never worked for me and other's recently ...

单独的 XML 解决方案从来没有为我和其他人最近工作过......

I usually follow this process and something helps:

我通常遵循这个过程,有些东西会有所帮助:

  1. Stop the server (Make sure its stopped via Task Manager, I killed javaw.exe as many times Eclipse doesn't really shut down properly)
  2. Right click the Server->'Add and Remove'. Remove the project. Finish.
  3. Right click the Server->'Add and Remove'. Add the project. Finish.
  4. Restart see if works, if not continue
  5. Double click the Server... See where its getting published (Server Path: which I think goes to a tmp# directory for me since I use an already-installed Tomcat instance I re-use, not sure if would be different if use Eclipse's internal/bundled tomcat server)
  6. Right click on Server and 'Clean' ... Last one worked for me last time (so may want to try this first), Adding/Removing project worked for me other times. If doesn't work, continue ...
  7. Delete all files from the Server Path and see if all files actually get built and published there (/WEB-INF/classes and other regular files in / webroot).
  8. Restart Eclipse and/or machine (not sure I ever needed to get to this point)
  1. 停止服务器(确保它通过任务管理器停止,我多次杀死 javaw.exe Eclipse 并没有真正正确关闭)
  2. 右键单击服务器->“添加和删除”。删除项目。结束。
  3. 右键单击服务器->“添加和删除”。添加项目。结束。
  4. 重启看看是否有效,如果不行继续
  5. 双击服务器...查看它的发布位置(服务器路径:我认为它进入了 tmp# 目录,因为我使用了一个我重新使用的已安装的 Tomcat 实例,不确定如果使用 Eclipse 是否会有所不同内部/捆绑的tomcat服务器)
  6. 右键单击服务器和“清理”...最后一个上次对我有用(所以可能想先尝试这个),添加/删除项目其他时候对我有用。如果不起作用,请继续...
  7. 从服务器路径中删除所有文件,看看所有文件是否真的在那里构建和发布(/WEB-INF/classes 和 /webroot 中的其他常规文件)。
  8. 重新启动 Eclipse 和/或机器(不确定我是否需要达到这一点)

回答by pulp_fiction

I am posting my answer because I suspect there might be someone out there for whom the above solutions might not have worked.

我发布我的答案是因为我怀疑可能有人对上述解决方案不起作用。

So, you are getting a warning,

所以,你收到警告,

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server: (project name)' did not find a matching property.

警告:[SetPropertiesRule]{Server/Service/Engine/Host/Context} 将属性“source”设置为“org.eclipse.jst.jee.server:(项目名称)”没有找到匹配的属性。

Rather than disabling this warning by checking that option in Server configuration (I did try that) I would suggest you do this:

与其通过检查服务器配置中的该选项来禁用此警告(我确实尝试过),我建议您这样做:

  1. First close all the existing projects by right clicking in Project explorer.
  2. Remove all the projects already synchronized with the server.
  3. Remove the server and redeploy it.
  4. Create a new dynamic project, do nothing yet just try running this on the server.
  5. Check the console, do you get the warning now. (My case I didn't get any).
    This means that something is wrong with your project not with eclipse or the server.
  6. Now restart the server. Don't run any app yet.
    You probably know that the Tomcat container loads up context of all the synchronized apps at the start.
  7. It will load context of any already synchronized app.
  8. Here is the catch, if there is really something wrong in your project it will show the stack trace of the exceptions.Look carefully and you will find where is the bug in your app.
  1. 首先通过右键单击项目资源管理器关闭所有现有项目。
  2. 删除所有已与服务器同步的项目。
  3. 删除服务器并重新部署它。
  4. 创建一个新的动态项目,什么都不做,只是尝试在服务器上运行它。
  5. 检查控制台,您现在是否收到警告。(我的情况我没有得到任何)。
    这意味着您的项目有问题而不是 eclipse 或服务器。
  6. 现在重新启动服务器。暂时不要运行任何应用程序。
    您可能知道 Tomcat 容器在开始时加载所有同步应用程序的上下文。
  7. 它将加载任何已经同步的应用程序的上下文。
  8. 这里有一个问题,如果你的项目真的有问题,它会显示异常的堆栈跟踪。仔细看,你会发现你的应用程序中的错误在哪里。

Now if you successfully found that there is a bug in your app, the probable place would be look for a web.xml file which the container uses for loading the app. In my case I had misspelled a name in servlet mapping which made me debug meaninglessly for 3 hours. Your problem might be someplace else.

现在,如果您成功发现应用程序中存在错误,则可能的位置是查找容器用于加载应用程序的 web.xml 文件。就我而言,我在 servlet 映射中拼错了一个名称,这让我无意义地调试了 3 个小时。您的问题可能出在其他地方。

And another thing, if you have many apps synchronized with the server,there is a possibility some other app's context might be the source of problem. Try debugging one by one.

另一件事,如果您有许多与服务器同步的应用程序,则其他应用程序的上下文可能是问题的根源。一一调试试试。