在使用https://predictionio.apache.org/templates/classification/quickstart/的示例推荐模型时,在ubuntu中创建了一个docker容器

pio构建成功,但是pio训练步骤失败,并出现以下错误

    [INFO] [Engine$] Using command '/tmp/PredictionIO-0.14.0/sbt/sbt' at /tmp/predictionio-template-attribute-based-classifier to build.
[INFO] [Engine$] If the path above is incorrect, this process will fail.
[INFO] [Engine$] Uber JAR disabled. Making sure lib/pio-assembly-0.14.0.jar is absent.
[INFO] [Engine$] Going to run: /tmp/PredictionIO-0.14.0/sbt/sbt  package assemblyPackageDependency in /tmp/predictionio-template-attribute-based-classifier
[INFO] [Engine$] Compilation finished successfully.
[INFO] [Engine$] Looking for an engine...
[INFO] [Engine$] Found template-scala-parallel-classification_2.11-0.1.0-SNAPSHOT.jar
[INFO] [Engine$] Found template-scala-parallel-classification-assembly-0.1.0-SNAPSHOT-deps.jar
[INFO] [Engine$] Build finished successfully.
[INFO] [Pio$] Your engine is ready for training.
root@e82455a7d959:/tmp/predictionio-template-attribute-based-classifier# pio train
[WARN] [WorkflowUtils$] Environment variable MYSQL_JDBC_DRIVER is pointing to a nonexistent file /tmp/PredictionIO-0.14.0/lib/mysql-connector-java-5.1.41.jar. Ignoring.
[INFO] [Runner$] Submission command: /tmp/PredictionIO-0.14.0/vendors/spark-2.4.0-bin-hadoop2.7/bin/spark-submit --class org.apache.predictionio.workflow.CreateWorkflow --jars file:/tmp/PredictionIO-0.14.0/lib/postgresql-42.2.9.jar,file:/tmp/predictionio-template-attribute-based-classifier/target/scala-2.11/template-scala-parallel-classification_2.11-0.1.0-SNAPSHOT.jar,file:/tmp/predictionio-template-attribute-based-classifier/target/scala-2.11/template-scala-parallel-classification-assembly-0.1.0-SNAPSHOT-deps.jar,file:/tmp/PredictionIO-0.14.0/lib/spark/pio-data-localfs-assembly-0.14.0.jar,file:/tmp/PredictionIO-0.14.0/lib/spark/pio-data-hdfs-assembly-0.14.0.jar,file:/tmp/PredictionIO-0.14.0/lib/spark/pio-data-jdbc-assembly-0.14.0.jar,file:/tmp/PredictionIO-0.14.0/lib/spark/pio-data-elasticsearch-assembly-0.14.0.jar,file:/tmp/PredictionIO-0.14.0/lib/spark/pio-data-hbase-assembly-0.14.0.jar,file:/tmp/PredictionIO-0.14.0/lib/spark/pio-data-s3-assembly-0.14.0.jar --files file:/tmp/PredictionIO-0.14.0/conf/log4j.properties --driver-class-path /tmp/PredictionIO-0.14.0/conf:/tmp/PredictionIO-0.14.0/lib/postgresql-42.2.9.jar:/tmp/PredictionIO-0.14.0/lib/mysql-connector-java-5.1.41.jar --driver-java-options -Dpio.log.dir=/root file:/tmp/PredictionIO-0.14.0/lib/pio-assembly-0.14.0.jar --engine-id org.example.classification.ClassificationEngine --engine-version fda4275564238a7890ef3892235bc6f6b7bf645b --engine-variant file:/tmp/predictionio-template-attribute-based-classifier/engine.json --json-extractor Both --verbosity 0 --env PIO_ENV_LOADED=1,PIO_STORAGE_REPOSITORIES_METADATA_NAME=pio_meta,PIO_FS_BASEDIR=/root/.pio_store,PIO_HOME=/tmp/PredictionIO-0.14.0,PIO_FS_ENGINESDIR=/root/.pio_store/engines,PIO_STORAGE_SOURCES_PGSQL_URL=jdbc:postgresql://localhost/pio,PIO_STORAGE_REPOSITORIES_METADATA_SOURCE=PGSQL,PIO_STORAGE_REPOSITORIES_MODELDATA_SOURCE=PGSQL,PIO_STORAGE_REPOSITORIES_EVENTDATA_NAME=pio_event,PIO_STORAGE_SOURCES_PGSQL_PASSWORD=pio,PIO_STORAGE_SOURCES_PGSQL_TYPE=jdbc,PIO_FS_TMPDIR=/root/.pio_store/tmp,PIO_STORAGE_SOURCES_PGSQL_USERNAME=pio,PIO_STORAGE_REPOSITORIES_MODELDATA_NAME=pio_model,PIO_STORAGE_REPOSITORIES_EVENTDATA_SOURCE=PGSQL,PIO_CONF_DIR=/tmp/PredictionIO-0.14.0/conf
[INFO] [Engine] Extracting datasource params...
[INFO] [WorkflowUtils$] No 'name' is found. Default empty String will be used.
Exception in thread "main" java.lang.NoSuchMethodError: org.json4s.ParserUtil$.quote(Ljava/lang/String;)Ljava/lang/String;
        at org.json4s.native.JsonMethods$$anonfun$2.apply(JsonMethods.scala:42)
        at org.json4s.native.JsonMethods$$anonfun$2.apply(JsonMethods.scala:42)
        at scala.collection.immutable.List.map(List.scala:284)
        at org.json4s.native.JsonMethods$class.render(JsonMethods.scala:42)
        at org.json4s.native.JsonMethods$.render(JsonMethods.scala:62)
        at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2$$anonfun$2.apply(WorkflowUtils.scala:177)
        at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2$$anonfun$2.apply(WorkflowUtils.scala:168)
        at scala.Option.map(Option.scala:146)
        at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2.apply(WorkflowUtils.scala:168)
        at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2.apply(WorkflowUtils.scala:159)
        at scala.Option.map(Option.scala:146)
        at org.apache.predictionio.workflow.WorkflowUtils$.getParamsFromJsonByFieldAndClass(WorkflowUtils.scala:159)
        at org.apache.predictionio.controller.Engine.jValueToEngineParams(Engine.scala:363)
        at org.apache.predictionio.workflow.CreateWorkflow$.main(CreateWorkflow.scala:222)
        at org.apache.predictionio.workflow.CreateWorkflow.main(CreateWorkflow.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
        at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:849)
        at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:167)
        at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:195)
        at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
        at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:924)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:933)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

Engine.json看起来像这样
{
“id”:“默认”,
“description”:“默认设置”,
“engineFactory”:“org.example.classification.ClassificationEngine”,
“数据源”: {
“参数”:{
“appName”:“testApp”
}
},
“算法”:[
{
“name”:“天真”,
“参数”:{
“lambda”:1.0
}
}
]
}
pio app list
[INFO] [Pio$]                 Name |   ID |                                                       Access Key | Allowed Event(s)
[INFO] [Pio$]               MyApp1 |    1 | y21noIILc03hFc6S_w2vWAKpVlsit2CPJmcL0-Qv4TLXMnSmCMJSWQ125o586nUc | (all)
[INFO] [Pio$]              testApp |    2 | UxYsU_UdG6TXTQpzoWXH0icQt9wqi3MndwNuOYF-nEKMab_6xzush2uFsyPpi6qj | (all)

jps -l
10544 org.apache.predictionio.tools.console.Console
10241 org.apache.predictionio.tools.console.Console
10297 org.apache.predictionio.tools.console.Console

最佳答案

我有同样的错误,但是直接安装而不是使用Docker。

我通过使用Spark版本2.1.3而不是2.4.4解决了该问题。由于我没有使用相同的设置,因此无法提供任何其他建议/说明。

我从Apache mailing list得到了这个提示。

更改Spark版本后,我遇到了StackOverflowException。如果遇到相同的情况,请将numIteraions中的engine.json减少(即10)。讨论了here

07-24 18:29