We received an email from Google App Engine to upgrade to Java 8 from Java 7. We have followed the steps in:
https://cloud.google.com/appengine/docs/standard/java/migrating-to-java8
But after deploying our App Engine back-end it fails to start with the following error:
org.datanucleus.metadata.MetaDataManager initialiseFileMetaDataForUse: Found Meta-Data for class ... but this class is not enhanced!! Please enhance the class before running DataNucleus. (MetaDataManager.java:1144) org.datanucleus.exceptions.NucleusUserException: Found Meta-Data for class ... but this class is not enhanced!! Please enhance the class before running DataNucleus. at org.datanucleus.metadata.MetaDataManager.initialiseClassMetaData(MetaDataManager.java:2593) at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaData(MetaDataManager.java:2544) at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:1140) at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:986) at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:754) at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:417) at org.datanucleus.api.jpa.JPAEntityManagerFactory.(JPAEntityManagerFactory.java:380) at org.datanucleus.api.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:91) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:70)
This is our build.gradle:
buildscript { // Configuration for building
repositories {
mavenCentral()
jcenter() // Bintray's repository - a fast Maven Central mirror & more
}
dependencies {
// App Engine Gradle plugin
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
}
}
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'java'
apply plugin: 'war'
//apply plugin: 'appengine'
apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
appengine { // App Engine tasks configuration
deploy { // deploy configuration
version = findProperty("appengine.deploy.version")
def promoteProp = findProperty("appengine.deploy.promote")
if (promoteProp != null) {
promote = new Boolean(promoteProp)
}
}
}
configurations {
compile.exclude module: 'guava-jdk5'
}
dependencies {
implementation 'jstl:jstl:1.2'
implementation group: 'com.google.appengine', name: 'appengine-api-1.0-sdk', version: '+'
implementation group: 'com.google.endpoints', name: 'endpoints-framework', version: '+'
implementation 'com.google.appengine.orm:datanucleus-appengine:+' //2.1.2'
implementation 'javax.servlet:servlet-api:2.5'
implementation 'javax.inject:javax.inject:1'
implementation 'javax.transaction:jta:1.1'
implementation 'com.ganyo:gcm-server:1.0.2'
implementation 'org.json:json:20140107'
implementation 'org.apache.httpcomponents:httpmime:+'
implementation 'org.apache.geronimo.specs:geronimo-jpa_2.0_spec:1.0'
// Persistence
// implementation 'org.ow2.asm:asm:4.0'
implementation 'javax.jdo:jdo-api:+' //3.0.1'
implementation 'org.datanucleus:datanucleus-api-jpa:3.1.3'
implementation 'org.datanucleus:datanucleus-api-jdo:3.1.3' //5.0.1'
implementation 'org.datanucleus:datanucleus-enhancer:+' //3.1.1'
implementation 'org.datanucleus:datanucleus-core:3.1.3'
implementation 'org.hibernate:hibernate-validator:5.2.4.Final'
implementation 'com.google.api-client:google-api-client:+'
implementation 'com.google.api-client:google-api-client-android:+'
implementation 'com.google.http-client:google-http-client:+'
implementation 'com.google.http-client:google-http-client-android:+'
}
task datanucleusEnhance {
description "Enhance JPA model classes using DataNucleus Enhancer"
dependsOn compileJava
doLast {
// define the entity classes
def entityFiles = fileTree(sourceSets.main.output.classesDir).matching {
include '/*.class'
}
println "Enhancing with DataNucleus the following files"
entityFiles.getFiles().each {
println it
}
// define Ant task for DataNucleus Enhancer
ant.taskdef(
name : 'datanucleusenhancer',
classpath : sourceSets.main.runtimeClasspath.asPath,
// classname : 'org.datanucleus.enhancer.EnhancerTask'
// the below is for DataNucleus Enhancer 3.1.1
classname : 'org.datanucleus.enhancer.tools.EnhancerTask'
)
// run the DataNucleus Enhancer as an Ant task
ant.datanucleusenhancer(
classpath: sourceSets.main.runtimeClasspath.asPath,
verbose: true,
api: "JDO") {
entityFiles.addToAntBuilder(ant, 'fileset', FileCollection.AntType.FileSet)
}
}
}
classes.dependsOn(datanucleusEnhance)
This works as soon as we switch back to Java 7.