0

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

当我运行时: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\Temp\1473963375861-0\org\apache\jsp\index_jsp.java:6: error: package Memcache does not exist
import Memcache.GoogleMemcache;
               ^
C:\Users\lsarni\AppData\Local\Temp\1473963375861-0\org\apache\jsp\index_jsp.java:6: error: package Memcache does not exist
import Memcache.GoogleMemcache;
               ^
C:\Users\lsarni\AppData\Local\Temp\1473963375861-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\Temp\1473963375861-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

这是我项目的结构,我不确定将类 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>

我已经尝试了对类似问题找到的不同答案,但没有任何运气。

4

2 回答 2

0

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

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

使用声明性标签

<%!  GoogleMemcache x = new GoogleMemcache(); %>
于 2016-09-16T07:04:23.600 回答
0

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

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

本来应该:

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

我意识到那是错误的,因为它缺少一个文件夹,因此与此答案META-INF中描述的不匹配

于 2016-09-20T18:10:50.727 回答