From: Eduardo J. F. C. <EFE...@sa...> - 2001-03-13 14:15:39
Attachments:
Hello.class
Hello.py
|
Sure, there it goes. I am posting the generated file too, in case someone wants to check if it = runs. Thanks. > >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>> >It's hard to tell without the servlet file, but make sure the file = Hello.py >has a single class called 'Hello' that extends from HttpServlet: > >class Hello(HttpServlet): > ... > >Could you post the servlet code as this would help tremendously. > >hope this helps, > >brian -- Eduardo J. Fern=E1ndez Corrales |
From: Eduardo J. F. C. <EFE...@sa...> - 2001-03-13 15:50:53
|
Robert, I have tried with your code and it still does not work. The same happens with the code sent by Brian Zimmer. That is: the servlet just hangs there doing nothing and the apache error = log shows the same error that I sent in the first message in this thread. However with your code I don't get the deprecation warning I got before. Also I have checked and servlet.jar (which contains javax.servlet) is in = the classpath and in the Jserv wrapper.classpath. Best regards and thanks for your help. -- Eduardo J. Fernandez Corrales >>> "Robert W. Bill" <rb...@di...> 13/03/01 16:07 >>> On Tue, 13 Mar 2001, Eduardo Jesus Fernandez Corrales wrote: > > Sure, there it goes. > > I am posting the generated file too, in case someone wants to check if = it runs. "*" in import, Hmmmmmm. I tried the following with success... #spare imports removed and "*" replace with explicit package name from javax.servlet import http # prefix superclass with explicit package name "http." class Hello(http.HttpServlet): def doGet(req, res): res.setContentType("text/html") out =3D res.getWriter() out.println("<html><head><title>Hello World!</title></head>") out.println("<body><h1>Hello World!</h1></body></html>") Another suspicion is the classpath when you compile. Last I checked, you can compile something like above _without_ javax.servlet in the classpath and with no compile errors. However, at runtime you get a NPE, so you need to make sure javax.servlet.*... is in the classpath rather than relying on compile time errors to remind you (I don't remember the original post though, so this may not apply.) > >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>> > >It's hard to tell without the servlet file, but make sure the file = Hello.py > >has a single class called 'Hello' that extends from HttpServlet: I think there can be more than one class. If you have multiple classes in the file, the servlet class (the subclass of HttpServlet) should be the same name as the file. Cheers, Robert _______________________________________________ Jython-users mailing list Jyt...@li...=20 http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Eduardo J. F. C. <EFE...@sa...> - 2001-03-13 17:24:18
|
Still no success, after adding self to the doGet() method. (And now the = deprecation warning appears again) This is what appears in the apache error.log Java Traceback: at org.python.core.Py.AttributeError(Py.java:90) at org.python.core.PyObject.__getattr__(PyObject.java, Compiled = Code) at org.python.core.Py.initProxy(Py.java, Compiled Code) at Hello.<init>(Hello.java:139) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java, Compiled Code) at org.apache.jserv.JServServletManager.load_init(JServServletManag= er.java) at org.apache.jserv.JServServletManager.loadServlet(JServServletMan= ager.java) at org.apache.jserv.JServConnection.processRequest(JServConnection.= java) at org.apache.jserv.JServConnection.run(JServConnection.java) at java.lang.Thread.run(Thread.java:479) Traceback (innermost last): (no code object) at line 0 AttributeError: class 'Hello' has no attribute 'Hello' Thanks to everyone that is taking the time to check into this. Best regards. -- Eduardo J. Fernandez Corrales >>> "Robert W. Bill" <rb...@di...> 13/03/01 17:35 >>> On Tue, 13 Mar 2001, brian zimmer wrote: > Robert, >=20 > This works for you? Don't you need to add 'self' to the doGet()=20 > method? It's an instance method, no? YES! Thank you. Typing changes in reply instead of copy/paste=20 from the servlet was just error prone. Sooo sorry about that. Brian is right, it must have self as first parameter to method. =20 Robert |
From: brian z. <bz...@zi...> - 2001-03-13 14:49:55
|
This works for me: #from javax.servlet import * from javax.servlet.http import HttpServlet #from java.io import * class Hello(HttpServlet): def doGet(self, req, res): res.setContentType("text/html") out =3D res.getWriter() out.println("<html><head><title>Hello World!</title></head>") out.println("<body><h1>Hello World!</h1></body></html>") Notice I added 'self' to doGet() as it's an instance method. Also, be=20 careful with the from xx import * notation as it's not really recommended. Save all this in= =20 a file called Hello.py and it should work. brian At 03:14 PM 3/13/2001 +0100, Eduardo Jesus Fernandez Corrales wrote: >Sure, there it goes. > >I am posting the generated file too, in case someone wants to check if it= =20 >runs. > >Thanks. > > > > >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>> > >It's hard to tell without the servlet file, but make sure the file= Hello.py > >has a single class called 'Hello' that extends from HttpServlet: > > > >class Hello(HttpServlet): > > ... > > > >Could you post the servlet code as this would help tremendously. > > > >hope this helps, > > > >brian > >-- >Eduardo J. Fern=E1ndez Corrales > > |
From: Robert W. B. <rb...@di...> - 2001-03-13 15:05:31
|
On Tue, 13 Mar 2001, Eduardo Jesus Fernandez Corrales wrote: > > Sure, there it goes. > > I am posting the generated file too, in case someone wants to check if it runs. "*" in import, Hmmmmmm. I tried the following with success... #spare imports removed and "*" replace with explicit package name from javax.servlet import http # prefix superclass with explicit package name "http." class Hello(http.HttpServlet): def doGet(req, res): res.setContentType("text/html") out = res.getWriter() out.println("<html><head><title>Hello World!</title></head>") out.println("<body><h1>Hello World!</h1></body></html>") Another suspicion is the classpath when you compile. Last I checked, you can compile something like above _without_ javax.servlet in the classpath and with no compile errors. However, at runtime you get a NPE, so you need to make sure javax.servlet.*... is in the classpath rather than relying on compile time errors to remind you (I don't remember the original post though, so this may not apply.) > >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>> > >It's hard to tell without the servlet file, but make sure the file Hello.py > >has a single class called 'Hello' that extends from HttpServlet: I think there can be more than one class. If you have multiple classes in the file, the servlet class (the subclass of HttpServlet) should be the same name as the file. Cheers, Robert |
From: brian z. <bz...@zi...> - 2001-03-13 15:21:48
|
Robert, This works for you? Don't you need to add 'self' to the doGet() method? It's an instance method, no? brian At 09:07 AM 3/13/2001 -0600, Robert W. Bill wrote: >On Tue, 13 Mar 2001, Eduardo Jesus Fernandez Corrales wrote: > > > > Sure, there it goes. > > > > I am posting the generated file too, in case someone wants to check if > it runs. > >"*" in import, Hmmmmmm. I tried the following with success... > > >#spare imports removed and "*" replace with explicit package name >from javax.servlet import http > ># prefix superclass with explicit package name "http." >class Hello(http.HttpServlet): > def doGet(req, res): > res.setContentType("text/html") > out = res.getWriter() > out.println("<html><head><title>Hello World!</title></head>") > out.println("<body><h1>Hello World!</h1></body></html>") > > >Another suspicion is the classpath when you compile. Last I checked, you >can compile something like above _without_ javax.servlet in the >classpath and with no compile errors. However, at runtime you get a NPE, >so you need to make sure javax.servlet.*... is in the classpath rather >than relying on compile time errors to remind you (I don't remember the >original post though, so this may not apply.) > > > > >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>> > > >It's hard to tell without the servlet file, but make sure the file > Hello.py > > >has a single class called 'Hello' that extends from HttpServlet: > >I think there can be more than one class. If you have multiple classes >in the file, the servlet class (the subclass of HttpServlet) should be the >same name as the file. > >Cheers, >Robert > > > > >_______________________________________________ >Jython-users mailing list >Jyt...@li... >http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Robert W. B. <rb...@di...> - 2001-03-13 16:32:07
|
On Tue, 13 Mar 2001, brian zimmer wrote: > Robert, > > This works for you? Don't you need to add 'self' to the doGet() > method? It's an instance method, no? YES! Thank you. Typing changes in reply instead of copy/paste from the servlet was just error prone. Sooo sorry about that. Brian is right, it must have self as first parameter to method. Robert > At 09:07 AM 3/13/2001 -0600, Robert W. Bill wrote: > > > >On Tue, 13 Mar 2001, Eduardo Jesus Fernandez Corrales wrote: > > > > > > Sure, there it goes. > > > > > > I am posting the generated file too, in case someone wants to check if > > it runs. > > > >"*" in import, Hmmmmmm. I tried the following with success... > > > > > >#spare imports removed and "*" replace with explicit package name > >from javax.servlet import http > > > ># prefix superclass with explicit package name "http." > >class Hello(http.HttpServlet): > > def doGet(req, res): > > res.setContentType("text/html") > > out = res.getWriter() > > out.println("<html><head><title>Hello World!</title></head>") > > out.println("<body><h1>Hello World!</h1></body></html>") > > > > > >Another suspicion is the classpath when you compile. Last I checked, you > >can compile something like above _without_ javax.servlet in the > >classpath and with no compile errors. However, at runtime you get a NPE, > >so you need to make sure javax.servlet.*... is in the classpath rather > >than relying on compile time errors to remind you (I don't remember the > >original post though, so this may not apply.) > > > > > > > >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>> > > > >It's hard to tell without the servlet file, but make sure the file > > Hello.py > > > >has a single class called 'Hello' that extends from HttpServlet: > > > >I think there can be more than one class. If you have multiple classes > >in the file, the servlet class (the subclass of HttpServlet) should be the > >same name as the file. > > > >Cheers, > >Robert > > > > > > > > > >_______________________________________________ > >Jython-users mailing list > >Jyt...@li... > >http://lists.sourceforge.net/lists/listinfo/jython-users > |