Actually, Jython uses the system classloader if the
sys.getClassLoader() is None. The system classloader is the one set
up from the classpath.
>From my understanding of servlets, each gets a separate classloader so
the engine can safely reload the servlet classes on command. I don't
know enough about servlets to say how you're supposed to get to that
classloader though. I suppose getClass().getClassLoader() in the
servlet that's using the interpreter would get the correct one. Give
it a shot with that classloader. If that fails I'll up the ante and
actually read about how servlets work :)
Charlie
On 8/25/06, MARTINEZ-DOMINGUEZ Roberto
<roberto.martinez-dominguez@...> wrote:
> Sounds good, but changing jython's classloader for the one of the system, ie:
>
> sys.setClassLoader(java.lang.ClassLoader.getSystemClassLoader())
>
> , throws a java.lang.NoClassDefFoundError: org/python/core/PyFunctionTable ; even undoing changes the error appears,
> until a restart of the servlet engine... It seems that the servlet engine's classloader has no idea of jython's existence.
> (for info, before changing anything, sys.getClassLoader() returns None, and java.langClassLoader.getSystemClassLoader() returns the
> servlet engine's classloader (I guess)...)
>
> I'll keep on trying, any hints?
> Thanks
>
> -----Mensaje original-----
> De: Charlie Groves [mailto:charlie.groves@...]
> Enviado el: viernes, 25 de agosto de 2006 4:51
> Para: MARTINEZ-DOMINGUEZ Roberto
> Asunto: Re: [Jython-users] Class not found in package, even being sought by jython...
>
> On 8/24/06, MARTINEZ-DOMINGUEZ Roberto
> <roberto.martinez-dominguez@...> wrote:
> > - The need to set the full classpath creates a strong dependency on the system, as the application is deployed to a very
> > system-dependent directory... I'd love to suppress this dependency, so I'm still listening for more hints...
>
> Hmm, can you get the ClassLoader from your servlet engine? If so, try
> calling setClassLoader on PySystemState. I think that'll let it find
> things using the engine's special classloader. You'll still need to
> do all of the fancy add_package stuff though.
>
> Charlie
>
>
>
> -- Disclaimer ------------------------------------
> Ce message ainsi que les eventuelles pieces jointes constituent une correspondance privee et confidentielle a l'attention exclusive du destinataire designe ci-dessus. Si vous n'etes pas le destinataire du present message ou une personne susceptible de pouvoir le lui delivrer, il vous est signifie que toute divulgation, distribution ou copie de cette transmission est strictement interdite. Si vous avez recu ce message par erreur, nous vous remercions d'en informer l'expediteur par telephone ou de lui retourner le present message, puis d'effacer immediatement ce message de votre systeme.
> ***
> This e-mail and any attachments is a confidential correspondence intended only for use of the individual or entity named above. If you are not the intended recipient or the agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender by phone or by replying this message, and then delete this message from your system.
>
|