首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >com.google.api.server.spi.SystemServiceServlet :java.lang.ClassNotFoundException

com.google.api.server.spi.SystemServiceServlet :java.lang.ClassNotFoundException
EN

Stack Overflow用户
提问于 2016-11-13 20:04:24
回答 1查看 1K关注 0票数 1

我刚刚克隆了一个存储库,其中包含一个基于Google的maven项目。接下来,我将它导入Eclipse。

当eclipse/maven完成导入项目时,我看到以下文件已经被修改,eclipse已经创建了一个新文件:

代码语言:javascript
复制
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

当我从eclipse构建和运行应用程序时,我会得到以下错误:

代码语言:javascript
复制
WARNING: EXCEPTION 
java.lang.ClassNotFoundException: com.google.api.server.spi.SystemServiceServlet
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

但是,在eclipse中,com.google.api.server.spi.SystemServiceServlet是可用的:

仔细看看:我看到下面的project/src/main/webapp/WEB-INF/web.xml是由eclipse添加的:

代码语言:javascript
复制
 <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呢?

如下所示,我查看了部署程序集

如果有,我可以在文件系统上添加任何jars。但是为什么Google 1.9.45中的jars没有列出呢?它有Maven依赖项,但没有Google 1.9.45。我希望避免显式地添加jars,而是让maven把它们拉进来。在构建路径上同时拥有Maven依赖项Google 1.9.45似乎很奇怪,仅仅拥有Maven依赖项还不够吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-14 17:22:29

检查部署程序集

在Eclipse中,打开项目的属性(右键单击它),然后转到部署程序集。确保所有库都包括在内。

如果没有,单击“add.”并选择任何缺少的库。(通常至少应该包括"java构建路径条目“)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40578248

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档