GAE: how to migrate appengine.api for Java8 to google cloud datastore for Java11

307 views
Skip to first unread message

Han Ju Kim

unread,
Nov 26, 2019, 5:45:17 PM11/26/19
to Google App Engine
Hi all,

I'm trying to keep up with my GAE standard webserver solution to latest one. Mainly Java8 to Java11. One of my package use the standard google appengine as described 

When I try to migrate my solution to Java11, my solution encountered many errors indicating some of Java file is not compatible with new Java11 binary as following

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /D:/workspace/FastGPS_Webapp_J11/vosao/api/src/main/java/org/vosao/global/SystemService.java:[31,34] cannot find symbol
  symbol:   class DatastoreService
  location: package com.google.cloud.datastore
[ERROR] /D:/workspace/FastGPS_Webapp_J11/vosao/api/src/main/java/org/vosao/global/SystemService.java:[66,9] cannot find symbol
  symbol:   class DatastoreService
  location: interface org.vosao.global.SystemService
[ERROR] /D:/workspace/FastGPS_Webapp_J11/vosao/api/src/main/java/org/vosao/entity/TemplateEntity.java:[28,34] cannot find symbol
  symbol:   class Text
  location: package com.google.cloud.datastore
[ERROR] /D:/workspace/FastGPS_Webapp_J11/vosao/api/src/main/java/org/vosao/entity/StructureEntity.java:[38,34] cannot find symbol
  symbol:   class Text
  location: package com.google.cloud.datastore
[ERROR] /D:/workspace/FastGPS_Webapp_J11/vosao/api/src/main/java/org/vosao/entity/FormConfigEntity.java:[26,34] cannot find symbol
  symbol:   class Text
  location: package com.google.cloud.datastore
[ERROR] /D:/workspace/FastGPS_Webapp_J11/vosao/api/src/main/java/org/vosao/utils/EntityUtil.java:[38,34] cannot find symbol
  symbol:   class Text
  location: package com.google.cloud.datastore
[INFO] 6 errors 

My solution is quite old and use appengine.api and objectify 5, but I would like to move to google cloud storage API and objectify 6. These are the classes generate compile errors or used in com.google.appengine.api.*, but removed latest google cloud datastore api. If there are any tip or workaround, it will be appreciated.

com.google.appengine.api.DatastoreService
com.google.appengine.api.Text
com.google.appengine.api.PreparedQuery
com.google.appengine.api.FilterOperator
com.google.appengine.api.SortDirection
com.google.appengine.api.DatastoreServiceFactory
com.google.appengine.api.EntityNotFoundException
com.google.appengine.api.FetchOptions
com.google.appengine.api.QueryResultList
com.google.appengine.api.AsyncDatastoreService
com.google.appengine.api.CachingDatastoreServiceFactory
com.google.appengine.api.QueryResultIterator
com.google.appengine.api.GeoPt
com.google.appengine.api.Entities
com.google.appengine.api.CompositeFilterOperator
com.google.appengine.api.Filter
com.google.appengine.api.FilterPredicate
com.google.appengine.api.DatastoreAttributes
com.google.appengine.api.Index
com.google.appengine.api.KeyRange
com.google.appengine.api.TransactionOptions
com.google.appengine.api.IndexState
com.google.appengine.api.CachingTransaction

Thanks in advanced,

Elliott (Cloud Platform Support)

unread,
Nov 26, 2019, 6:26:54 PM11/26/19
to Google App Engine
Hello Han,

Please note that Google Groups are reserved for general Google Cloud Platform and product discussions and not for technical issues, which is why I suggest moving the troubleshooting to Stackoverflow, where you may receive advice from our programming community.

Han Ju Kim

unread,
Nov 26, 2019, 7:09:30 PM11/26/19
to Google App Engine
Hi Elliott,

I appreciate your guide, however this is is not clearly described even stackoverflow [appengine] quite well. My solution run quite well in Java8, however I love to migrate that to latest on for Java11 and google cloud. It's a library provided from Google Cloud without any kind description on migration. When I deployed Java11, it generated lots of error like above. The google document for Java 11 and Datastore just say that it will be automatically migrated internally. However, nothing can be found anywhere.
There may be many developer experiencing same stuff. Is it too early to consider to migrate Java11? 

Linus Larsen

unread,
Dec 17, 2019, 3:31:50 AM12/17/19
to Google App Engine
Hi

The gcloud sdk has different package names for the datastore classes, ex: com.google.cloud.datastore.Cursor.
I think you'll need to import the cloud datastore classes / client api. Check the bookshelf example app pom / parent pom.

Han Ju Kim

unread,
Dec 17, 2019, 7:19:37 PM12/17/19
to Google App Engine
Hi Linus,

I appreciate kind advice. I also tried to look the example project. The issue is that my existing app engine built on datastore since 2011 and Google announce that datastore will automatically migrate to Firestore. So there are no user's requirement to do. When I try to deploy existing code after modifying compatible with Open JDK 11, it generate lots of error regarding datatore service and more. I can not find any material in google app engine document to resolve this. 

Remko Tronçon

unread,
Dec 18, 2019, 3:24:57 AM12/18/19
to Google App Engine

I appreciate kind advice. I also tried to look the example project. The issue is that my existing app engine built on datastore since 2011 and Google announce that datastore will automatically migrate to Firestore. So there are no user's requirement to do. When I try to deploy existing code after modifying compatible with Open JDK 11, it generate lots of error regarding datatore service and more. I can not find any material in google app engine document to resolve this. 

AFAIK, Java 11 is a 2nd gen runtime, and the internal APIs are no longer available on these runtimes.


Remko
Reply all
Reply to author
Forward
0 new messages