IOException: Changed index specification - google-app-engine

I am developing a GWT 2.5.1 and GAE/J 1.7.6 web app using Eclipse Juno/Google Plugin for Eclipse, and I am experimenting with the Search API. After an upgrade to the 1.7.6 GAE SDK the following started happening:
When the app is running in GAE Dev Mode and my index is populated,
it's subsequently programmatically accessible.
If the Dev Mode is
terminated and started again, programmatic access attempts fail (no results returned) as
follows:
SEVERE: Failed to access index
java.io.IOException: Changed index specification for description_index
at com.google.appengine.api.search.dev.LuceneDirectoryMap.getDirectory(LuceneDirectoryMap.java:198)
at com.google.appengine.api.search.dev.LuceneDirectoryMap$FileBased.getDirectory(LuceneDirectoryMap.java:64)
at com.google.appengine.api.search.dev.LocalSearchService.search(LocalSearchService.java:438)
Since the Search API is in development I would much rather use the SDK with the latest bugfixes and improvements. Does anyone have any suggestions regarding the cause of the exception?
Update
Fixed in App Engine SDK for Java release 1.7.7.1, available from the App Engine Downloads page.

Fix released in 1.7.7.1 SDK for Java. See here

Today, we found the same problem, our only possible fix on this moment was to change the appengine sdk for version 1.7.5 / 1.7.4.
I suppose there are significant changes coming, but until they're stable, we should not use or depend on it.

An issue has been opened for this in Google Code:
https://code.google.com/p/googleappengine/issues/detail?id=9088
If you believe this problem is important for you, and the workaround is not sufficient, then make sure to star the issue so that it gets escalated for repair.

Related

How to change the version of Jetty in my Google App Engine

Within IntelliJ I have a Google App Engine Standard Local Server running. I'm in the process of updating to Java 17 and also all of my 3rd party libraries and have moved to Jetty 11.0.11 in all of my project's pom files. However, when I start up the server I see:
INFO:oejs.Server:main: jetty-9.4.46.v20220331
and I'm getting failures that seem to confirm the above, that an older version of Jetty is being used.
Where can I update the Jetty version that the app engine uses?
Also, I'm using Google appengine 2.0.5
Here's the stack trace. The latest versions should be using jakarta.ws.rs.Path instead of javax.
java.lang.TypeNotPresentException: Type javax.ws.rs.Path not present
at
java.base/sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:47)
at
java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:89)
at jdk.proxy2/jdk.proxy2.$Proxy2.value(Unknown Source) at
org.eclipse.jetty.annotations.AnnotationConfiguration.createServletContainerInitializerAnnotationHandlers(AnnotationConfiguration.java:579)
at
org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:343)
at
org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:498)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)
at
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.server.Server.start(Server.java:423) at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at org.eclipse.jetty.server.Server.doStart(Server.java:387) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at
com.google.appengine.tools.development.jetty9.JettyContainerService.startContainer(JettyContainerService.java:366)
To update the Jetty version to the latest one, I would suggest updating the Cloud SDK to the latest version. Based on the documentation, the most recent release of Cloud SDK is version 395.0.0 (2022-07-26) and according to the release notes, the latest Java SDK version is 1.9.98 and latest Jetty version is 11.0.11
I would recommend trying to upgrade the Cloud SDK by following this documentation so the Jetty version is updated to the latest one.
EDIT: If you think it’s a valid feature request you may raise here with a clear description why you are thinking it’s a feature request. Good feature requests will solve common problems or enable new use cases.

Why does google app engine seem to use old code?

I've setup Google App Engine to run my AdonisJS API for my website. I update the code using the CLI for google cloud services ("gcloud app deploy"). I get a success message from the terminal, and I have checked both the cloud build and version number, and both are the most recent deployment. However, when I try to use my website, I get an error due to the API using old code and trying to access table columns from my database that no longer exist. I have downloaded the most recent cloud build file and checked the codebase within it and the updated code is there. I have also tried deploying multiple times, and it still is using the old code. Does anyone know why this is happening and/or how to fix this?
If you need more information, let me know. Thanks
ANSWER:
Fixed this a while ago, but wanted to update here just in case others ran into this. I discovered that when deploying to GAE through the command line, my build command wasn't running prior to the deploy since my script had an error, so it was uploading updated code, but not an updated build. So just make sure to run the build command prior to uploading to GAE and everything should work.
In console.cloud.google.com, go to your GAE project and check which version of your project is running I.e. which one is receiving traffic
Clear your cache.

DefaultClient scope migrating from App Engine (Go) 1.9 to 1.11

I've recently been migrating an App Engine (Go) app from Go 1.9 to 1.11. I've followed the steps in the
Migrating your App Engine app from Go 1.9 to Go 1.11 document, excluding the optional ones. I plan on doing the optional tasks later once I get this working.
I get the app to build and I can deploy it just fine. Most of everything works fine, with the exception of one API that is used to look up some info on a Google Play IAP. When I do that, I get the following error:
Error 403: Insufficient Permission: Request had insufficient authentication scopes., insufficientPermissions
I've checked, and the scope that I'm using is https://www.googleapis.com/auth/androidpublisher, which is still the scope listed in the Google Play Developer API documentation.
I'm using the App Engine default service account for the client by calling DefaultClient from the golang.org/x/oauth2/google library, which returns a client without an error
When I test the same code with Go 1.9, there are no authentication issues at all, and the API works. I'm guessing that these is something in the authentication setup which has changed but I can't find any documentation on it, nor on what I should do differently.
I have to imagine that a lot of people have had to do this migration, and I can't find any posts with this problem, so I'm lost as to why I'm getting it.
I think the issue is in the differences of runtime in Go 1.9 and 1.11. It doesn't seem to allow you to use Application Default Credentials anymore, you have to set them via a JSON file in 1.11. I found someone who had a very similar issue to you and they used a workaround by uploading a key and using that to get a Client.
Have a look here
Let me know.

Google App Engine not updating deployed files

I'm getting some strange issues with google app engine serving old versions of files. I have included some logging in one of my servlets and deployed to google app engine several times over the last 24 hours. However, instead of seeing the logging i added, I'm seeing logs from a previous version of the file every time the servlet runs.
I've tried changing versions and redeploying but this doesnt seem to fix the problem.
I'm using Eclipse Juno with the app engine plugin if that makes a difference.
Any ideas what I can try or what I might be doing wrong?
I had a similar problem recently, and that I fixed by logging into appengine.google.com>MyAppIdentifier>(Main)>Versions and selecting the current version as the default.
This should not only serve your latest version, but also use the latest version for log viewing and other administrative tasks.
In the logs, make sure that you're checking the correct version:
Otherwise redeploy to a brand new version and check that version explicitly directly from the version url that can be found under the Versions section.
Make sure that before redeploying your APP after making changes you Remove Launch and Remove All Terminated launches by pressing the double cross buttons next to the "clear console" buttons on the console window in Eclipse...I hope this solve your problem.
December 2020 Answer
Not sure if this is an account or billing specific setting, but I found that App Engine started not updating to my latest app deploy once I reached 50 Versions in my App Engine list.
After deleting a bunch of old versions (taking down to 30) on next deploy it picked up my latest changes immediately.
It could be due to caching issue. Try reloading the website by adding a query parameter . Eg <website-url>?q=1 and see if changes are reflected
Open the url -> latest-version-number-dot-website-url . Latest version number can be obtained by clicking on version menu item on the side bar as seen below
If you have app.yaml file in your source code. Try removing headers related to caching and deploy and check to confirm its a caching issue. Caching headers could be of below form
Cache-Control: public, max-age=604800, immutable
Also make sure your project compiles correctly and doesn't contain any errors. I had this problem basically because I was deploying old compiled code, while it gave me an error "you have errors in your project, are you sure you want to deploy?"
I tried all the suggestions on SO, but ultimately, I found the best fix.
Because I transferred domain names and web hosting, I neglected to change my Domain's Resource Records. After making sure my code worked properly with the application (appname.appspot.com), I created a Custom Domain found in Console menu > App Engine > Settings > Custom domains
After you add the custom domain, make sure you change your Domain setting's CNAME www alias to the prescribed value (for me it was ghs.googlehosted.com).
Since changing that CNAME value, all of my subsequent deploys updated immediately. Hope this works for you and all others. Happy coding!
The gcloud (at list in python) has problem with line 'skip_files' in app.yaml,
So you can try the old method of deploying app with app engine,
use appcfg.py instead of gcloud.
see how in https://cloud.google.com/appengine/docs/standard/python/tools/uploadinganapp

How can I turn an Eclipse GWT/GAE app into an Eclipse Tomcat/mySQL app?

Sorry in advance for the long post but the problem I am facing here is quite crucial for me, so here we go...
I have a Eclipse GWT (2.0) Web Application using the the GAE and making transactions with its datastore.
On the other hand I would like to make sure that I can also deploy this web application on another infrastructure than the Google App Engine. Therefore I wanted to debug my web app using another servlet container (Tomcat 6) and another datastore (mySQL or MSSQL or any other, it doesn't really matter for now.)
In order to be able to debug an Eclipse web app with Tomcat it has to carry the Dynamic Web Project facet. If it doesn't then the new server that I add to Eclipse within Servers refuses to pick my GWT module in its list of supported apps. And not only GWT Web Apps don't carry it, but they don't even allow to alter the project's facets at all!
However, I found that adding the few relevant tags to the .project file can make it eligible within Eclipse to allow new project facets additions. Here are the tags I used:
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.appengine.eclipse.core.gaeNature</nature>
So I did that, I could "turn" the project into an Eclipse's Dynamic Web Project and by doing so made it compliant to be added to the list of modules handled by - let's say - Tomcat 6 within Servers.
So that is exactly what I wanted, I can now switch between two debug configurations at will in Eclipse in order to debug my GWT web app either on the App Engine or on Tomcat.
The problem is that adding the Dynamic Web Project facet disturbs the DataNucleus enhancer. For some reason, once the project has become a Dynamic Web Project, it seems that the enhancer is never called anymore and I get this error message saying that some classes haven't been enhanced. Playing with the Google... App Engine... ORM classes or checking/unchecking the Enhancer in Builders wouldn't change anything. Please note that the enhancer issue affects both debug configurations: Tomcat as well as the App Engine.
So I was thinking of two solutions.
(1) Disable the Google plugin's DataNucleus enhancer and perform the enhancements myself. So I installed the DataNucleus plugin to configure project specific enhancements by following their guide about the Eclipse plugin.
They say that by right-clicking on the project one can activate DataNucleus support for the given project's files. Unfortunately, after installing the latest version of their plugin for Eclipse, no such right-click menu appears! I have therefore no way to tell their plugin that I want to activate the enhancements on a given project! How frustrating is that?? (I uninstalled/reinstalled the plugin, let perform plenty of pending Eclipse updates... but still no right-click menu.)
Does anyone know of another way to activate DataNucleus enhancement? For now I would be happy even with a pretty manual trick as it is very critical for me to be able to perform this cross-servlet container debugging within Eclipse.
(2) Use this tip from the official GWT website http://code.google.com/webtoolkit/doc/latest/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT%27s
Ok that works, and for now let's say that it saves my life BUT... it requires hosted mode and therefore doesn't allow the use of GWT 2.0.
So regarding this workaround I would like to know if there is a way to do something similar under GWT 2.0?
Turning the GWT Web App into a Eclipse Dynamic Web Project would be the ideal solution for pursuing the development of my application. As I said above, that way, it is very convenient to switch from the App Engine to Tomcat and vice versa. So I favour workaround (1) over workaround (2). But anyway, some help or piece of advice regarding any of the two points will be very very welcome.
Thank you for reading this very long post!
I always use Google Plugin (GPE) for GWT development even when I deploy to Tomcat, where I simply disable GAE option.
Perhaps, I don't understand the question - but I have had no problems debugging my app running on jetty and then transferring the app to Tomcat. Are there any issues that I need to learn?
In fact, even when my app is plain jsp or servlets, without any GWT, I still used GPE. But GPE would refuse to run jetty without either GWT or GAE enabled. So I simply create a dummy GWT app. In all my years, I had never had to worry about differences between jetty and tomcat. And if I had to write an app where I had to exploit the differences in tomcat over jetty, I would consider myself a lousy programmer.
The only reason I see to push JEE server into an external server, is for profiling the app as it runs on tomcat.
JEE is JEE, whether Tomcat or Jetty. I have heard that some people have a bias against using Jetty, like preferring starbucks over neighbourhood cafe. Coffee is coffee.
I don't understand. May be you could write another thesis to explain why you cannot debug on jetty and then deploy on tomcat.
I ran into the exact same problem, I could edit the properties of my project and see the datanucleus menu in the context so the plugin was definitely working. My issue was I was using the "Java EE" perspective in eclipse. (Juno btw). I switched to the "Java" context and my datanucleus menu was back and I was able to enable support and enable automatic enhancement.
Window -> Show perspective -> Other -> Java

Resources