From: Greg H. <gre...@gm...> - 2012-02-04 17:35:45
|
I'm trying to get modjy up and running using the basic instructions at http://www.jython.org/jythonbook/en/1.0/SimpleWebApps.html. I have now tried the same files and settings on both Glassfish 3.1.1 and JBoss AS 7. Both of them give me the following exception which is indecipherable to me: Traceback (most recent call last): File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py", line 80, in service File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py", line 76, in service File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py", line 103, in dispatch_to_application File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py", line 121, in raise_exc modjy.modjy_exceptions.ApplicationException: Invalid placeholder in string: line 9, col 5724 at org.python.core.PyException.fillInStackTrace(PyException.java:70) at java.lang.Throwable.<init>(Throwable.java:198) at java.lang.Exception.<init>(Exception.java:46) ... Can anyone give me an idea what is going wrong here or what this message means? I thought at first it might have something to do with JBoss AS 7, since it is mentioned in the jython Book as having some slight differences from Glassfish and other applications. However, Glassfish is giving me the same error. Any pointers would be most welcome. --Greg |
From: Alan K. <jyt...@xh...> - 2012-02-06 20:07:36
|
[Greg] > modjy.modjy_exceptions.ApplicationException: Invalid placeholder in > string: line 9, col 5724 > at org.python.core.PyException.fillInStackTrace(PyException.java:70) > at java.lang.Throwable.<init>(Throwable.java:198) > at java.lang.Exception.<init>(Exception.java:46) > ... Sorry for the late reply: I've been on vacation. This looks like an exception while reporting an exception. The error occurs while adding the java stack trace to the python exception. The code in question is public Throwable fillInStackTrace() { return Options.includeJavaStackInExceptions ? super.fillInStackTrace() : this; } If you set the "python.options.includeJavaStackInExceptions" value to "false" in the registry file, this should stop jython trying to include the problematic stack trace, and reveal the real python exception, if that is indeed the problem. Alan. |
From: Greg H. <gre...@gm...> - 2012-02-06 20:37:12
|
Alan, Thanks for the reply. On Mon, Feb 6, 2012 at 2:07 PM, Alan Kennedy <jyt...@xh...> wrote: > [Greg] >> modjy.modjy_exceptions.ApplicationException: Invalid placeholder in >> string: line 9, col 5724 >> at org.python.core.PyException.fillInStackTrace(PyException.java:70) >> at java.lang.Throwable.<init>(Throwable.java:198) >> at java.lang.Exception.<init>(Exception.java:46) >> ... > > Sorry for the late reply: I've been on vacation. > > This looks like an exception while reporting an exception. > > The error occurs while adding the java stack trace to the python > exception. The code in question is > > public Throwable fillInStackTrace() { > return Options.includeJavaStackInExceptions ? > super.fillInStackTrace() : this; > } > > If you set the "python.options.includeJavaStackInExceptions" value to > "false" in the registry file, this should stop jython trying to > include the problematic stack trace, and reveal the real python > exception, if that is indeed the problem. I'm not sure if I'm getting the Registry file correct. Currently I have tried setting that argument in: web.xml as a parameter to modjy In a file named 'registry' that is a sibling of jython.jar in WEB-INF/lib In a file named 'registry' this is a sibling of Lib.xip in WEB-INF/lib-python So far none of those have altered the behavior of the servlet. Is there somewhere else magic that ought to put my registry file? --Greg > > Alan. |
From: Alan K. <jyt...@xh...> - 2012-02-06 23:29:04
|
[Greg] > I'm not sure if I'm getting the Registry file correct. Currently I > have tried setting that argument in: > web.xml as a parameter to modjy > In a file named 'registry' that is a sibling of jython.jar in WEB-INF/lib > In a file named 'registry' this is a sibling of Lib.xip in WEB-INF/lib-python > > So far none of those have altered the behavior of the servlet. Is > there somewhere else magic that ought to put my registry file? Hi Greg, Sorry, I should have also pointed out that you can set these options directly in the web.xml file. Adding this to your web.xml should work. <init-param> <param-name>python.options.includeJavaStackInExceptions</param-name> <param-value>false</param-value> </init-param> All options that can be set in the registry file can also be specified in the web.xml, as described here http://opensource.xhaus.com/projects/modjy/wiki/ModjyConfiguration Alan. |
From: Greg H. <gre...@gm...> - 2012-02-07 00:18:23
|
On Mon, Feb 6, 2012 at 5:28 PM, Alan Kennedy <jyt...@xh...> wrote: > > Hi Greg, > > Sorry, I should have also pointed out that you can set these options > directly in the web.xml file. > > Adding this to your web.xml should work. > > <init-param> > <param-name>python.options.includeJavaStackInExceptions</param-name> > <param-value>false</param-value> > </init-param> > > All options that can be set in the registry file can also be specified > in the web.xml, as described here > > http://opensource.xhaus.com/projects/modjy/wiki/ModjyConfiguration > > Alan. Alan, I had followed that, both at the Servlet level and at the Context level. It still has no effect on the behavior of the modjy application. Is there a way for me to verify that the settings are being picked up by the application? Or a way for me to set the value of that option in the python WSGI application? --Greg |
From: Alan K. <jyt...@xh...> - 2012-02-07 01:45:34
|
[Greg] > Is there a way for me to verify that the settings are > being picked up by the application? Yes. You can view the content of modjy parameters by looking in the WSGI environment, as documented here http://opensource.xhaus.com/projects/modjy/wiki/ModjyWSGI You can see if they have had an effect on interpreter initialization with the following code import sys print sys.registry['options.includeJavaStackInExceptions'] > Or a way for me to set the value > of that option in the python WSGI application? The options in the registry are set before interpreter creation, so setting them after the interpreter has started running may not have the desired effect. But I would try this early in the code. sys.registry['python.options.includeJavaStackInExceptions'] = 'false' Alan. |
From: Alan K. <jyt...@xh...> - 2012-02-07 01:47:12
|
[Alan] > You can see if they have had an effect on interpreter initialization > with the following code > > import sys > print sys.registry['options.includeJavaStackInExceptions'] That should be: print sys.registry['python.options.includeJavaStackInExceptions'] Alan. |