-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.util.logging.Logger NullPointerException with pip install #623
Comments
I'm facing a similar issue with sl4j, it looks like a serious bug.. |
You can look into the exception like this: from jnius import JavaException
try:
d = Demo()
except JavaException as ja:
print("\n\t at ".join(ja.stacktrace))
raise(ja) which displays output as follows:
A quick search takes me to https://stackoverflow.com/questions/33996439/nullpointerexception-at-java-util-logging-logger-demandlogger which makes two possible suggestions - suppressing the caller identification with a Java cmd line argument (which can be set using Jnius - see https://pyjnius.readthedocs.io/en/stable/api.html#jvm-options-and-the-class-path) or wrapping the function in some Java. |
Thanks @cmacdonald ! too bad the exception capturing api is not in the documentation, could have saved a lot of time. |
I tried hard to update the Python level traceback with the Java exception stacktrace, but in Python (unlike in Java), it seems a traceback cannot be faked. @tshirtman I would propose instead updating the JavaException string to include the Java stacktrace by default. Thoughts? |
I am treating this as a request to add something to the documentation explaining how to extract a Java stacktrace from a Python JavaException. |
I worked for a considerable time to add the Java stacktrace into the Python traceback object, just like how Java builds stacktraces when error occurs for remote method invocation. I did not succeed in simulating tracebacks (though others might!) I think instead, we could more simply override the Alternatively, I see that Python 3.11 has "notes": |
Putting the traceback in the Creating a I think the existing attribute that is only on a Python JavaException sounds like the best fallback, with appropriate documentation. [This is just an opinion.] |
Oooh! Time to move this discussion to #203 which is very similar. To summarise:
|
I can't get pyjnius=1.4.1 java logger to work in python 3.8.13 after
pip install pyjnius
. The java logger does work after a conda install. And, the logger does work via python for android in an android 7.0 device after pip install.gives the NullPointerException in jnius_utils.pxi line 91. The string argument to the constructor is not a null, and I tried using string literals as well. In a related note, the jnius_utils.pxi file is missing from site_packages/jnius after
pip install pyjnius
. But whether it is an empty file created bytouch jnius_utils.pxi
, or the file is copied manually from here on github, still get the same NullPointerException.The text was updated successfully, but these errors were encountered: