# HG changeset patch # User paulb # Date 1080327511 0 # Node ID c683d230eee5199a8c28daca142f490588d4f8b2 # Parent d07001880536118dd328554c84260f6368366a68 [project @ 2004-03-26 18:58:31 by paulb] Added more notes on the Jython situation. diff -r d07001880536 -r c683d230eee5 README.txt --- a/README.txt Fri Mar 26 17:47:34 2004 +0000 +++ b/README.txt Fri Mar 26 18:58:31 2004 +0000 @@ -39,28 +39,24 @@ Java Servlet API Notes ---------------------- -Trying to get WebStack working on top of the Java Servlet API was an -unsuccessful exercise. First, I tried to use jythonc at the top of a directory -structure consisting of WebStack, Simple and the SimpleApp.py source file, but -jythonc insisted on making a Java source file - WebStack.java - which -conflicts with the WebStack package. I would have expected it to make an -__init__.java file inside the WebStack directory containing the Java source -files. +Using JythonServlet: -Then, I decided to make .jar files for each package before compiling -SimpleApp.py, but this did not work particularly well. Each main.py file -imports the appropriate package (WebStack.Adapters.JavaServlet for WebStack, -Simple for Simple). The CLASSPATH environment variable was set to include -servlet.jar from Apache Tomcat and, for SimpleApp.py, the previously produced -.jar files. +mkdir SimpleApp +mkdir SimpleApp/WEB-INF +mkdir SimpleApp/WEB-INF/classes +mkdir SimpleApp/WEB-INF/jython +mkdir SimpleApp/WEB-INF/lib +cp ${JYTHON_HOME}/jython.jar SimpleApp/WEB-INF/lib +cp -R ${WEBSTACK_HOME}/WebStack SimpleApp/WEB-INF/jython +cp -R ${WEBSTACK_HOME}/examples/Common/Simple SimpleApp/WEB-INF/jython +cp ${WEBSTACK_HOME}/examples/JavaServlet/SimpleApp.py SimpleApp +cp ${WEBSTACK_HOME}/examples/JavaServlet/web.xml SimpleApp/WEB-INF +mv SimpleApp ${CATALINA_HOME}/webapps -[In the WebStack root directory...] -jythonc --all --jar .../WEB-INF/lib/WebStack.jar -J "-deprecation" main.py -[In the examples/Common directory...] -jythonc --all --jar .../WEB-INF/lib/Simple.jar -J "-deprecation" main.py -[In the examples/JavaServlet/SimpleApp directory...] -jythonc --all --workdir .../WEB-INF/classes -J "-deprecation" SimpleApp.py -cp .../jython.jar .../WEB-INF/lib +Unfortunately, PyServlet doesn't manage to find various modules in packages: -Somehow, the Simple package doesn't contain SimpleResource, even if the -appropriate main.py file explicitly references it. +javax.servlet.ServletException: Could not create Jython servletTraceback (innermost last): + File "/data/home/paulb/Software/Java/jakarta-tomcat-4.1.27/webapps/SimpleApp/SimpleApp.py", line 3, in ? +ImportError: cannot import name JavaServlet + +The same modules can be imported in interactive Jython.