无法清除过时文件的服务器:null java.lang.NullPointerException

时间:2015-02-19 11:05:35

标签: java eclipse tomcat nullpointerexception

直到昨天我才对所有网络应用程序使用eclipse和tomcat 7.0。不幸的是我丢失了我的eclipse文件夹(我正在运行exe)和临时文件夹(这是工作区目录)。但我有备份的unziped eclipse文件夹,所以我通过它并启动eclipse在新的工作区(home / xx / newtemp)添加新项目并尝试运行tomcat 7.0但我得到“无法清理服务器过时的文件:null java.lang.NullPointerException “。这里我用图像显示我的问题,

注意:即使tomcat启动并且主页在localhost:8081中运行,但是当我添加新项目并在tomcat中运行时,同样的错误也没有发生。

enter image description here

到目前为止我试过了,

    1 stop server

    2 project -> clean

    3 project build (I had automatic build disabled)

    4 delete server

    5 delete Servers folder

    6 restart Eclipse

还有,

    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...

还有,

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.

还有,

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.

我尝试了很多方法,但我找不到修复方法。

我希望有人会帮我解决问题。

10 个答案:

答案 0 :(得分:2)

我正在使用eclipse Luna 4.4.2

  1. 从Windows打开“显示视图”选项卡&gt;显示视图&gt;其他...
  2. 导航服务器文件夹&gt;服务器和确定
  3. 在服务器标签上,右键单击服务器&gt;添加和删​​除...
  4. 点击&lt;&lt;全部删除&gt;完成
  5. 再次右键单击服务器并清除它。
  6. 再次转到添加和删除...并将项目添加到已配置框。
  7. 添加项目后单击“完成”。
  8. 然后重新启动服务器。
  9. 注意:您不需要删除并重新创建服务器。

    enter image description here

答案 1 :(得分:2)

我发生了同样的事情。我发现tomcat/conf/server.xml是0字节。我用一个有效的文件替换它,事情很好。

答案 2 :(得分:2)

我遇到了同样的问题,我通过从eclipse中删除服务器并从头开始添加服务器来解决它

答案 3 :(得分:1)

尝试删除文件夹(注意:它是一个隐藏文件夹,所以请使用终端):

<强> [workspace...]/.metadata/.plugins/org.eclipse.wst.server.core/

系统:Ubuntu / Linux (也为SSL工作:))

答案 4 :(得分:1)

今天,我的IDE(eclipse)发生了这个错误,我尝试了以上所有的想法,但它仍然存在,然后我卸载我的tomcat,并重新安装它,没关系。

但是......这不是一个好主意。我发现一些文件是由tomcat目录中的eclipse更改的。然后,我在eclipse中的Server项目中检查我的server.xml。设置为< Context .. docBse="webapps"../>。但是,eclipse部署我的项目 到了 wptwebapps (呃..也许这个名字,我忘记了,你可以重新检查)在tomcat中。

答案 5 :(得分:0)

这是因为 $ CATALINA_BASE / conf / server.xml 中可能出现的错误,我已为SSL修改了该错误。
  那么

  1. 我删除了修改后的server.xml。
  2. 清理过tomcat。
  3. 恢复原始已知的良好server.xml。

    现在可以部署和运行我的应用,但仍需要配置SSL。

答案 6 :(得分:0)

尝试将server.xml中存在的'Servers'中的project-explorer文件的内容更改为之前存在的文件,即配置服务器和更改server.xml文件后获得的内容。

答案 7 :(得分:0)

Dell加密“ DDPE”可能会秘密破坏文本文件,以进一步惹恼Winturds 7用户。最近在同一台Dell PC上使用Tomcat 7和Weblogic 12.2的xml配置文件出现了此问题。

在tomcat / conf / server.xml的结束标记中发现了垃圾。修复了标签。在Eclipse中重新定义Tomcat服务器。现在可以再次使用。

您的里程将会有所不同。

答案 8 :(得分:-1)

我删除了“ tomcat / conf / server.xml”,问题消失了。 重新启动服务器后,server.xml被“重新生成”。

答案 9 :(得分:-2)

来自Eclipse forum

的解决方案

随意使用别人的答案,为我做了。