PredictionIO-0.10.0-incubating 找不到合适的驱动程序 jdbc:postgresql://localhost/pio

PredictionIO-0.10.0-incubating No suitable driver found for jdbc:postgresql://localhost/pio

PredictionIO-0.10.0-在 ubuntu 16.04 returns 错误 "Exception in thread "main" java.sql.SQLException 上孵化:找不到适合 jdbc:postgresql 的驱动程序:/ /localhost/pio" 当我 运行 bin/pio import --appid 1 --input engine/data/stopwords.json

pio在哪里找驱动?

当我 运行 bin/pio 状态时没有问题。

[INFO] [Console$] Inspecting PredictionIO...
[INFO] [Console$] PredictionIO 0.10.0-incubating is installed at /home/homedir/mnt/predictionio/apache-predictionio-0.10.0-incubating/PredictionIO-0.10.0-incubating
[INFO] [Console$] Inspecting Apache Spark...
[INFO] [Console$] Apache Spark is installed at /home/homedir/mnt/predictionio/apache-predictionio-0.10.0-incubating/PredictionIO-0.10.0-incubating/vendors/spark-1.5.1-bin-hadoop2.6
[INFO] [Console$] Apache Spark 1.5.1 detected (meets minimum requirement of 1.3.0)
[INFO] [Console$] Inspecting storage backend connections...
[INFO] [Storage$] Verifying Meta Data Backend (Source: PGSQL)...
[INFO] [Storage$] Verifying Model Data Backend (Source: PGSQL)...
[INFO] [Storage$] Verifying Event Data Backend (Source: PGSQL)...
[INFO] [Storage$] Test writing to Event Store (App Id 0)...
[INFO] [Console$] (sleeping 5 seconds for all messages to show up...)
[INFO] [Console$] Your system is all ready to go.

postgreSQL jdbc jar 安装在 /usr/lib/jvm/postgresql-42.0.0.jar

bin/pio import --appid 1 --input engine/data/stopwords.json
    [INFO] [Remoting] Starting remoting
    [INFO] [Remoting] Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.1.66:41940]
    [WARN] [MetricsSystem] Using default name DAGScheduler for source because spark.app.id is not set.
    Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/pio
            at java.sql.DriverManager.getConnection(DriverManager.java:689)
            at java.sql.DriverManager.getConnection(DriverManager.java:208)
            at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$$anonfun$getConnector.apply(JDBCRDD.scala:188)
            at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$$anonfun$getConnector.apply(JDBCRDD.scala:181)
            at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.createConnection(JdbcUtils.scala:39)
            at org.apache.spark.sql.DataFrameWriter.jdbc(DataFrameWriter.scala:253)
            at org.apache.predictionio.data.storage.jdbc.JDBCPEvents.write(JDBCPEvents.scala:162)
            at org.apache.predictionio.tools.imprt.FileToEvents$$anonfun$main.apply(FileToEvents.scala:101)
            at org.apache.predictionio.tools.imprt.FileToEvents$$anonfun$main.apply(FileToEvents.scala:68)
            at scala.Option.map(Option.scala:145)
            at org.apache.predictionio.tools.imprt.FileToEvents$.main(FileToEvents.scala:68)
            at org.apache.predictionio.tools.imprt.FileToEvents.main(FileToEvents.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.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:672)
            at org.apache.spark.deploy.SparkSubmit$.doRunMain(SparkSubmit.scala:180)
            at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
            at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:120)
            at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

告诉 pio 在哪里可以找到 jar

bin/pio import --appid 1 --input engine/data/emails.json -- --driver-class-path  /usr/lib/jvm/postgresql-42.0.0.jar

默认情况下,它在目录“$PIO_HOME/lib/postgresql-9.4-1204.jdbc41.jar”下查找。

这是按照文件 $PIO_HOME/conf/pio-env.sh.

中的定义

对于example:POSTGRES_JDBC_DRIVER=$PIO_HOME/lib/postgresql-9.4-1204.jdbc41.jar