epeleg
epeleg

Reputation: 10945

"Unable to update app: Failed to compile the generated JSP java files." when trying to deploy GAE App

I did my reading before posting
I know there are quite a few questions on this issue.
I have read all those that I could find but non of the issues and suggestions there helped.

My environment
windows 7 64bit GAE SDK 1.8.8 version 1.7.0_45 of the JDK eclipse kepler 4.3.1 + google plugin.

Stuff I tried already
Here are the things I have already tried:
1) changed system variable JAVA_HOME to point to C:\Program Files\Java\jdk1.7.0_45
2) ensured the system variable PATH contains C:\Program Files\Java\jdk1.7.0_45\bin
3) when opening a command window and running both java -version and javac -version I get:

   C:\Users\epeleg>java -version
   java version "1.7.0_45"
   Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
   Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

   C:\Users\epeleg>javac -version
   javac 1.7.0_45

4) checked that all my JSP pages (there are only 2) are working properly when used in development server

5) modified C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin\appcfg.cmd so that the command inside it starts with @%JAVA_HOME%\bin\java ... instead of java...

6) I opened the Markers Pane (eclipse: window - show view - other... General--Markers) and fixed all the Java issues that where mentioned there no matter how trivial they seemed.

What the logs show The Deploy process reports:

Preparing to deploy:
    Created staging directory at: 'C:\Users\epeleg\AppData\Local\Temp\appcfg1552018719531070310.tmp'
    Scanning for jsp files.
    Compiling jsp files.
com.google.appengine.tools.admin.JspCompilationException: Failed to compile the generated JSP java files.
ינו 13, 2014 3:20:30 PM org.apache.jasper.JspC processFile
INFO: Built File: \myFirstJSP.jsp
ינו 13, 2014 3:20:30 PM org.apache.jasper.JspC processFile
INFO: Built File: \mySecondJSP.jsp


Debugging information may be found in C:\Users\epeleg\AppData\Local\Temp\appengine-deploy4888568219008828635.log

The "Staging directory" seems o.k. (but maybe there are missing libraries there ?!) and the log file contains the following text:

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:840) at com.google.appengine.tools.admin.Application.compileJsps(Application.java:801) at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:615) at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:418) at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:55) at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:433) at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:158) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

My Questions
1) looking for ideas regarding what else I can try
2) Is there a way to simulate the compile from a command window directly on the staging folder so that I might hopefully see an actual helpful error message?
3) The error says Failed to compile the generated JSP java files - where are those generated files supposed to be?
4) Is there a way to run appcfg.cmd directly from the command line (and with what parameters) so that I can see its output (assuming that the plugin is hiding some stuff from me...).

Upvotes: 3

Views: 3568

Answers (1)

epeleg
epeleg

Reputation: 10945

Problem solved

Here is what I did to resolve this, hopefully it will help others that have similar issues.

I decided to try and run the upload from the command line instead of using the plugin for it. And here is what I got:
[note that I added rem to the @echo off command and also removed the @ from the begining of the java command in appcfg.cmd so that all the commands would echo to the console]

C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>appcfg.cmd update "X:\path\to\my\project\war"
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem @echo off
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem Copyright 2009 Google Inc. All Rights Reserved.
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem Launches the AppCfg utility, which allows Google App Engine
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem developers to deploy their application to the cloud.
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>C:\Program Files\Java\jdk1.7.0_45\bin\java -Djava.home="C:\Program Files\Java\jdk1.7.0_45\jre" -Xmx1100m -cp "C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin\\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg update "X:\path\to\my\project\war"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

OK, so I edited appcfg.cmd again and changed its last line to look like this:

"%JAVA_HOME%\bin\java" -Djava.home="%JAVA_HOME%\jre" -Xmx1100m -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*

Try again:

C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>appcfg.cmd update "X:\path\to\my\project\war"
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem @echo off
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem Copyright 2009 Google Inc. All Rights Reserved.
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem Launches the AppCfg utility, which allows Google App Engine
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>rem developers to deploy their application to the cloud.
C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin>"C:\Program Files\Java\jdk1.7.0_45\bin\java" -Djava.home="C:\Program Files\Java\jdk1.7.0_45\jre" -Xmx1100m -cp "C:\Program Files\GAE\appengine-java-sdk-1.8.8\bin\\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg update "X:\path\to\my\project\war"
Θ≡σ 13, 2014 5:17:12 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Reading application configuration data...
Θ≡σ 13, 2014 5:17:13 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed X:/path/to/my/project/war\WEB-INF/appengine-web.xml
Θ≡σ 13, 2014 5:17:13 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed X:/path/to/my/project/war\WEB-INF/web.xml
Θ≡σ 13, 2014 5:17:13 PM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml
INFO: Successfully processed X:/path/to/my/project/war\WEB-INF\appengine-generated\datastore-indexes-auto.xml

Beginning interaction for module default...
Email: [email protected]
Password for [email protected]:
0% Created staging directory at: 'C:\Users\epeleg\AppData\Local\Temp\appcfg8197335956386755707.tmp'
5% Scanning for jsp files.
8% Compiling jsp files.
C:\Users\epeleg\AppData\Local\Temp\1389626267515-0\org\apache\jsp\myFirstJSP_jsp.java:6: error: package com.mycompany does not exist
import com.mycompany.*;
^
C:\Users\epeleg\AppData\Local\Temp\1389626267515-0\org\apache\jsp\mySecondJSP_jsp.java:6: error: package com.mycompany does not exist
import com.mycompany.*;
^
C:\Users\epeleg\AppData\Local\Temp\1389626267515-0\org\apache\jsp\myFirstJSP_jsp.java:6: error: package com.mycompany does not exist
import com.mycompany.*;
^
C:\Users\epeleg\AppData\Local\Temp\1389626267515-0\org\apache\jsp\mySecondJSP_jsp.java:6: error: package com.mycompany does not exist
import com.mycompany.*;
^
2 errors

Error Details:
Θ≡σ 13, 2014 5:17:48 PM org.apache.jasper.JspC processFile
INFO: Built File: \myFirstJSP.jsp
Θ≡σ 13, 2014 5:17:48 PM org.apache.jasper.JspC processFile
INFO: Built File: \mySecondJSP.jsp

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.
Please see the logs [C:\Users\epeleg\AppData\Local\Temp\appcfg6545644664045561868.log] for further information.

So I went to my JSP's, removed the offending import attribute from the page tag, tryed again and this time it worked.

Now, I don't know why the plugin fails to display the most important lines in appcfg.cmd's output, but to me it feels like some sort of a bug.

Two lines Summary
run <path-to-appengine-java-sdk>\bin\appcfg.cmd update <war-location> in a command window, it will provide you with a more detailed output then the plugin does and will most likely enable you to resolve the problem in a matter of minutes.

If that fails you are welcome to follow all the steps I mentioned in the questions body, hey seem to have helped other people in the past.

Upvotes: 2

Related Questions