# SparkClassNotFoundException: Unable to Find Stardog Spark Connector in PySpark

**URL:** <https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294>\
**Category:** Support\
**Created:** [March 5, 2025, 8:00am UTC](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294 "2025-03-05T08:00:08Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Tapan\_Sharma](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/tapan_sharma/32/1564_2.png) [@Tapan\_Sharma](https://community.stardog.com/u/Tapan_Sharma)\
**Post date:** [March 26, 2025, 10:16am UTC](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294/23 "2025-03-26T10:16:16Z")

</div>

Please do not decode the token back.

`base64_token = base64.b64encode(jwt_token.encode("utf-8"))`

---

<div class="post-metadata">

**Author:** ![Jauwad\_Mazhari](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jauwad_mazhari/32/2313_2.png) [@Jauwad\_Mazhari](https://community.stardog.com/u/Jauwad_Mazhari)\
**Post date:** [March 26, 2025, 10:58am UTC](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294/24 "2025-03-26T10:58:14Z")

</div>

Yes I used without decoding as well it is giving IllegalArgumentException.

base64\_token = base64.b64encode(jwt\_token.encode("utf-8"))

This statement will generate byte representation of the token and when I use that token it is giving

java.lang.IllegalArgumentException: Illegal base64 character 27

---

<div class="post-metadata">

**Author:** ![Tapan\_Sharma](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/tapan_sharma/32/1564_2.png) [@Tapan\_Sharma](https://community.stardog.com/u/Tapan_Sharma)\
**Post date:** [March 28, 2025, 2:06pm UTC](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294/25 "2025-03-28T14:06:52Z")

</div>

Thanks for your patience. I followed the below steps and did not encounter the issue. Can you please check if any step is missing.

Here is what I did.

**Step 1:**

My stardog is running at `https://sd-ffcba75745.stardog.cloud:5820`. I created the user called "`dummy`" on this Stardog Free server with the password, say "`dummyuser`".

```auto
username = dummy
password = dummyuser
Stardog endpoint = https://sd-ffcba75745.stardog.cloud:5820

```

I ran the below command:

`curl -u dummy:dummyuser https://sd-ffcba75745.stardog.cloud:5820/admin/token`

And I got this token.

`{"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiSSSSSSSZCI6InN0YXJkb2ctY2xvdWQiLCJpc3MiOiJodHRwOi8vc3RhcmRvZy5jb20vdjEiLCJzdGFyZG9nLXVzZXJuYW1lIjoiZHVtbXkiLCJl"}`

**Step 2:**

I set `jwt_token` equal to `token` copied from previous step.

`jwt_token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiSSSSSSSZCI6InN0YXJkb2ctY2xvdWQiLCJpc3MiOiJodHRwOi8vc3RhcmRvZy5jb20vdjEiLCJzdGFyZG9nLXVzZXJuYW1lIjoiZHVtbXkiLCJl"`

- Encode the jwt\_token  
`base64_token = base64.b64encode(jwt_token.encode("utf-8"))`

**Step 3:**

Pass `base64_token` as `password` to the code that you have and also set `stardog.token.authentication` option to `True`.

```auto
df = spark.read
.format("com.complexible.stardog.spark.datasource")
.option("stardog.endpoint", "endpoint")
.option("stardog.database", "spark")
.option("stardog.token.authentication", True)
.option("stardog.username", "userName")
.option("stardog.password", base64_token)
.option("config", config_file)
.load()

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [November 7, 2025, 9:51pm UTC](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294/26 "2025-11-07T21:51:01Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [July 11, 2026, 4:01am UTC](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294/27 "2026-07-11T04:01:51Z")

</div>



[Previous page](https://community.stardog.com/t/sparkclassnotfoundexception-unable-to-find-stardog-spark-connector-in-pyspark/5294.md?page=1)
