Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine - Failed to compile the generated JSP java files

My project works fine locally, but when trying to deploy it to the GAE servers, I get the following error message:

Unable to update app: Failed to compile the generated JSP java files.

This happened mainly when I switched from Java 7 to Java 6, since apparently GAE doesn't support that yet. I am using GAE 1.7.4, is this a known problem? What is wrong with the project? Is it syntax within the JSPs? They used to compile before I starting using GAE 1.7.4, but I don't know the exact cause of when this started.

like image 534
theeggman85 Avatar asked Feb 01 '13 02:02

theeggman85


5 Answers

I have been having the same problem and was convinced that there was a GAE problem. However, now I realize that I had changed the name of a .java file referenced by a couple of my .jsp files and the file name had not gotten changed in the .jsp. After I fixed the file name in the .jsp deployment worked normally again. Arrgh.

I think before GAE started compiling the JSP files, JSP files with errors would deploy successfully. Also, when running locally, the JSP are apparently not compiled until they are accessed, so unless all the JSP files are tested locally, you may not know of the error. But if you try to deploy, the JSP compilation fails and the deploy is aborted. Unfortunately, there is no sensible error message to suggest where the problem was found.

like image 128
user1536633 Avatar answered Oct 03 '22 15:10

user1536633


I try to recompile java files on eclipse again and check the errors.
I think this is better way to check it.

This is my blog for the detail.
http://nurinamu.tumblr.com/post/62384368766/how-to-detect-the-jsp-compile-error-when-deploy-to

like image 23
nurinamu Avatar answered Oct 03 '22 15:10

nurinamu


I had this same issue. I had changed the method signature of a method that was called by a JSP I didn't normally go to. So when running locally everything worked fine because I never went to the problematic JSP.

The way to resolve this is to run locally and go to every single JSP in your project. Eventually I got to a JSP that gave me a full stack trace locally in my browser window. When I fixed the error in that JSP I was again able to deploy to app engine production.

It would be better if GAE was able to report which JSP is failing, but this technique will work.

like image 22
Mark Scheel Avatar answered Oct 03 '22 13:10

Mark Scheel


I was running in the same issue. Yes the error your get in Eclipse and in the log is really unhelpful, but wanted to share that deploying to the local dev server instead gave a very helpful error message, e.g. in my case:


HTTP ERROR 500

Problem accessing /. Reason:

Unable to compile class for JSP:

An error occurred at line: 286 in the jsp file: /dashboard.jsp

Duplicate local variable datastore

283:   </head>
284:   <body onload="initialize()">
285:     <%
286:     DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
287: 
288:     UserService userService = UserServiceFactory.getUserService();
289:     User user = userService.getCurrentUser();

Saved a big headache.

like image 33
msm Avatar answered Oct 03 '22 13:10

msm


nurinamu's answer is ok but it didn't work for me because my project was too complex and I wasn't able to resolve the errors I got from linking the source folder generated in the appengine staging area. However I did manage to fix my problem!

This method is a bit of a pain but in a worst case scenario: move the JSPs out of your project and do a test deploy until you narrow down and find which JSP is causing the issue.

This was really the only way I could figure out what was causing the problem.

UPDATE

For me the error was a rogue import that wasn't supported by appengine.

like image 30
Emperorlou Avatar answered Oct 03 '22 14:10

Emperorlou