Project

General

Profile

ModjyTroubleShooting » History » Version 1

Alan Kennedy, 2011-02-25 10:15 PM
Adding a new trouble shooting page.

1 1 Alan Kennedy
h1. Trouble shooting modjy installations
2
3
By far the best way to get modjy running is to use the demo modjy application, distributed with jython, in the *Demo* directory, sub-directory *modjy_webapp*.
4
5
Don't forget to place the *jython.jar* file in the *WEB-INF/lib* directory!
6
7
If you're deploying a Django application, I highly recommend using the war packaging tool built, described on the [[ModjyAndDjango|Modjy and Django]] page: it configures everything correctly and prevents possible problems.
8
9
Similarly, the [[ModjyAndPylons|modjy and Pylons]] page describes the "snakefight":http://pypi.python.org/pypi/snakefight war-building tool, which does a similar job for Pylons.
10
11
h2(#noclassdef). java.lang.NoClassDefFoundError: com/xhaus/modjy/ModjyJServlet.
12
13
If you see this error, this means that your servlet container cannot find the java class *com.xhaus.modjy.ModjyJServlet*, which is the only java class used in modjy.
14
15
The likely cause of this issue is one of the following
16
17
 # The container cannot find the *jython.jar* file, which contains the class file.
18
 # The container cannot load the class from the *jython.jar* file, either for permissions or security reasons.
19
20
I recommend reading the documentation on [[ModjyDeployment#Placing-the-jythonjar-file|placing the jython.jar file]] 
21
22
h2(#importerror). ImportError: no module named modjy
23
24
There are two parts to modjy: a java part (actually a single java class) and a jython part. The majority of modjy is implemented in jython, with the entry point in a file called *modjy.py*. The java servlet component of modjy tries to import this module: if it fails, you will see the error above.
25
26
Obviously, you have to configure things such that modjy can find the *modjy.py* module and supporting modules. Which you can do by
27
28
 # Setting the *python.home* property. See the [[ModjyDeployment#Configuring-modjy|modjy deployment documentation]] for how to do this.
29
 # You can also copy the contents of the jython *Lib* directory into the *WEB-INF/lib-python* directory. This directory is automatically added to *sys.path* and any modules contained in it can be imported. To do this, copy every file and directory from the *Lib* directory of your jython installation into *WEB-INF/lib-python*, and that should solve your import problem.
30
 # It is also possible to package the entire jython *Lib* directory into a single file, which you then copy into *WEB-INF/lib-python*. This process is described on the [[ModjyGoogleAppEngine|running modjy on google appengine]] page, under the heading "Making the jython library accessible".
31
32
h2(#other). Other problems.
33
34
If you experience other problems deploying WSGI applications with modjy, then please either file a bug on the "Jython bug tracker":http://bugs.jython.org or send an email to the "Jython Users":https://lists.sourceforge.net/lists/listinfo/jython-users mailing list.