java.lang.NoSuchMethodError
843836May 6 2004 — edited May 7 2004Ok, my servlet code compiles just fine but when I run it, Oracle HTTP Server Powered by Apache/1.3.12 Server give me an Internal Server Error page. I check the error log and it says:
java.lang.NoSuchMethodError: javax.servlet.http.HttpSession: method setAttribute(Ljava/lang/String;Ljava/lang/Object;)V not found
at java.lang.Throwable.fillInStackTrace(Native Method)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:320)
at org.apache.jserv.JServConnection.run(JServConnection.java:188)
at java.lang.Thread.run(Thread.java:479)
How can it not be found? Wouldn't this have been caught by the compiler?
I have seriously been looking at this problem for 2 days and searching for a solution. I've tried changing CLASSPATH and PATH to no avail. Any suggestions would be greatly appreciated. I would be happy to post any other information that is needed.
Thanks!
P.S. I suspect it's a path error because when I change the setAttribute() to the deprecated putValue() the code compiles with complaints about deprecation but I don't see any complaints about putValue() not being found.
I'm also wondering how jsp works. I wrote a JSP page (search.jsp) which accesses a Vector my servlet code is trying to put into the session. I found a search.class which I assume came from the search.java file in the same directory which looks very much like the servlet code I wrote. This is where I think the error is occuring. In other words, in search.java (which I didn't write), setAttribute() is not being found. Is this error occuring because search.java doesn't use my classpath?
Thanks again.