Google App Engine - Failed to compile the generate

2020-02-28 00:08发布

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.

7条回答
三岁会撩人
2楼-- · 2020-02-28 00:48

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

查看更多
你好瞎i
3楼-- · 2020-02-28 00:58

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.

查看更多
Lonely孤独者°
4楼-- · 2020-02-28 01:00

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.

查看更多
你好瞎i
5楼-- · 2020-02-28 01:00

If you use a JSP include you must make sure that the JSP file, which you include in other files, has all the proper imports, even if everything seems to work well in the test environment.

For example, if you have a file called inc.jsp and in other files you include it like so:

<%@include file="inc.jsp" %>

Then inside inc.jspyou must make sure all the proper imports are there even if the compiler hasn't explicitly complained about it.

An easy way to find the errors in an include JSP is to try and open it in a browser when running the development server. You'll see the JSP errors that the compiler didn't tell you about there.

This is one reason I found for the error mentioned in the question.

查看更多
女痞
6楼-- · 2020-02-28 01:02

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.

查看更多
劳资没心,怎么记你
7楼-- · 2020-02-28 01:09

Just Make Sure that all jsp files run on local so for that you can try to run and/or test all jsp files on your local. Their must be error in any of the jsp file.

I got solved this problem in this way.

I only have error in one jsp file but it show the same error for all jsp files so don't worry about all files.

查看更多
登录 后发表回答