By: Ben Cory user 20 Jul 2017 at 7:07 a.m. CDT

1 Response
Ben Cory gravatar
I am trying to break some python script into a .py module to reuse from multiple custom scripts. Taking something basic: def testlog(self, messageToPrint): print "***** " + messageToPrint This works when in the python script saved to Ldap through the manage custom scripts\Person Authentication tab. If I then put this in a script : SomeModule.py Put SomeModule.py in /opt/gluu/python/libs as per [the Gluu docs](https://gluu.org/docs/ce/latest/authn-guide/customauthn/) Then Add to the authentication script (OurBasicAuthentication: import SomeModule And call it using _SomeModule.testlog("test")_ Authentication fails and in the oxauth_script.log I get: 2017-07-20 10:58:12,523 ERROR [pool-2-thread-2] [org.xdi.service.custom.script.CustomScriptManager] (CustomScriptManager.java:364) - Failed to initialize custom script: 'OurBasicAuthentication' org.python.core.PyException: null at org.python.core.Py.TypeError(Py.java:259) ~[jython-2.7.0.jar:?] at org.python.core.PyBaseCode.call(PyBaseCode.java:285) ~[jython-2.7.0.jar:?] at org.python.core.PyBaseCode.call(PyBaseCode.java:131) ~[jython-2.7.0.jar:?] at org.python.core.PyFunction.__call__(PyFunction.java:413) ~[jython-2.7.0.jar:?] at org.python.pycode._pyx3.init$3(<iostream>:60) ~[?:?] at org.python.pycode._pyx3.call_function(<iostream>) ~[?:?] at org.python.core.PyTableCode.call(PyTableCode.java:167) ~[jython-2.7.0.jar:?] at org.python.core.PyBaseCode.call(PyBaseCode.java:307) ~[jython-2.7.0.jar:?] at org.python.core.PyBaseCode.call(PyBaseCode.java:198) ~[jython-2.7.0.jar:?] at org.python.core.PyFunction.__call__(PyFunction.java:482) ~[jython-2.7.0.jar:?] at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[jython-2.7.0.jar:?] at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[jython-2.7.0.jar:?] at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[jython-2.7.0.jar:?] at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[jython-2.7.0.jar:?] at org.python.core.PyObject._jcallexc(PyObject.java:3626) ~[jython-2.7.0.jar:?] at org.python.core.PyObject._jcall(PyObject.java:3658) ~[jython-2.7.0.jar:?] at org.python.proxies.__builtin__$PersonAuthentication$11.init(Unknown Source) ~[?:?] at org.xdi.service.custom.script.CustomScriptManager.createExternalTypeFromStringWithPythonException(CustomScriptManager.java:362) [oxService-3.0.1.jar:?] at org.xdi.service.custom.script.CustomScriptManager.createExternalType(CustomScriptManager.java:322) [oxService-3.0.1.jar:?] at org.xdi.service.custom.script.CustomScriptManager.reloadCustomScriptConfigurations(CustomScriptManager.java:238) [oxService-3.0.1.jar:?] at org.xdi.service.custom.script.CustomScriptManager.reloadImpl(CustomScriptManager.java:143) [oxService-3.0.1.jar:?] at org.xdi.service.custom.script.CustomScriptManager.reload(CustomScriptManager.java:131) [oxService-3.0.1.jar:?] at org.xdi.service.custom.script.CustomScriptManager.init(CustomScriptManager.java:90) [oxService-3.0.1.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112] at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:79) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:196) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:114) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.xdi.service.custom.script.CustomScriptManager_$$_javassist_seam_33.init(CustomScriptManager_$$_javassist_seam_33.java) [oxService-3.0.1.jar:?] at org.xdi.oxauth.service.AppInitializer.postInitialization(AppInitializer.java:129) [classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112] at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:79) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:196) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:114) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.xdi.oxauth.service.AppInitializer_$$_javassist_seam_1.postInitialization(AppInitializer_$$_javassist_seam_1.java) [classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112] at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at org.jboss.seam.async.ThreadPoolDispatcher$RunnableAsynchronous.run(ThreadPoolDispatcher.java:142) [jboss-seam-2.3.1.Final.jar:2.3.1.Final] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_112] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_112] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_112] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_112] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_112] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_112] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112] **Commenting out the call to SomeModule.testlog and it all works.** The pydev environment is happy with the syntax and the method exists. Why does this not work in the Gluu chroot environment ? Any help would be greatly appreciated.

By Mohib Zico staff 20 Jul 2017 at 7:15 a.m. CDT

Mohib Zico gravatar
Hi Ben, Custom script troubleshooting is not covered in community support.