Project

General

Profile

Actions

ModjyTroubleShooting » History » Revision 1

Revision 1/2 | Next »
Alan Kennedy, 2011-02-25 10:15 PM
Adding a new trouble shooting page.


Trouble shooting modjy installations

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.

Don't forget to place the jython.jar file in the WEB-INF/lib directory!

If you're deploying a Django application, I highly recommend using the war packaging tool built, described on the Modjy and Django page: it configures everything correctly and prevents possible problems.

Similarly, the modjy and Pylons page describes the snakefight war-building tool, which does a similar job for Pylons.

java.lang.NoClassDefFoundError: com/xhaus/modjy/ModjyJServlet.

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.

The likely cause of this issue is one of the following

  1. The container cannot find the jython.jar file, which contains the class file.
  2. The container cannot load the class from the jython.jar file, either for permissions or security reasons.

I recommend reading the documentation on placing the jython.jar file

ImportError: no module named modjy

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.

Obviously, you have to configure things such that modjy can find the modjy.py module and supporting modules. Which you can do by

  1. Setting the python.home property. See the modjy deployment documentation for how to do this.
  2. 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.
  3. 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 running modjy on google appengine page, under the heading "Making the jython library accessible".

Other problems.

If you experience other problems deploying WSGI applications with modjy, then please either file a bug on the Jython bug tracker or send an email to the Jython Users mailing list.

Updated by Alan Kennedy about 13 years ago · 1 revisions