我试图迁移使用JDO从端点V1到V2一个谷歌的云计算项目。我跟着迁移指南和这里的一些解决方案,以尽量使datanucleous插件增强我的课,并将其上传到谷歌的云,但没有运气。
我要发布的build.gradle其次是服务器返回的错误,当一个客户端试图连接到端点,这是一个NoClassFound错误。
的build.gradle:
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
// App Engine Gradle plugin
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
// Endpoints Frameworks Gradle plugin
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
}
}
repositories {
mavenCentral();
jcenter()
}
apply plugin: 'java'
apply plugin: 'war'
// [START apply_plugins]
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
// [END apply_plugins]
dependencies {
compile ('com.google.endpoints:endpoints-framework:2.0.8') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
compile 'javax.servlet:servlet-api:2.5'
compile 'com.ganyo:gcm-server:1.0.2'
compile 'javax.jdo:jdo-api:3.0.1'
compile 'org.datanucleus:datanucleus-core:3.1.3'
compile 'org.datanucleus:datanucleus-api-jdo:3.1.3'
compile 'org.datanucleus:datanucleus-accessplatform-jdo-rdbms:4.1.1'
compile 'com.google.appengine.orm:datanucleus-appengine:2.1.2'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.apache.commons:commons-lang3:3.5'
}
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
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)
}
}
}
endpointsServer {
// Endpoints Framework Plugin server-side configuration
hostname = "komilibro.appspot.com"
}
task datanucleusEnhance {
description "Enhance JDO model classes using DataNucleus Enhancer"
dependsOn processResources
doLast {
// define the entity classes
def entityFiles = fileTree(sourceSets.main.output.classesDir).matching {
include 'com/meanwhile/komi/head/**/*.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)
纵观服务器的用户登录请求后,我可以看到两个错误:第一:
org.datanucleus.store.types.TypeManagerImpl loadJavaTypes: User-defined type
mapping class "org.datanucleus.store.types.sco.simple.Collection" was not found.
Please check the mapping file class specifications and your CLASSPATH. The class
must be in the CLASSPATH.
这是第二个。PMF只是用来将PersistenceManager的负载和实例类。
com.google.api.server.spi.SystemService invokeServiceMethod: exception occurred while calling backend method (SystemService.java:375)
java.lang.NoClassDefFoundError: Could not initialize class com.meanwhile.komi.head.PMF
所以,好像需要的类不到位,也是TypeManagerImpl没有找到集合类(默认Java集合在终端使用)。我在这里失去了一点,这样的帮助实在是欢迎。
谢谢!
在gradle这个build文件添加此:
task datanucleusEnhance {
description "Enhance JDO model classes using DataNucleus Enhancer"
dependsOn compileJava
doLast {
// define the entity classes
def entityFiles = fileTree(sourceSets.main.output.classesDir).matching {
include 'com/mycom/*.class', 'org/myorg/*.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)
该entityFiles是你配置JPA实体注释类。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句