databricks dbutils抛出nullpointerexception

mdfafbf1  于 2021-05-24  发布在  Spark
关注(0)|答案(1)|浏览(476)

尝试使用databricks dbutils从azure密钥保管库读取机密,但遇到以下异常:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Warning: Ignoring non-Spark config property: eventLog.rolloverIntervalSeconds
Exception in thread "main" java.lang.NullPointerException
    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 com.databricks.dbutils_v1.DBUtilsHolder$$anon$1.invoke(DBUtilsHolder.scala:17)

下面是代码段:

Object secret = DBUtilsHolder.dbutils().secrets().get("<scope>", "<key>");
System.out.println("secret " + secret.toString());

以下是pom:

<dependencies>
    <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_2.11</artifactId>
      <version>2.4.5</version>
      <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql -->
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-sql_2.11</artifactId>
      <version>2.4.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.airlift</groupId>
      <artifactId>airline</artifactId>
      <version>0.8</version>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.12</version>
      <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.databricks/dbutils-api -->
    <dependency>
      <groupId>com.databricks</groupId>
      <artifactId>dbutils-api_2.11</artifactId>
      <version>0.0.4</version>
      <scope>provided</scope>
    </dependency>
<dependencies>

当作为spark submit作业从databricks运行时,它失败了,但是当尝试使用setjar选项时,它工作了。

zlhcx6iw

zlhcx6iw1#

根据文档,databricks实用程序不可用于spark提交作业。如果您想使用databricks实用程序,请改用jar作业。

相关问题