Java Tomcat v7.0 停止在本地主机上运行我的项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23288991/
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 v7.0 stopped to run my project at localhost
提问by qazerty23
I was working on my web application in eclipse with Tomcat v7.0, and everything was fine.
But today suddenly I can't run my poject on server anymore.
I do as usual:
Right click on my project->Run As->Run on Server and then choose to run it on my Tomcat server, but I get this error:
我正在使用 Tomcat v7.0 在 Eclipse 中处理我的 Web 应用程序,一切都很好。
但是今天突然我不能在服务器上运行我的项目了。
我像往常一样:
右键单击我的项目->运行方式->在服务器上运行,然后选择在我的Tomcat服务器上运行它,但出现此错误:
'Publishing to Tomcat v7.0 Server at localhost...'
has encountered a problem
Removing obsolete files from server...
Could not clean server of obsolete files: Premature end of file.
Premature end of file.
Does anyone know what should I do please?
请问有人知道我该怎么办吗?
web.xml:
网页.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>LinkedIn</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
回答by Michael Ressler
I solved this by deletingthe working directory of my Tomcat server, cleaning, and republishing. For reference, my working directory was:
我通过删除Tomcat 服务器的工作目录、清理和重新发布. 作为参考,我的工作目录是:
{eclipse-workspace}/.metadata/.plugins/org.eclipse.wst.server.core
And my server was tmp0. I've seen other people have servers under different directories. I found this path after double clicking on the Tomcat server in eclipse. That brings up a configuration menu and it lists the "Server Location".
我的服务器是tmp0。我见过其他人在不同的目录下有服务器。我在eclipse中双击Tomcat服务器后找到了这个路径。这会打开一个配置菜单并列出“服务器位置”。
回答by Kristjan Veskim?e
I had similar problem, but java.lang.NullPointerException
instead.
我有类似的问题,但java.lang.NullPointerException
相反。
For me the only thing that worked was to:
对我来说,唯一有效的是:
- Right-click on server instance on servers view -> Properties -> Switch Location;
- Remove all published projects from server;
- Right click on server again and do both cleans.
- 右键单击服务器视图上的服务器实例-> 属性 -> 切换位置;
- 从服务器中删除所有已发布的项目;
- 再次右键单击服务器并进行两次清理。
Hope that helps!
希望有帮助!
回答by Karthiknathan Srinivasan
Double click on server
look for server path
deletea folder called tmp0in C:\src\trunk\.metadata\.plugins\org.eclipse.wst.server.core
在服务器上查找服务器路径双击
删除一个文件夹,名为TMP0在C:\src\trunk\.metadata\.plugins\org.eclipse.wst.server.core
回答by Khwaja Moiz
Download and install the zip file of tomcat instead of 32 bit windows zip and 64 bit windows zip. Add it to server- Window->Pref->Server->Runtime Env
下载并安装tomcat 的zip 文件,而不是32 位windows zip 和64 位windows zip。将它添加到 服务器- Window->Pref->Server->Runtime Env
Apache Tomcat download page https://tomcat.apache.org/download-70.cgi
Apache Tomcat 下载页面 https://tomcat.apache.org/download-70.cgi
回答by wsuser
Also you can removethese files:
您也可以 删除这些文件:
org.eclipse.wst.server.core.prefs
org.eclipse.jst.server.tomcat.core.prefs
from $your_path/workspaceEclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings
从 $your_path/workspaceEclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings
and make new server again.
并再次制作新服务器。
回答by Marco Ferrari
In my case it was due to a BSOD during the deploy procedure. I had a couple of corrupted files (in Tomcat config) in the destination tomcat, so eclipse could not parse them to check if a redeploy was needed.
就我而言,这是由于部署过程中出现蓝屏。我在目标 tomcat 中有几个损坏的文件(在 Tomcat 配置中),因此 eclipse 无法解析它们以检查是否需要重新部署。
回答by Zigri2612
Recheck your web.XML file.
重新检查您的 web.XML 文件。
This error just because of web.xml configuration or sometime need to clean & build whole project from
这个错误只是因为 web.xml 配置或有时需要从
Project>clean
Server clean
服务器清洁
Server>right click>delete
Then
然后
Setup new server
回答by Renat Gatin
In my case, when I had same issue I understood that I previously commented out the Host node with name="localhost" in server.xml.
就我而言,当我遇到同样的问题时,我明白我之前在 server.xml 中注释掉了 name="localhost" 的 Host 节点。
Example:
例子:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"></Host>
And since then I was getting this Exception each time I tried to publish changes to Tomcat.
从那时起,我每次尝试将更改发布到 Tomcat 时都会收到此异常。
But the problem is, when I opened server.xml in eclipse and I removed comment brackets from this Host, saved changes and tried o publish again, I was still getting this Exception. Restarting Eclipse, deleting tmp0folder in C:\src\trunk.metadata.plugins\org.eclipse.wst.server.core did not help.
但问题是,当我在 eclipse 中打开 server.xml 并从此主机中删除注释括号,保存更改并再次尝试发布时,我仍然收到此异常。重新启动 Eclipse,删除C:\src\trunk.metadata.plugins\org.eclipse.wst.server.core 中的tmp0文件夹没有帮助。
What helped is openning server.xml in otherthan Eclipse editor. It is appeared that this Host stayed commented out in it, so Eclipse did not actually apply changes unless publishing is successfull. So I removed comment brackets from this Host in other text editor, saved changes, returned to Eclipse and publishing worked again!
帮助是在Eclipse 编辑器之外打开 server.xml。看起来这个 Host 在其中被注释掉了,所以除非发布成功,否则 Eclipse 实际上并没有应用更改。所以我在其他文本编辑器中从这个 Host 中删除了注释括号,保存更改,返回到 Eclipse 并再次发布!
Hope it will help to somebody.
希望它会对某人有所帮助。