From: Robert W. B. <rb...@di...> - 2001-03-21 20:19:01
|
[Niklas Lindstr=F6m] <snip> > >> 2. [Might be off-topic] > >> When running two servlets -- compiled from Jython-sources -- in two > >> different contexts under Tomcat, I run into problems. Tomcat cannot fi= nd > the > >> second servlet, unless I put its classes (regular + inner) in the same > >> context (i.e. in the same (WEB-INF/classes). At first, I thought it wa= s > due > >> to the "inner class"; but it seems that I have to move both in order f= or > the > >> servlet to be found. This does not seem to happen to regular > Java-servlets > >> though, which is why I wonder if it's a Jython-problem. > >> My question here is really if someone else has had any problems li= ke > >> this and has a suggestion at hand; otherwise, I will do some more > tracking > >> of the problem to see what I might have overlooked. > > > >I've only had success with the inner-class and class-proper in the same > >context. The good stuff in Servlet2.2 containers is the ease of making > >self-contained webapps, so I'm a bit confused about what the advantages = of > >defeating this feature would be. (or I misunderstood :) > > >=20 > I've probably described things rather poorly. :) I do want to have inner = and > proper in the same place. But two servlets (i.e. 2 * 2 files), each runni= ng > in it's own context, didn't seem to work. As if the first, when initializ= ed > by the engine (Tomcat), somehow locks stuff that make Jython unable to fi= nd > the other servlet. > It's a bizarre problem (if I for instance remove the first servlet fr= om > Tomcat initialization, the other is suddenly found). > I'm too tired to dare try and explain further I'm afraid :); I'll try= to > produce a better analysis and description later (I don't even have access= to > the machine right here.) >=20 > Hopefully; I haven't missed something obvious (since it's such a strange > problem). Ahhh, I did misunderstand before- ooops. Well, it may not help, but I've witnessed jython servlets running in many contexts. What is likely different is that these contexts were all=20 self-contained. This means _each_ WEB-INF/lib folder has it's own jython.jar (maybe that's why I haven't seen similar troubles?) It seems reasonable to give this a try. For jythonc compiled files it creates some troubles with python.home and finding the Lib directory. org.python.util.PyServlet can help here because it allows you to use web.xml to set properties, or you could try freezing all the required modules into a jar also in each WEB-INF/lib. (I never realized how much duplication this sounds like until I tried describing it.) cheers, Robert |