我在Eclipse中有一个GAE项目,它一直没有问题。我最近升级到了Google Cloud SDK 179.0.0和Eclipse Oxygen.1a Release(4.7.1a),现在,当我打开项目时,我在javax.servlet.http包中的类上遇到构建路径错误。具体来说,我的项目的构建路径中缺少以下类。
javax.servlet.ServletContext
javax.servlet.http.HttpServlet
如果使用以下命令从控制台启动Eclipse(假设Eclipse安装在/ Applications文件夹中):
cd /Applications/Eclipse.app/Contents/MacOS
./eclipse
你看终端窗口,你会看到一堆类似于以下的堆栈跟踪:
Nov 10, 2017 9:24:57 AM com.google.cloud.tools.eclipse.appengine.localserver.ServletClasspathProvider doResolveClasspathContainer
WARNING: Failed to initialize libraries
org.eclipse.core.runtime.CoreException: Could not resolve artifact com.google.appengine:appengine-api-1.0-sdk:jar:1.9.57
at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:776)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:743)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:720)
at com.google.cloud.tools.eclipse.util.MavenUtils.resolveArtifact(MavenUtils.java:69)
at com.google.cloud.tools.eclipse.appengine.libraries.repository.MavenHelper.resolveArtifact(MavenHelper.java:46)
at com.google.cloud.tools.eclipse.appengine.libraries.repository.M2RepositoryService.resolveArtifact(M2RepositoryService.java:50)
at com.google.cloud.tools.eclipse.appengine.libraries.repository.LibraryClasspathContainerResolverService.resolveLibraryFileAttachSourceSync(LibraryClasspathContainerResolverService.java:245)
at com.google.cloud.tools.eclipse.appengine.libraries.repository.LibraryClasspathContainerResolverService.resolveLibraryAttachSourcesSync(LibraryClasspathContainerResolverService.java:106)
at com.google.cloud.tools.eclipse.appengine.localserver.ServletClasspathProvider.doResolveClasspathContainer(ServletClasspathProvider.java:100)
at com.google.cloud.tools.eclipse.appengine.localserver.ServletClasspathProvider.resolveClasspathContainer(ServletClasspathProvider.java:79)
at org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate.resolveClasspathContainerImpl(RuntimeClasspathProviderDelegate.java:135)
at org.eclipse.jst.server.core.internal.RuntimeClasspathProviderWrapper.resolveClasspathContainerImpl(RuntimeClasspathProviderWrapper.java:155)
at org.eclipse.jst.server.core.internal.RuntimeClasspathContainer.getClasspathEntries(RuntimeClasspathContainer.java:77)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2693)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2851)
at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1956)
at org.eclipse.jdt.internal.core.ExternalFolderChange.updateExternalFoldersIfNecessary(ExternalFolderChange.java:39)
at org.eclipse.jdt.internal.core.ChangeClasspathOperation.classpathChanged(ChangeClasspathOperation.java:59)
at org.eclipse.jdt.internal.core.SetContainerOperation.executeOperation(SetContainerOperation.java:111)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:724)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:795)
at org.eclipse.jdt.internal.core.JavaModelManager$10.run(JavaModelManager.java:3001)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeAllContainers(JavaModelManager.java:3017)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:2038)
at org.eclipse.jdt.core.JavaCore.getClasspathContainer(JavaCore.java:3497)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2687)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2851)
at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1956)
at org.eclipse.jdt.internal.core.DynamicProjectReferences.getDependentProjects(DynamicProjectReferences.java:34)
at org.eclipse.core.internal.resources.ProjectDescription.computeDynamicReferencesForProject(ProjectDescription.java:950)
at org.eclipse.core.internal.resources.ProjectDescription.getAllBuildConfigReferences(ProjectDescription.java:265)
at org.eclipse.core.internal.resources.ProjectDescription.getAllReferences(ProjectDescription.java:221)
at org.eclipse.core.internal.resources.Project.getReferencedProjects(Project.java:469)
at org.eclipse.ui.actions.CloseUnrelatedProjectsAction.buildConnectedComponents(CloseUnrelatedProjectsAction.java:78)
at org.eclipse.ui.actions.CloseUnrelatedProjectsAction.computeRelated(CloseUnrelatedProjectsAction.java:195)
at org.eclipse.ui.actions.CloseUnrelatedProjectsAction.getSelectedResources(CloseUnrelatedProjectsAction.java:211)
at org.eclipse.ui.actions.SelectionListenerAction.selectionIsOfType(SelectionListenerAction.java:240)
at org.eclipse.ui.actions.CloseResourceAction.updateSelection(CloseResourceAction.java:187)
at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:124)
at org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider.updateActionBars(ResourceMgmtActionProvider.java:254)
at org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider.fillActionBars(ResourceMgmtActionProvider.java:84)
at org.eclipse.ui.navigator.NavigatorActionService$3.run(NavigatorActionService.java:265)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:258)
at org.eclipse.ui.navigator.CommonNavigatorManager$UpdateActionBarsJob$1.run(CommonNavigatorManager.java:95)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.navigator.CommonNavigatorManager$UpdateActionBarsJob.runInUIThread(CommonNavigatorManager.java:89)
at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:95)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4033)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3700)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
Contains: Missing com.google.appengine:appengine-api-1.0-sdk:jar:1.9.57
安装了179.0版本的Google Cloud SDK后,我现在安装了App Engine 1.9.59而不是1.9.57。
Eclipse构建路径包含以下库:
我在以下Eclipse版本中遇到同样的问题:
以下是我的项目现在的错误列表:
将新的App Engine Standard Edition项目创建为Maven项目,指定对1.9.57版App Engine API的依赖。
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.57</version>
<scope>provided</scope>
</dependency>
在“GoogleCloudPlatform / google-cloud-eclipse”项目下的GitHub上针对此问题创建了问题#2754。
https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2574
<小时/> 版本信息
答案 0 :(得分:0)
我不知道问题的确切原因,但重新启动计算机可以解决此错误中报告的问题。在尝试解决此问题的过程中,我确实停止并多次启动Eclipse以解决此问题。我开始了新的终端窗口会议,以解决问题,但这没有用。
完全重启我的机器后,此错误中报告的问题消失了。