|
From: Brian Z. <bri...@ya...> - 2001-02-14 07:08:33
|
I figured it out. To answer myself:
Currently in PyServlet.java, setting "python.home" in WEB-INF/web.xml
and the following code are MUTUALLY EXCLUSIVE!
"""
props.setProperty("python.home", rootPath + File.separator +
"WEB-INF" + File.separator +
"lib");
props.setProperty("python.packages.directories",
"java.ext.dirs,pyservlet.lib");
props.setProperty("pyservlet.lib",
rootPath + File.separator +
"WEB-INF" + File.separator +
"lib");
props.setProperty("python.packages.paths",
"java.class.path,sun.boot.class.path,"+
"pyservlet.classes");
props.setProperty("pyservlet.classes",
rootPath + File.separator +
"WEB-INF" + File.separator +
"classes");
"""
I kind of understand the reasoning behind this: make deployment
self-contained. But setting "python.home" to <context>/WEB-INF/lib really
makes development inconvenient (any module except sys need to be copied into
WEB-INF/lib).
Will it do any harm if we set pyservlet properties independent of
"python.home"?
/Brian
----- Original Message -----
From: "Brian Zhou" <bri...@ya...>
To: <jyt...@li...>
Sent: Tuesday, February 13, 2001 9:58 PM
Subject: Re: [Jython-dev] Re: WEB-INF/classes & WEB-INF/lib/*.jar
inaccessible in jython servlet
> Hi Finn,
>
> Thanks for explaining to me that I need to put jython.jar under
> <context>/WEB-INF/lib. I did cvs update and rebuilt jython.jar. Now it's
> working with the help of:
>
> import sys
> sys.add_package("testpkg")
> from testpkg import TestClass
>
> But without the above, it still complains:
>
> File "C:\devel\servletContext\test\hello.py", line 3, in ?
> ImportError: no module named testpkg
>
> Is this the expected behavior so far? BTW, sys.registry.list(out) shows
>
> python.packages.paths=java.class.path, sun.boot.class.path
> python.packages.directories=java.ext.dirs
> ...
>
> No pyservlet.* in sight. Did I miss anything, again?
>
> Really appreciate all your help,
>
> /Brian
>
> ----- Original Message -----
> From: "Finn Bock" <bc...@wo...>
> To: <jyt...@li...>
> Sent: Tuesday, February 13, 2001 1:56 AM
> Subject: Re: [Jython-dev] Re: WEB-INF/classes & WEB-INF/lib/*.jar
> inaccessible in jython servlet
>
>
> >
> > PyServlet will get the logic for free from the classloader that loaded
> > jython.jar (but only when jython.jar is loaded from
> > <context>/WEB-INF/lib). What we need to add is only the inspection of
> > classes and jars found on ../lib and ../classes. The actual classloading
> > magic is already handled by tomcat's servlet context logic.
> >
> > > I didn't test JSP, but I believe it should be the same as servlet.
> >
> > I have added this to PyServlet:
> >
> > props.setProperty("python.packages.directories",
> > "java.ext.dirs,pyservlet.lib");
> > props.setProperty("pyservlet.lib",
> > rootPath + File.separator +
> > "WEB-INF" + File.separator +
> > "lib");
> >
> > props.setProperty("python.packages.paths",
> > "java.class.path,sun.boot.class.path,"+
> > "pyservlet.classes");
> > props.setProperty("pyservlet.classes",
> > rootPath + File.separator +
> > "WEB-INF" + File.separator +
> > "classes");
> >
> > It seems to work, but I think we should have some kind of direct API for
> > this purpose.
> >
> > PySystemState.add_classpath(String directoryPath)
> > PySystemState.add_extdirs(String directoryPath)
> >
> > Any thoughs, Samuele?
> >
> > regards,
> > finn
> >
> >
> > _______________________________________________
> > Jython-dev mailing list
> > Jyt...@li...
> > http://lists.sourceforge.net/lists/listinfo/jython-dev
> >
>
>
> _______________________________________________
> Jython-dev mailing list
> Jyt...@li...
> http://lists.sourceforge.net/lists/listinfo/jython-dev
>
|