没有发布的服务模块在 Helios 中不起作用
我最近将我一直在开发的 web 应用程序移动到运行 64 位 Eclipse Helios(服务版本 2)的新机器上,并且我正在使用 Maven 插件 M2Eclipse。
我已经通过 Eclipse 部署在本地 tomcat 安装上,一切都正常(或多或少),但我想选择“服务模块而不发布”选项,但是当我选择此选项时,我收到错误:
log4j:ERROR Could not read configuration file from URL [file:/C:/butterfly/svn/trunk/micro/src/main/webapp/WEB-INF/classes/log4j.properties].
java.io.FileNotFoundException: C:\butterfly\svn\trunk\micro\src\main\webapp\WEB-INF\classes\log4j.properties (The system cannot find the file specified)
log4j.properties 文件是不在那里,就像在 src/main/resources 中的源目录中一样 - 在构建时,它会被复制到 target/WEB-INF/classes/..
Eclipse 似乎将预期的目标目录与 src 目录混合在一起,所以不是找到它。
我不确定这种情况是否仅发生在属性文件中,或者在查找所有内置资源时是否会发生相同的问题。
我已经看到这些问题:
https://bugs.eclipse.org/bugs/show_bug .cgi?id=318449
http ://www.eclipse.org/forums/index.php?t=msg&goto=661045&S=25bafd85b11e042c169ecf1752bfa479
但它们似乎略有不同或已经修复(我的 Helios 是上周末的新下载)
有人经历过这个或知道如何解决吗?
I have recently moved a webapp I have been developing to a new machine running 64bit Eclipse Helios (Service Release 2) and I am using Maven plugin M2Eclipse.
I have deployed on a local tomcat install through Eclipse and everything is ok (more or less), but I want to select the option "Serve Modules without publishing", but when I select this option I get errors:
log4j:ERROR Could not read configuration file from URL [file:/C:/butterfly/svn/trunk/micro/src/main/webapp/WEB-INF/classes/log4j.properties].
java.io.FileNotFoundException: C:\butterfly\svn\trunk\micro\src\main\webapp\WEB-INF\classes\log4j.properties (The system cannot find the file specified)
The log4j.properties file is not there, as in my source directories in lives in src/main/resources - at build it then gets copied over to target/WEB-INF/classes/..
Eclipse seems to be mixing the expected target directory with the src directory so not finding it.
Im not sure if this is happening for just the properties file or if the same problem will occur looking for all built resources.
I have seen these issues:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318449
http://www.eclipse.org/forums/index.php?t=msg&goto=661045&S=25bafd85b11e042c169ecf1752bfa479
but they seem to be slightly different or already fixed (My Helios is a new download from last weekend)
Anyone experience this or know how to resolve?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自此处:“不带发布选项的服务模块的作用说,Web 内容将直接从动态 Web 项目的“WebContent”文件夹提供,用于使项目的依赖项在 Web 应用程序的类加载器中可用。我希望 Eclipse 在构建项目后模拟从 WEB-INF/classes 提供每个类/资源文件(包括 log4j.properties)。作为解决方法,如何在 WebContent 中创建一个“classes”文件夹,在此处复制 log4j.properties 文件并查看类加载器是否满意?
From here: "The Serve modules without publishing option does what it says. Web content will be served directly from the "WebContent" folder of the Dynamic Web Project. A customized context is used to make the project's dependencies available in the Web application's classloader". I would expect eclipse to emulate serving every class / resource file (including log4j.properties) from WEB-INF/classes after you build the project. As a workaround, what about creating a "classes" folder inside WebContent, copy log4j.properties file here and see if the classloader gets happy?