簡體   English   中英

無法編譯生成的JSP Java文件

[英]Failed to compile the generated JSP java files

我正在使用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>

我已經嘗試過對類似問題發現的不同答案,但沒有任何運氣。

而不是使用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文件夾,因此與該答案中所述的文件夾不匹配

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM