By: MH Ramon user 18 Mar 2021 at 1:19 a.m. CDT

2 Responses
MH Ramon gravatar
Hello, I want to create a new authentication script to the GLUU server To make it works, I need to put a .jar file somewhere in the GLUU server It runs well in my pc (because I can add the jar file as I type the correct directory location in PYTHONPATH correctly) According to the [documentation](https://gluu.org/docs/gluu-server/4.2/authn-guide/customauthn/) > If preferred, pure Python libraries can also be added to /opt/gluu/python/libs, and jar files can be added to /opt/gluu/jetty/oxauth/lib/ext. I put my jar file there, but I get this error inside my jar file, there is "fnsv" class that I want to call ``` org.gluu.exception.PythonException: Failed to load python file 'java.io.ByteArrayInputStream@511988cd' at org.gluu.service.PythonService.loadPythonScript(PythonService.java:187) at org.gluu.service.PythonService$Proxy$_$$_WeldClientProxy.loadPythonScript(Unknown Source) at org.gluu.service.custom.script.CustomScriptManager.createExternalTypeFromStringWithPythonException(CustomScriptManager.java:417) at org.gluu.service.custom.script.CustomScriptManager$Proxy$_$$_WeldSubclass.createExternalTypeFromStringWithPythonException(Unknown Source) at org.gluu.service.custom.script.CustomScriptManager.createExternalType(CustomScriptManager.java:385) at org.gluu.service.custom.script.CustomScriptManager.reloadCustomScriptConfigurations(CustomScriptManager.java:293) at org.gluu.service.custom.script.CustomScriptManager.reloadImpl(CustomScriptManager.java:182) at org.gluu.service.custom.script.CustomScriptManager.reload(CustomScriptManager.java:152) at org.gluu.service.custom.script.CustomScriptManager.initTimer(CustomScriptManager.java:107) at org.gluu.service.custom.script.CustomScriptManager$Proxy$_$$_WeldSubclass.initTimer$$super(Unknown Source) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:51) at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78) at org.gluu.service.cdi.async.AsynchronousInterceptor$1.get(AsynchronousInterceptor.java:36) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: Traceback (most recent call last): File "lets_test.py", line 9, in <module> ImportError: No module named fnsv at org.python.core.Py.ImportError(Py.java:329) at org.python.core.imp.import_logic(imp.java:1290) at org.python.core.imp.import_module_level(imp.java:1369) at org.python.core.imp.importName(imp.java:1528) at org.python.core.ImportFunction.__call__(__builtin__.java:1285) at org.python.core.PyObject.__call__(PyObject.java:433) at org.python.core.__builtin__.__import__(__builtin__.java:1232) at org.python.core.imp.importOneAs(imp.java:1564) at org.python.pycode._pyx4.f$0(gccs_test.py:11) at org.python.pycode._pyx4.call_function(gccs_test.py) 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:1687) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:297) at org.gluu.service.PythonService.loadPythonScript(PythonService.java:184) ... 18 more ==================Further details============================ Failed to load python file 'java.io.ByteArrayInputStream@511988cd' ``` According to [another ticket](https://support.gluu.org/customization/6239/trouble-importing-custom-jar-files/) > Customized libs for oxAuth to use should be placed in the following directories: /opt/gluu/jetty/identity/custom/libs /opt/gluu/jetty/oxauth/custom/libs I did that too But the error is exactly same Is there any step that I miss? Thank you

By Mohib Zico Account Admin 18 Mar 2021 at 7:03 a.m. CDT

Mohib Zico gravatar
Check permission of your jar file. See if it's accessible properly by oxTrust or not.

By MH Ramon user 18 Mar 2021 at 8:58 p.m. CDT

MH Ramon gravatar
I already make it 777. Anyway, i solved it by making a little modification on my jython custom script at the beginning of the script like this: ``` import sys sys.path.append("/opt/gluu/jetty/oxauth/lib/ext/testing_lib.jar") # -> Because it is located at /opt/gluu/jetty/oxauth/lib/ext . . . import com.fnsv.testing as TestLib; ``` Now I am facing another error, but not related to this ticket Thanks for your response