我试图在集成开发环境中的scala代码中访问alluxio中的一个文件,我得到了这个错误Exception in thread "main" java.io.IOException: No FileSystem for scheme: alluxio我的代码如下,
package com.example.sparkalliuxiodemo
import org.apache.spark.sql.SparkSession
object TestMain {
def main(args: Array[String]): Unit = {
val spark = SparkSession.builder().config("spark.master", "local[2]")
.getOrCreate()
var df = spark.read.parquet("alluxio://localhost:19998/sample-df")
df.printSchema()
}
}pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spark-alluxio-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-client</artifactId>
<version>1.8.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-server</artifactId>
<version>1.8.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-common</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-client-fs</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</project>我可以通过Shell访问Spark安装目录中的alluxio文件系统。如果我尝试通过集成开发环境访问相同的代码,包括POM.xml中的上述alluxio依赖项,我会得到上面的错误。
如果我手动将这个jar文件‘alluxio -1.8.1-client.jar’放到我的构建路径中,我就能够访问alluxio中的文件,而IDE本身没有任何错误。
我需要在eclipse或scala-ide中直接访问alluxio中的文件。
有没有人能建议我在maven依赖中包含正确的alluxio依赖?
发布于 2019-03-09 02:12:14
尝试添加
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-client-hdfs</artifactId>
<version>1.8.1</version>
</dependency>https://stackoverflow.com/questions/55036421
复制相似问题