2016-09-15 69 views
0

我正在使用Neatbeans将简单项目部署到GAE,我设法部署了“空白”项目,但现在我添加了一个类,出现错误。无法编译生成的JSP Java文件

当我运行: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类,那么这是正确的。

enter image description here

清洁,并建立从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> 

我已经尝试了不同的答案,我发现类似的问题,没有任何运气。

回答

0

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

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

应该是:

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

我意识到那是因为它缺少一个META-INF文件夹,以便它不匹配this answer

0

而不是使用scriplet标记为对象的声明X

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

使用声明标签

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

描述的我改变了,但错误仍然存​​在错了 – moondaisy