# 3rd party Java Lib: ImportError

**URL:** <https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897>\
**Category:** Ignition\
**Tags:** scripting, ignition81\
**Created:** [February 26, 2025, 11:50am UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897 "2025-02-26T11:50:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stef\_Van\_Poucke](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@Stef\_Van\_Poucke](https://forum.inductiveautomation.com/u/Stef_Van_Poucke)\
**Post date:** [February 26, 2025, 11:50am UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/1 "2025-02-26T11:50:49Z")

</div>

I would like to use a 3rd party Java Lib in scripting: [GitHub - auth0/java-jwt: Java implementation of JSON Web Token (JWT)](https://github.com/auth0/java-jwt)

I've found a jar file: [Download java-jwt.jar - @com.auth0](https://mavenlibs.com/jar/file/com.auth0/java-jwt)

and I've put it in the ignition/lib/core/common folder, gateway is restarted.  
I'm trying to start testing functionality:  
from com.auth0.jwt import \*

But I get this error:  
ImportError: No module named auth0

I know the proper way is to create an ignition module but we're not that familiar with java and never did such a thing so for now I just want to get something working and then look at a more permanent/better solution.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 26, 2025, 12:03pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/2 "2025-02-26T12:03:16Z")

</div>

If you’re running this in the Designer script console you do also need to restart the Designer before it will load that JAR file.

---

<div class="post-metadata">

**Author:** ![Stef\_Van\_Poucke](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@Stef\_Van\_Poucke](https://forum.inductiveautomation.com/u/Stef_Van_Poucke)\
**Post date:** [February 26, 2025, 12:13pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/3 "2025-02-26T12:13:57Z")

</div>

Just restarted Gateway & Designer again but no change:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2d2b892a649c495dda463f65283685eef3641fb.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 26, 2025, 12:20pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/4 "2025-02-26T12:20:41Z")

</div>

Hmm, this library has other transitive dependencies you probably haven't included in lib/core/common, so I bet it's failing to load somewhere.

> <https://github.com/auth0/java-jwt/blob/ee7332b023719a9007be0caf5ef7608840fc4946/lib/build.gradle#L125-L126>

---

<div class="post-metadata">

**Author:** ![Stef\_Van\_Poucke](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@Stef\_Van\_Poucke](https://forum.inductiveautomation.com/u/Stef_Van_Poucke)\
**Post date:** [February 26, 2025, 12:42pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/5 "2025-02-26T12:42:58Z")

</div>

How would I best go about troubleshooting this?  
Ive added these:  
[Download jackson-core.jar - @com.fasterxml.jackson.core](https://mavenlibs.com/jar/file/com.fasterxml.jackson.core/jackson-core)  
[Download jackson-databind.jar - @com.fasterxml.jackson.core](https://mavenlibs.com/jar/file/com.fasterxml.jackson.core/jackson-databind)

and rebooted gateway/designer and I'm still getting the same result.

If there's another JWT Lib that you know works would also be helpfull.  
All I need is to verify a JWT, so validate signature and decode the base 64 to check scope and expiry

I might be able to do the same with a crypto and base 64 lib

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 26, 2025, 12:54pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/6 "2025-02-26T12:54:51Z")

</div>

In addition to the above, you should know that jython cannot use `*` in imports from java packages or classes. You must import specific classes.

It isn't a syntax error, but just doesn't yield anything.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 26, 2025, 1:24pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/7 "2025-02-26T13:24:12Z")

</div>

I think you also need jackson-annotations-2.15.4.jar.

I just gave this a try and it worked for me 🤷‍♂️

Added these 4 JAR files to lib/core/common, restarted Gateway, launched new Designer:

```python
kevin@DV-55J5DY3-LT ~/D/m/t/dependency> ls -lh
total 2.3M
-rw-r--r--. 1 kevin kevin 74K Feb 15 2024 jackson-annotations-2.15.4.jar
-rw-r--r--. 1 kevin kevin 536K Feb 15 2024 jackson-core-2.15.4.jar
-rw-r--r--. 1 kevin kevin 1.6M Feb 15 2024 jackson-databind-2.15.4.jar
-rw-r--r--. 1 kevin kevin 63K Jan 29 06:39 java-jwt-4.5.0.jar

```

In the script console:

```python
from com.auth0.jwt import JWT

JWT.decode("")

```

(which obviously errors out, but shows the library is loaded)

```python
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 3, in <module>
	at com.auth0.jwt.TokenUtils.wrongNumberOfParts(TokenUtils.java:45)
	at com.auth0.jwt.TokenUtils.splitToken(TokenUtils.java:23)
	at com.auth0.jwt.JWTDecoder.<init>(JWTDecoder.java:37)
	at com.auth0.jwt.JWTDecoder.<init>(JWTDecoder.java:33)
	at com.auth0.jwt.JWT.decode(JWT.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
com.auth0.jwt.exceptions.JWTDecodeException: com.auth0.jwt.exceptions.JWTDecodeException: The token was expected to have 3 parts, but got 0.

	at org.python.core.Py.JavaError(Py.java:545)
	at org.python.core.Py.JavaError(Py.java:536)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:192)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:208)
	at org.python.core.PyObject. __call__ (PyObject.java:461)
	at org.python.core.PyObject. __call__ (PyObject.java:465)
	at org.python.pycode._pyx11.f$0(<input>:3)
	at org.python.pycode._pyx11.call_function(<input>)
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1703)
	at org.python.core.Py.exec(Py.java:1747)
	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)
	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)
	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:628)
	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:616)
	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.auth0.jwt.exceptions.JWTDecodeException: The token was expected to have 3 parts, but got 0.
	at com.auth0.jwt.TokenUtils.wrongNumberOfParts(TokenUtils.java:45)
	at com.auth0.jwt.TokenUtils.splitToken(TokenUtils.java:23)
	at com.auth0.jwt.JWTDecoder.<init>(JWTDecoder.java:37)
	at com.auth0.jwt.JWTDecoder.<init>(JWTDecoder.java:33)
	at com.auth0.jwt.JWT.decode(JWT.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:190)
	... 19 more
Traceback (most recent call last):
  File "<input>", line 3, in <module>
	at com.auth0.jwt.TokenUtils.wrongNumberOfParts(TokenUtils.java:45)
	at com.auth0.jwt.TokenUtils.splitToken(TokenUtils.java:23)
	at com.auth0.jwt.JWTDecoder.<init>(JWTDecoder.java:37)
	at com.auth0.jwt.JWTDecoder.<init>(JWTDecoder.java:33)
	at com.auth0.jwt.JWT.decode(JWT.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
com.auth0.jwt.exceptions.JWTDecodeException: com.auth0.jwt.exceptions.JWTDecodeException: The token was expected to have 3 parts, but got 0.
>>> 

```

---

<div class="post-metadata">

**Author:** ![Stef\_Van\_Poucke](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@Stef\_Van\_Poucke](https://forum.inductiveautomation.com/u/Stef_Van_Poucke)\
**Post date:** [February 26, 2025, 1:39pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/8 "2025-02-26T13:39:45Z")

</div>

Great! thx.  
This also works on my end.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 26, 2025, 1:40pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/9 "2025-02-26T13:40:39Z")

</div>

Just keep in mind you'll have to repeat this procedure any time you upgrade Ignition. These lib/core/\* directories are wiped out and replaced during the upgrade.

---

<div class="post-metadata">

**Author:** ![Stef\_Van\_Poucke](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@Stef\_Van\_Poucke](https://forum.inductiveautomation.com/u/Stef_Van_Poucke)\
**Post date:** [February 26, 2025, 1:54pm UTC](https://forum.inductiveautomation.com/t/3rd-party-java-lib-importerror/102897/10 "2025-02-26T13:54:53Z")

</div>

Thanks for the headsup.  
When life is less busy we'll look into creating a .modl

or even better, ignition just implements JWT verify and JWT decode 😃
