无法编译生成的 JSP java 文件

Failed to compile the generated JSP java files

我正在使用 Neatbeans 将一个简单的项目部署到 GAE,我设法部署了 "empty" 项目,但现在我添加了一个 class,但出现错误。

当我运行:appcfg update C:\Users\lsarni\Documents\NetBeansProjects\TestMemcache\web

我收到以下错误:

8% Compiling jsp files.
sep 15, 2016 3:16:16 PM org.apache.jasper.JspC processFile
INFO: Built File: \index.jsp
C:\Users\lsarni\AppData\Local\Temp73963375861-0\org\apache\jsp\index_jsp.java:6: error: package Memcache does not exist
import Memcache.GoogleMemcache;
               ^
C:\Users\lsarni\AppData\Local\Temp73963375861-0\org\apache\jsp\index_jsp.java:6: error: package Memcache does not exist
import Memcache.GoogleMemcache;
               ^
C:\Users\lsarni\AppData\Local\Temp73963375861-0\org\apache\jsp\index_jsp.java:56: error: cannot find symbol
        GoogleMemcache x = new GoogleMemcache();
        ^
  symbol:   class GoogleMemcache
  location: class index_jsp
C:\Users\lsarni\AppData\Local\Temp73963375861-0\org\apache\jsp\index_jsp.java:56: error: cannot find symbol
        GoogleMemcache x = new GoogleMemcache();
                               ^
  symbol:   class GoogleMemcache
  location: class index_jsp
3 errors

com.google.appengine.tools.admin.JspCompilationException: Failed to compile the generated JSP java files.
Unable to update app: Failed to compile the generated JSP java files.

日志说:

Unable to update:
com.google.appengine.tools.admin.JspCompilationException: Failed to compile the generated JSP java files.
    at com.google.appengine.tools.admin.Application.compileJavaFiles(Application.java:1048)
    at com.google.appengine.tools.admin.Application.compileJsps(Application.java:1001)
    at com.google.appengine.tools.admin.Application.populateStagingDirectory(Application.java:776)
    at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:708)
    at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:570)
    at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:57)
    at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute(AppCfg.java:1490)
    at com.google.appengine.tools.admin.AppCfg.executeAction(AppCfg.java:357)
    at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:218)
    at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:119)
    at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:115)
com.google.appengine.tools.admin.AdminException: Unable to update app: Failed to compile the generated JSP java files.
    at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:578)
    at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:57)
    at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute(AppCfg.java:1490)
    at com.google.appengine.tools.admin.AppCfg.executeAction(AppCfg.java:357)
    at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:218)
    at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:119)
    at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:115)
Caused by: com.google.appengine.tools.admin.JspCompilationException: Failed to compile the generated JSP java files.
    at com.google.appengine.tools.admin.Application.compileJavaFiles(Application.java:1048)
    at com.google.appengine.tools.admin.Application.compileJsps(Application.java:1001)
    at com.google.appengine.tools.admin.Application.populateStagingDirectory(Application.java:776)
    at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:708)
    at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:570)
    ... 6 more

这是我项目的结构,我不确定放置 class GoogleMemcache 是否正确。

从 Netbeans 清理和构建工作正常。

这是index.jsp中的代码:

<%@page import ="Memcache.GoogleMemcache" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
        GoogleMemcache x = new GoogleMemcache();
        %>
    </body>
</html>

我尝试了类似问题的不同答案,但没有成功。

不使用 scriplet 标记来声明对象 x

<%  GoogleMemcache x = new GoogleMemcache(); %>

使用声明性标签

<%!  GoogleMemcache x = new GoogleMemcache(); %>

最后我试图部署错误的文件夹:

appcfg update C:\Users\lsarni\Documents\NetBeansProjects\TestMemcache\web

应该是:

appcfg update C:\Users\lsarni\Documents\NetBeansProjects\TestMemcache\build\web

我意识到这是错误的,因为它缺少一个 META-INF 文件夹,所以它与 this answer

中描述的不匹配