Could not clean server of obsolete files: null java.lang.NullPointerException

28,643

Solution 1

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.

Solution 2

I'm using eclipse Luna 4.4.2

  1. Open Show View Tab from Windows > Show View > Other...
  2. Navigate the Server folder > Servers and OK
  3. On Servers Tab, right click on server and > Add and Remove...
  4. Click << Remove All > Finish
  5. Right click on server again and clean it.
  6. Goto Add and Remove... again and add your project to Configured box.
  7. Click on Finish after adding your project.
  8. And Start your server again.

Note: You don't need to remove and recreate your servers.

enter image description here

Solution 3

I had the same problem and I solved it by deleting server from eclipse and add server from scratch

Solution 4

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.

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.

Solution 5

This happened due to a probable error in $CATALINA_BASE/conf/server.xml, which I had modified for SSL.
then

  1. I deleted the modified server.xml.
  2. Cleaned tomcat.
  3. Restored the original known good server.xml.

    Can now deploy and run my app, but still need to configure SSL.

Share:
28,643
MMMMS
Author by

MMMMS

Updated on July 09, 2022

Comments

  • MMMMS
    MMMMS almost 2 years

    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,

    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.

    enter image description here

    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.

  • leoap
    leoap over 7 years
    Odd that no one suggested to reinstall tomcat before, it would be my first try.
  • aCiD
    aCiD almost 6 years
    Why down vote? This worked for me and I posted to help others. I did not want to take the credit from original solution and posted the link to it.