2016-09-15 39 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