java.lang.NullPointerException in azure databricks

Ram Babu 80 Reputation points
2023-10-09T12:49:06.2833333+00:00

Hi Team,

while mounting azure storage in databricks getting below error and not able to mount the containers of raw & test2. Please have a look and advice.

unable to find out the root cause.

configs = {"fs.azure.account.auth.type": "OAuth",
          "fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
          "fs.azure.account.oauth2.client.id": "application-id",
          "fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope="scope-adb-xyz-dev",key="sp-adbw-xyz-dev"),
          "fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/directory-id/oauth2/token"}

# Define a list of containers and mount points

containers = [
  {"source": "abfss://******@dlsadbaeidev.dfs.core.windows.net", "mount_point": "/mnt/datalake/raw"},
  {"source": "abfss://******@dlsadbaeidev.dfs.core.windows.net", "mount_point": "/mnt/datalake/test2"},
  # Add more containers as needed
]

# Iterate through the list and mount each container
for container in containers:
  dbutils.fs.mount(
    source=container["source"],
    mount_point=container["mount_point"],
    extra_configs=configs
  )
Below are the errors i got
java.lang.NullPointerException
dbutils.fs.mount is highlighted in color
i have attached full error details in notepad




Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,514 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 90,641 Reputation points Moderator
    2023-10-13T06:31:47.66+00:00

    @Ram Babu - Thanks for the question and using MS Q&A platform.

    When I tried to repro from my end, I was experience the same issue on the first run as shown below:
    User's image

    When I tried to run again, I was getting the actual error message for the failure:

    User's image

    From the error message, it clearly says as the secret key has been expired.

    User's image

    Now, I had updated the secret key and ran again and now I'm able to successfully able to mount the ADLS gen2 using abfss protocol.

    User's image

    In case, if you are experiencing the same issue after rerunning multiple time, kindly share the screenshot and the code snippet which you are trying?

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.