76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
From: rhww at erols.com (R Wentworth)
|
|
Date: Mon, 19 Apr 1999 19:21:22 -0400
|
|
Subject: Using JPython in servlets?
|
|
Message-ID: <371BBA72.5D24945F@erols.com>
|
|
Content-Length: 1853
|
|
X-UID: 1688
|
|
|
|
I don't know if this newsgroup is intended to deal with
|
|
issues regarding JPython (implementation of Python
|
|
that is tightly coupled to Java and runs under the JVM),
|
|
but if this is an appropriate forum...
|
|
|
|
Can anyone tell me the secret(s) to getting JPython servlets
|
|
to run, or even allowing JPython classes to successfully be
|
|
accessed from a Java servlet? (This is under JRun, latest version,
|
|
and Java 1.1.7, running under Solaris.) I'm running into
|
|
a seemingly bizarre problem.
|
|
|
|
Here is a simple example of what I'm seeing:
|
|
|
|
-- J.java --
|
|
|
|
public abstract interface J {}
|
|
|
|
-- X.py --
|
|
|
|
import J
|
|
class X(J):
|
|
pass
|
|
|
|
-- Test.java --
|
|
|
|
...working servlet code...
|
|
new X();
|
|
...working servlet code continued...
|
|
|
|
----------------
|
|
|
|
Symptom. Access the servlet GET method via the web, and see
|
|
a page titled "JRun Servlet Error":
|
|
|
|
Test:
|
|
|
|
Traceback (innermost last):
|
|
(no code object) at line 0
|
|
AttributeError: class 'X' has no attribute 'X'
|
|
|
|
----------------
|
|
|
|
I *have* managed to discover one other circumstance
|
|
that produces this same type of error. Suppose I
|
|
have a Java application (as opposed to a servlet)
|
|
which tries to do "new X()". This works just fine
|
|
if CLASSPATH is set to the value seen by servlets,
|
|
i.e., a CLASSPATH including "jpython.jar"; however,
|
|
if I alter the CLASSPATH so that it points to either
|
|
no jpython libraries, or to an unzipped version of
|
|
jpython.jar, then I get a "class 'X' has no attribute 'X'"
|
|
error. So it seems like the error may have something
|
|
to do with not being able to get at appropriate JPython
|
|
library code. But the servlet CLASSPATH *does* include
|
|
"jpython.jar", so this wouldn't seem to explain the
|
|
problem.
|
|
|
|
Anyone have any clue whatsoever about what might be
|
|
wrong with the configuration, or how I might go
|
|
about debugging this??
|
|
|
|
Thanks in advance,
|
|
Robert Wentworth
|
|
rhww at erols.com
|
|
|
|
|
|
|
|
|