From: <ra...@cs...> - 2008-02-26 04:45:52
|
dear all, i'm try jython servlet, i'm using jdk1.3.1_20 and jakarta-tomcat-3.2.3, # Filename: JythonServlet.py from javax import servlet import random # Not used, just here to test module imports class JythonServlet(servlet.GenericServlet): def service(self, req, res): res.setContentType("text/html") toClient = res.getWriter() toClient.println("""<html><body> This is a Servlet of the Jython variety. </body></html>""") and then : set TOMCAT_HOME=c:\jakarta-tomcat-3.2.3 set JAVA_HOME=c:\jdk1.3.1 structure my web : %TOMCAT_HOME%\webapps\ %TOMCAT_HOME%\webapps\jython The context's root %TOMCAT_HOME%\webapps\jython\WEB-INF %TOMCAT_HOME%\webapps\jython\WEB-INF\classes Servlet classes %TOMCAT_HOME%\webapps\jython\WEB-INF\lib Library archives compile with : jythonc -w . JythonServlet.py abd Add jython.jar to the context's lib directory. This is the preferred way. Making Jython's lib Directory Available to Servlets : % TOMCAT_HOME%\webapps\jython\ WEB-INF\jylib\ Lib set TOMCAT_OPTS=-Dpython.home=%TOMCAT_HOME%\webapps\jython\WEB-INF\jylib and i'm tyr it : http://localhost:8080/jython/servlet/JythonServlet but i see error : Error: 500 Location: /jython/servlet/JythonServlet Internal Servlet Error: java.lang.ClassCastException: JythonServlet at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289) at org.apache.tomcat.core.Handler.service(Handler.java:254) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:479) any solution ? rachmat |