java.lang.ClassNotFoundException:com.google.api.server.spi.SystemServiceServlet
我刚刚克隆了一个存储库,其中包含一个基于GoogleAppEngine的maven项目。接下来,我将其导入Eclipse Neon 当eclipse/maven完成导入项目时,我看到以下文件已被修改,并且eclipse已创建了一个新文件:java.lang.ClassNotFoundException:com.google.api.server.spi.SystemServiceServlet,java,eclipse,maven,Java,Eclipse,Maven,我刚刚克隆了一个存储库,其中包含一个基于GoogleAppEngine的maven项目。接下来,我将其导入Eclipse Neon 当eclipse/maven完成导入项目时,我看到以下文件已被修改,并且eclipse已创建了一个新文件: Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: project/src/main/webapp/WEB-INF/appengine-web.xml
modified: project/src/main/webapp/WEB-INF/web.xml
Untracked files:
(use "git add <file>..." to include in what will be committed)
project/src/main/java/META-INF/persistence.xml
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.project.[all the classes here.....]</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
</web-app>
但从eclipse com.google.api.server.spi.SystemServiceServlet可以获得:
仔细看一下:project/src/main/webapp/WEB-INF/WEB.xml我看到eclipse添加了以下内容:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: project/src/main/webapp/WEB-INF/appengine-web.xml
modified: project/src/main/webapp/WEB-INF/web.xml
Untracked files:
(use "git add <file>..." to include in what will be committed)
project/src/main/java/META-INF/persistence.xml
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.project.[all the classes here.....]</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
</web-app>
这似乎与上述错误有关。但是为什么我会得到一个ClassNotFoundException
正如下面所建议的,我已经查看了部署程序集
是的,我可以在文件系统中添加任何JAR。但为什么谷歌应用程序引擎[GoogleAppEngine 1.9.45]中的JAR没有列在那里?它有Maven依赖项,但没有Google App Engine[Google App Engine 1.9.45]。我希望避免这样显式地添加jar,而是让maven将它们拉入。在构建路径上同时具有Maven依赖项和Google App Engine[Google App Engine 1.9.45]似乎很奇怪,仅仅具有Maven依赖项还不够吗?检查部署程序集:
在Eclipse中,右键单击打开项目的属性,然后转到部署程序集。确保包含所有库
如果没有,请单击“添加”。。然后选择缺少的任何库。通常至少应该包括java构建路径条目。您已经将部署程序集检查到项目的属性中了吗?您的意思是什么?你能更具体地说一下你在谈论什么文件/属性吗?好的,现在我明白了。是的,这是一个选项,但我想在pom中指定依赖项,而不是物理文件。见我更新的帖子。是否可以在eclipse中仅让Maven依赖于构建路径来删除Google App Engine[Google App Engine 1.9.46]builder?我同意你的观点:所有依赖都应该集中在pom中。但是,从你发布的图片来看,我看到你将Google App Engine作为Maven依赖项之外的一个库。您是否将Google App Engine作为依赖项包含在pom中?在这种情况下,部署程序集中唯一需要的组就是Maven依赖项。我不知道Google App Engine库来自何处,我在pom中没有看到任何引用它的内容,也没有提交eclipse特定的文件,当然GAE是作为项目的.classpath文件中的一个条目出现的。无论如何,您应该在公共M2存储库中找到GAE-19.9.46,并将其设置为pom中的依赖项。