From: David R. <dr...@ri...> - 2002-11-14 21:58:17
|
I'm experimenting with adding some Jython servlets to an existing Java servlet site. Using Jython 2.1, Sun JDK 1.4.1_01, Tomcat 4.1.12, Linux I've hit a couple of snags: 1. The example at http://jywiki.sourceforge.net/index.php?JythonServlet says says that Jython servlets should go into <context>/WEB-INF/jython, but then actually puts the example code into the root of <context> If I put it into <context>/WEB-INF/jython, I can't get it to run, except by actually hardcoding "/WEB-INF/jython/servletname.py" into the URL. Is there some way to configure things so that the search directory for .py files starts from <context>/WEB-INF/jython instead of <context> ? 2. Jython servlets can call Sun's Java code from the java and javax packages. But they can't call my code that lives under <context>/WEB-INF/classes Looks like a classpath problem. When I add this debug code to a Jython servlet: systemProps = java.lang.System.getProperties() print systemProps['java.class.path'] I get the very sparse: /opt/sun-jdk-1.4.1.01/lib/tools.jar:/opt/tomcat/bin/bootstrap.jar I see that PyServlet.java contains: sys.add_classdir(rootPath + "WEB-INF" + File.separator + "classes"); but it doesn't appear to be working. What's the right way to setup the Java classpath for Jython servlets? Thanks. -- David Ripton dr...@ri... |