Application does not update after deployment in Ap

2019-04-24 22:20发布

I have just started with GAE and I have already encountered problems on the way. When I deploy an app, it does not seem to be updating it and when I run it in the browser, it still runs the old version.

My simple code is:

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class AppEngineProjectServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
    resp.setContentType("text/html");
    resp.getWriter().println("<p>Hi there</p>");
}

}

I have created a new web application project in Eclipse and I got that code. I have just changed the text from 'Hello World' to 'Hi there' and when I deploy it, it still runs Hello World!

I also try changing versions of the app when deploying and setting the new version to default but nothing seems to work for me. Is there any particular reason why is that happening that I might have overlooked?

3条回答
We Are One
2楼-- · 2019-04-24 22:58

If you want to see your changes immediately after uploading, change the application's version, then change the default in the admin console.

When you update, App Engine doesn't immediately hunt down and restart all of your instances. Such a thing would be traumatic for the users of large apps with many instances, especially when that app's instances are slow to start up.

查看更多
闹够了就滚
3楼-- · 2019-04-24 23:03

Same thing happened to me with the new Eclipse 2018-09 and the new Google Cloud Platform that is replacing the super GDT Pulldown which worked well for so many years.

It is not about refresh Browser and super Google server stuff - it is a date mismatch between local computer and server becouse GCP is telling you what he worked :

  • after I deleted the classes directory it gave me a warning that classes are not there so !!!!! no automatic build like the previous Gooogle tools
  • then, after my manual rebuild, he stated the following

#= Uploading 0 files to Google Cloud Storage =#

ZERO Uploads !

No matter what you change in the java programs if he decided that the file is already there there is no data transfer

So I started to do workarounds

  • change app version (becouse he even finds deleted versions :-) and still transfer zero files :-) to a deleted version that is reactivated with old files :-) after zero filed transfered)
    • manualy update some javascript from smartgwt which he do not recompute like the other old package did (this is super tricky to modify manualy obfuscated java from smartgwt)
    • welcome to progress and updates :-(
查看更多
狗以群分
4楼-- · 2019-04-24 23:08

After a long chat session the OP problem has been solved.

Major points:

  1. Always test your app locally (using the Development Server) before deploying to the cloud
  2. Look out for browser caching issues (use Ctrl+F5 to refresh and discard local cache)
  3. If you want to mitigate the risk of breaking production, change the application version before deploying to the cloud
  4. After the deploy, check your application administrative console on GAE
    1. Under Administration -> Admin Logs check for a new entries like "Deployed a new version"
    2. Under Main -> Versions make sure to visit the recent deployed version Live URI [version].[app-name].appspot.com).
    3. Again, make sure that browser caching is not getting in the way (Ctrl+F5 is your friend)
  5. Also, to avoid runtime exceptions, if you updated your persistence layer in such a way that new indexes needs to be built, check Data -> Datastore Indexes to make sure that no index is still building (this can take hours or even days).
  6. When you are done testing (make sure that the Live URI version is working properly) just make the new version default (under Main -> Versions).
  7. It is advisable to do some A/B testing. GAE has a built in support for Traffic Splitting. Do not jump the gun and promote a new version to default before you are feeling 100% sure that it works as expected (200% actually). While you can always change the default version to a previous one, your users will not be happy if you rollback (trust me... been there, done that).
查看更多
登录 后发表回答