Willson Wong

Greenhorn
+ Follow
since Jun 11, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Willson Wong

Thanks for the encouragement. I have learnt a lot from the documented difficulties of others and now that I have a solution, it is only fair I contribute my share.
New discovery over the weekend: I can do page forwarding from a Jython servlet.
Been reading Jython Essentials and Jython for Java Programmers which are very informative, but have not been able to find documentation on how to do this (needed for a Controller in the MVC paradigm). It seems that all the methods available to a normal Java Servlet is also available to a Jython Servlet.
The following snippet worked for me:
20 years ago
Just wanted to post my recent experiences installing Jython on my Mandrake 8.2 server so I could run servlets written in Jython. I found that I could not import the standard java modules other than sys in my servlets. The error I kept encountering was "ImportError: Could not import module java" or something to that effect.
Interestingly, when I ran Jython on the console, import java went without a hitch. I think I know what happened now, because I got it fixed finally (after 2 days).
My script (in file hello2.py) is as follows:


I followed essentially the guide provided here: Jywiki
I downloaded the jython-21.class file from sourceforge and then ran the following:


Possible Problem 1 :
I installed the jython files into the /home/Jython-2.1 directory. This made it inaccessible to tomcat; maybe it was the directory name or maybe it was outside of the search tree.
Possible Problem 2 :
The classpath to the java libraries may have been undefined.
Solution :
In any case, the problems listed above were solved when I installed it into /usr/local/jython as follows:


Then I changed the appropriate entry in web.xml for python.home to point to /usr/local/jython
This fixed everything and now tomcat is happy to serve the hello1.py file as a servlet.
I read thru some of the mailing lists and I see some people having the same problem. I followed the fixes recommended in those mailing lists but it didn't help me. So I had to come out with my own solution. Hope this helps anyone who has encountered a similar problem with Jython. Jython is really nice to use.
20 years ago
I had a similar
Could not connect to the SMTP host: <myhost.company.com>, port: 25
problem except that I couldn't figure why it worked 2 months ago with my jsp script.
I tried and it was ok. Then I tried and I could not connect.
Then I checked /var/log/mail/warnings and found a
After editing the /var/spool/postfix/etc/hosts file to match and doing a reboot, the system then worked again and was about to send out javamail.
I think what happened was that the /var/spool/postfix/etc/hosts file was not allowing connections to be made to <myhost.company.com> on port 25. This is not obvious, as I had scanned (with nmap) port 25 on localhost and everything had seemed fine.
So sometimes, the fault is not in the jsp script but the server setup.
Hope this helps.
20 years ago