---
title: "Could not publish to the server.java.lang.NullPointerException"
author: "ly_mad"
date: "2014-01-07T12:02:12Z"
tags: []
categories: ["开源软件"]
slug: "could-not-publish-to-the-server-java-lang-nullpointerexception"
draft: false
lastmod: "2014-01-07T12:02:12Z"
id: 2000283
url: "https://ly-mad.iteye.com/blog/2000283"
---

问题描述：

java.lang.NullPointerException  
 at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getProjectRelativePaths(VirtualResource.java:119)  
 at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingFiles(VirtualFile.java:104)  
 at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingResources(VirtualFile.java:93)  
 at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.exists(VirtualResource.java:88)  
 at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getNonBinaryComponentManifest(ManifestUtilities.java:124)  
 at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifest(ManifestUtilities.java:81)  
 at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifestClasspath(ManifestUtilities.java:147)  
 at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getManifestClasspath(J2EEModuleVirtualComponent.java:248)  
 at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.calculateManifestReferences(J2EEModuleVirtualComponent.java:368)  
 at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.cacheManifestReferences(J2EEModuleVirtualComponent.java:360)  
 at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:176)  
 at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:214)  
 at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:207)  
 at org.eclipse.jst.common.internal.modulecore.AddClasspathLibReferencesParticipant.getReferencedProjectComponentClasspathDependencies(AddClasspathLibReferencesParticipant.java:97)  
 at org.eclipse.jst.common.internal.modulecore.AddClasspathLibReferencesParticipant.getChildModules(AddClasspathLibReferencesParticipant.java:138)

 

解决方案：

1. Removed the project from the workspace
2. Remove .classpath, .project and .settings folder
3. Reimport the project

Maven项目解决：

1. Removed the project from the workspace
2. CMD：mvn eclipse:clean
3. Remove .settings folder
4. CMD：mvn eclipse:eclipse
5. Reimport the project