无法清理过时文件的服务器:null java.lang.NullPointerException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28604714/
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
Could not clean server of obsolete files: null java.lang.NullPointerException
提问by MMMMS
I was using eclipse and tomcat 7.0 fine for all web application till yesterday. Unfortunately i lost my eclipse folder(which is i am running exe) and temp folder(which is workspace directory). But i have backup of that unziped eclipse folder so i past it and started eclipse to add new project in new workspace(home/xx/newtemp) and tried to run by tomcat 7.0 but i am getting "Could not clean server of obsolete files: null java.lang.NullPointerException".Here i show my issue by images,
直到昨天,我一直在为所有 Web 应用程序使用 eclipse 和 tomcat 7.0。不幸的是,我丢失了我的 eclipse 文件夹(这是我正在运行的 exe)和临时文件夹(这是工作区目录)。但是我有那个解压缩的 eclipse 文件夹的备份,所以我过去了它并启动 eclipse 在新工作区(home/xx/newtemp)中添加新项目并尝试通过 tomcat 7.0 运行,但我得到“无法清理过时文件的服务器: null java.lang.NullPointerException"。在这里我用图片展示我的问题,
Note :Even tomcat started and home page running in localhost:8081 but whn i add new project and run in tomcat, same error raised and nothing happen.
注意:即使 tomcat 启动并且主页在 localhost:8081 中运行,但是当我添加新项目并在 tomcat 中运行时,出现相同的错误并且没有任何反应。
So far i tried,
到目前为止,我尝试过,
1 stop server
2 project -> clean
3 project build (I had automatic build disabled)
4 delete server
5 delete Servers folder
6 restart Eclipse
and also,
并且,
Click on Servers tab and Stop the server in use if it's running
Right click on the server again and select Clean...
Right click again and select Clean Tomcat Work Directory...
and also,
并且,
you have to delete the .snap file located in the directory :
<workspace-directory>\.metadata\.plugins\org.eclipse.core.resources
After deleting this file, you could start Eclipse with no problem.
and also,
并且,
To resolve this issue you have to delete tmp folder in the following directory
<workspace-directory>\.metadata\.plugins\org.eclipse.wst.server.core
If there is any problem on deleting this folder then restart your eclipse then again delete that folder.
I have tried many ways but i could not find fix .
我尝试了很多方法,但找不到修复方法。
I hope someone will help me out from the fix.
我希望有人能帮助我解决问题。
回答by Se Song
I'm using eclipse Luna 4.4.2
我正在使用 Eclipse Luna 4.4.2
- Open Show View Tab from Windows > Show View > Other...
- Navigate the Server folder > Servers and OK
- On Servers Tab, right click on server and > Add and Remove...
- Click << Remove All > Finish
- Right click on server again and clean it.
- Goto Add and Remove... again and add your project to Configured box.
- Click on Finish after adding your project.
- And Start your server again.
- 从 Windows > Show View > Other... 打开 Show View Tab
- 导航 Server 文件夹 > Servers 并确定
- 在服务器选项卡上,右键单击服务器并> 添加和删除...
- 单击 << 全部删除 > 完成
- 再次右键单击服务器并清理它。
- 再次转到 Add and Remove... 并将您的项目添加到 Configured 框。
- 添加项目后单击完成。
- 并再次启动您的服务器。
Note: You don't need to remove and recreate your servers.
注意:您不需要删除和重新创建您的服务器。
回答by ghosh.peter
I had the same thing happen to me. I found that tomcat/conf/server.xml
was 0 bytes. I replaced it with a valid file and things started up fine.
我也发生了同样的事情。我发现那tomcat/conf/server.xml
是 0 个字节。我用一个有效的文件替换了它,并且一切正常。
回答by J Slick
This happened due to a probable error in $CATALINA_BASE/conf/server.xml, which I had modified for SSL.
then
发生这种情况是由于$CATALINA_BASE/conf/server.xml 中可能存在错误,我已针对 SSL 对其进行了修改。
然后
- I deleted the modified server.xml.
- Cleaned tomcat.
Restored the original known good server.xml.
Can now deploy and run my app, but still need to configure SSL.
- 我删除了修改后的 server.xml。
- 清洗过的雄猫。
恢复了原来已知好的server.xml。
现在可以部署和运行我的应用程序,但仍需要配置 SSL。
回答by anand bhanu
Try changing the contents of server.xml
file in 'Servers' present in project-explorer
to the one present before i.e the contents which you got after configuring the server and changing the server.xml
file.
尝试将server.xml
“服务器”中的文件内容更改为project-explorer
之前的内容,即您在配置服务器并更改server.xml
文件后获得的内容。
回答by Nakul Panwar
Try deleting the folder (Note: Its a hidden folder so use terminal) :
尝试删除文件夹(注意:它是一个隐藏文件夹,所以使用终端):
[workspace...]/.metadata/.plugins/org.eclipse.wst.server.core/
[workspace...]/.metadata/.plugins/org.eclipse.wst.server.core/
System: Ubuntu/Linux (Worked for SSL as well :))
系统:Ubuntu/Linux(也适用于 SSL :))
回答by haha
today,my IDE(eclipse) happened this error,i tried all of above ideas,but it is still exist,then i uninstall my tomcat,and reinstall it, it is ok.
今天,我的IDE(eclipse)发生了这个错误,我尝试了上述所有想法,但它仍然存在,然后我卸载我的tomcat,并重新安装它,没关系。
but...it is not a good idea.I find some files were changed by eclipse in tomcat directory. Then,i check my server.xml in Server project in eclipse.The setting is< Context .. docBse="webapps"../>
.But,eclipse deploy my projects
to wptwebapps(uh.. maybe name this,I forget it,you can recheck)in tomcat.
但是...这不是一个好主意。我发现 Eclipse 在 tomcat 目录中更改了一些文件。然后,我在eclipse中的Server项目中检查我的server.xml。设置是< Context .. docBse="webapps"../>
。但是,eclipse将我的项目部署到wptwebapps(呃..也许命名这个,我忘记了,你可以在tomcat中重新检查)。
回答by BALS
I had the same problem and I solved it by deleting server from eclipse and add server from scratch
我遇到了同样的问题,我通过从 Eclipse 中删除服务器并从头开始添加服务器来解决它
回答by aCiD
Solution from Eclipse forum
来自Eclipse 论坛的解决方案
and the random use of others answers, did it for me.
以及随意使用其他答案,为我做到了。
回答by pavo123
I deleted "tomcat/conf/server.xml" and problem was gone. After restarting the server, server.xml was "regenerated".
我删除了“tomcat/conf/server.xml”,问题就消失了。重新启动服务器后,server.xml 被“重新生成”。
回答by J Slick
Dell encryption, "DDPE", may secretly corrupt text files to further annoy Winturds 7 users. Have had this problem recently with xml configuration files for both Tomcat 7 and Weblogic 12.2 on the same Dell PC.
戴尔加密“DDPE”可能会秘密破坏文本文件,从而进一步惹恼 Winturds 7 用户。最近在同一台戴尔 PC 上使用 Tomcat 7 和 Weblogic 12.2 的 xml 配置文件遇到了这个问题。
Found junk in the end tag of tomcat/conf/server.xml. Fixed the tag. Redefined the Tomcat server in Eclipse. Now it works again.
在 tomcat/conf/server.xml 的结束标记中发现垃圾。修复了标签。在 Eclipse 中重新定义了 Tomcat 服务器。现在它又工作了。
Your mileage WILLvary.
您的里程WILL变化。