pyjnius
pyjnius copied to clipboard
Java class implementation in Python Error
I'am calling my class (_JasperCustomScriptlet) from java. I follow the example (Java class implementation in Python) to make my own version (_JasperCustomScriptlet). Some times not always i get the following error:
Traceback (most recent call last):
14:56:07 web.1 | File "jnius/jnius_proxy.pxi", line 47, in jnius.PythonJavaClass.invoke (jnius/jnius.c:29877)
14:56:07 web.1 | File "jnius/jnius_proxy.pxi", line 63, in jnius.PythonJavaClass._invoke (jnius/jnius.c:30384)
14:56:07 web.1 | AttributeError: '_JasperCustomScriptlet' object has no attribute '__javamethods__'
14:56:07 web.1 | #
14:56:07 web.1 | # A fatal error has been detected by the Java Runtime Environment:
14:56:07 web.1 | #
14:56:07 web.1 | # SIGSEGV (0xb) at pc=0x000000010eba78d9, pid=50951, tid=19995
14:56:07 web.1 | #
14:56:07 web.1 | # JRE version: Java(TM) SE Runtime Environment (7.0_80-b15) (build 1.7.0_80-b15)
14:56:07 web.1 | # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode bsd-amd64 compressed oops)
14:56:07 web.1 | # Problematic frame:
14:56:07 web.1 | # C [jnius.so+0x478d9] __pyx_f_5jnius_invoke0+0x1153
14:56:07 web.1 | #
14:56:07 web.1 | # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
14:56:07 web.1 | #
14:56:07 web.1 | # An error report file with more information is saved as:
14:56:07 web.1 | # /Users/saguas/programacao/frappe-bench/sites/hs_err_pid50951.log
14:56:07 web.1 | #
14:56:07 web.1 | # If you would like to submit a bug report, please visit:
14:56:07 web.1 | # http://bugreport.java.com/bugreport/crash.jsp
14:56:07 web.1 | # The crash happened outside the Java Virtual Machine in native code.
14:56:07 web.1 | # See problematic frame for where to report the bug.
14:56:07 web.1 | #
My class is:
class _JasperCustomScriptlet(PythonJavaClass):
__javainterfaces__ = ['IFrappeScriptlet']
def __init__(self, JasperScriplet, sql):
super(_JasperCustomScriptlet, self).__init__()
self.Sl = sql
self.JS = JasperScriplet
@java_method('()V')
def beforeReportInit(self):
self.Sl.beforeReportInit()
return
@java_method('()V')
def afterReportInit(self):
self.Sl.afterReportInit()
return
@java_method('()V')
def beforePageInit(self):
self.Sl.beforePageInit()
return
@java_method('()V')
def afterPageInit(self):
self.Sl.afterPageInit()
return
@java_method('()V')
def beforeColumnInit(self):
self.Sl.beforeColumnInit()
return
@java_method('()V')
def afterColumnInit(self):
self.Sl.afterColumnInit()
return
@java_method('(Ljava/lang/String;)V')
def beforeGroupInit(self, gname):
self.Sl.beforeGroupInit(gname)
return
@java_method('(Ljava/lang/String;)V')
def afterGroupInit(self, gname):
self.Sl.afterGrouptInit(gname)
return
@java_method('()V')
def beforeDetailEval(self):
self.Sl.beforeDetailEval()
return
@java_method('()V')
def afterDetailEval(self):
self.Sl.afterDetailEval()
return
@java_method('(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;')
def callPythonMethod(self, methodName, args):
method = getattr(self.Sl, methodName)
return method(args)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I also have a similar error when implementing a pyjnius wrapper for a java function interface. @tshirtman is there any information you can provide on this?
Hello, i'm sorry but i didn't use pyjnius in a long time, and i don't remember the code very well, but a sigsegv is certainly indicating a bug on our side, it's good to have an example code that produces it, but it doesn't help that the error doesn't always produce the error, if your code produces the error in a reliable way, it would be cool to share it, but i can't promise i'll be able to help.
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project. Let us know if this comment was made in error, and we'll be happy to reopen the issue.