Eclipse Indigo 中的 Tomcat 7:javax.naming.NameNotFoundException:找不到资源 /WEB-INF/classes
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9260555/
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
Tomcat 7 in Eclipse Indigo: javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
提问by user1206754
I am trying to configure Tomcat 7 in Eclipse Indigo, i added the Tomcat plugin from http://www.eclipsetotale.com/tomcatPlugin.html#A3into eclipse\pluginsfolder. Now when i start tomcat i am getting the below error:
我正在尝试在 Eclipse Indigo 中配置 Tomcat 7,我将来自http://www.eclipsetotale.com/tomcatPlugin.html#A3的 Tomcat 插件添加到eclipse\plugins文件夹中。现在,当我启动 tomcat 时,出现以下错误:
Feb 13, 2012 4:23:35 PM org.apache.catalina.startup.ContextConfig webConfig
SEVERE: Unable to determine URL for WEB-INF/classes
javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
at org.apache.naming.resources.BaseDirContext.listBindings(BaseDirContext.java:733)
at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:546)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1197)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:825)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:300)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Feb 13, 2012 4:23:35 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
回答by BalusC
SEVERE: Unable to determine URL for WEB-INF/classes
javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
This is actually a bug in Tomcat 7.0.25 and fixed in Tomcat 7.0.26. See also issue 52511. Please note that you can just continueusing your web application! This log is purely informal and does not block Tomcat from starting and functioning. It's caused by a change in the way how Tomcat scans annotated classes. This stacktrace will be printed when you don't have any classes in your Eclipse project and hence the /WEB-INF/classes
remains empty.
这实际上是 Tomcat 7.0.25 中的一个错误,并在 Tomcat 7.0.26 中修复。另请参阅问题 52511。请注意,您可以继续使用您的网络应用程序!此日志纯粹是非正式的,不会阻止 Tomcat 启动和运行。这是由于 Tomcat 扫描带注释类的方式发生了变化。当您的 Eclipse 项目中没有任何类并因此/WEB-INF/classes
保持为空时,将打印此堆栈跟踪。
Upgrading to Tomcat 7.0.26 will hide this log. You can also just ignore it altogether and continue using Tomcat as usual.
升级到 Tomcat 7.0.26 将隐藏此日志。您也可以完全忽略它并像往常一样继续使用 Tomcat。
As per the comments,
根据评论,
i Installed Eclipse for Java EE, in that in the server tab i added the server , when i run the server and try to open the localhost:8080 in the browser, it did not give me the welcome page, therefore i added the plugin in the eclipse plugins, now it gives me the welcome page in browser but adding to that it gives above error in console.
我为 Java EE 安装了 Eclipse,在服务器选项卡中我添加了服务器,当我运行服务器并尝试在浏览器中打开 localhost:8080 时,它没有给我欢迎页面,因此我添加了插件eclipse 插件,现在它给了我浏览器中的欢迎页面,但添加到它在控制台中给出了上述错误。
What did it give instead? A server-specific 404 error page or a browser specific "Connection timeout" page? If 404, then the server runs perfectly fine, it's just the URL which did not point anything. Note that Eclipse does by default notdeploy Tomcat's own homepage, simply because that's not useful at all while developing. It will only deploy Tomcat's own homepage when you configure Eclipse to take over Tomcat installation instead of using its engine:
它给了什么呢?特定于服务器的 404 错误页面或特定于浏览器的“连接超时”页面?如果是 404,那么服务器运行得很好,只是 URL 没有指向任何内容。请注意,Eclipse 默认不部署 Tomcat 自己的主页,因为这在开发时根本没有用。当你配置 Eclipse 来接管 Tomcat 安装而不是使用它的引擎时,它只会部署 Tomcat 自己的主页:
You need to let the URL point to the real URL of the deployed web project. It defaults to the project name which is configureable in project's properties. If the project name is for example "Playground", then you need to open http://localhost:8080/Playgroundinstead. If you want to have it on domain root, then you need to change the Context rootin Web Project Settingsto /
:
您需要让 URL 指向已部署的 Web 项目的真实 URL。它默认为可在项目属性中配置的项目名称。例如,如果项目名称是“Playground”,那么您需要打开http://localhost:8080/Playground。如果你想拥有它的根域,那么您需要更改上下文根在Web项目设置到/
:
Last but not least, I recommend to remove that Sysdeo plugin which you installed without any necessary reason. It is not in any way better than the Eclipse-builtin plugin.
最后但并非最不重要的一点是,我建议删除您在没有任何必要理由的情况下安装的 Sysdeo 插件。它在任何方面都不比 Eclipse 内置插件好。