dcsimg
Servlet produces a java.lang.NoSuchMethodError (at HttpServlet.setAttribute(String, Object) when viewed through a browser but compiles fine.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mark_Goddard
Posted On:   Thursday, April 12, 2001 02:24 AM

I'm only learning servlets at the moment so this may be a really noddy question.

I've written a servlet which compiles fine but when viewed through a browser it causes an internal servlet error saying java.lang.NoSuchMethodError at the line containing
session.setAttribute("Int", new Integer(50));

I'm using Java Web Server. (But I've also tried it on JSWDK 1.0.1 and that has the same problem).

Any ideas on how to get this to work would be much appreciated!

Thanks,

Mark

Re: Servlet produces a java.lang.NoSuchMethodError (at HttpServlet.setAttribute(String, Object) when viewed through a browser but compiles fine.

Posted By:   Michael_Wax  
Posted On:   Thursday, April 12, 2001 08:01 AM

My guess is that you are using a newer version of the JDK to compile, and an old version to run the servlets. The method "setAttribute" replaces an older method, "putValue". Check the JRE version that you're using to run the servlets. (If you're not sure, get a version of snoop servlet, which usually comes with the servlet SDK, and call it from a browser; it will tell you.)
About | Sitemap | Contact