迁移JDO项目,以谷歌的云终端V2,服务器返回的NoClassDefFoundError

juanmeanwhile:

我试图迁移使用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集合在终端使用)。我在这里失去了一点,这样的帮助实在是欢迎。

谢谢!

Ying Li :

在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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

出现labix.org/v2/mgo错误远程服务器意外关闭了连接

你可以通过触发事件火力谷歌的云功能没有服务器?

在无服务器项目中如何/在何处运行迁移迁移?

如何在谷歌云平台上创建聊天(Websocket)服务器

部署云服务器难吗?

处理的StorageException之后,Azure Function v2始终返回内部服务器错误500

Azure Function v2 Web Deploy遇到服务器连接问题,必须终止连接

当尝试在Azure Data Factory V2中添加动态文件名(链接服务器)时遇到错误

PHP API无法在apache2 Ubuntu服务器上与Django配合使用| 谷歌云

Traefik v2反向代理到Docker外部的本地服务器

使用IoT核心操作时使用AWS DynamoDB V2的服务器端时间戳?

使用traefik v2的docker-compose for portainer给出“失败:无法检索服务器设置和状态”

无法加载地图。与Android Google Maps API v2的Google服务器联系时发生错误

如何在HP ProLiant ML10 v2服务器上安装Ubuntu 16.04 LTS服务器

谷歌android maps v2 MetersToEquatorPixel

VNC到云服务器?

将QuincyKit服务器从2迁移到3

从终端启动apache2服务器

解析到Heroku迁移:解析服务器云代码不起作用

云服务器上的NodeJ

Google AppsScript 和 Drive API v2 - 以编程方式更改谷歌平台项目

部署在谷歌云平台与本地服务器上时,站点范围的字体不同

将服务的卷从 v2 迁移到 v3

谷歌云机器学习错误:无法启动 gRPC 服务器

通过 ADF V2 到 ADLS Gen2 的本地 SQL 服务器

谷歌 DNS 服务器

带有 nginx 的 Droplet 和谷歌云存储之间的状态 500 内部服务器错误

HTTPError 400 | 谷歌云平台将csv导入谷歌sql服务器(云sql)

非谷歌服务器上的 Firebase 云功能