Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setAttribute / getAttribute  RSS feed

 
Tina Ljuslin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
does anyone know what are causing this?
I've replaced the depricated methods getValue and putValue in my servlet with getAttribute and setAttribute, I don't get any compile errors but when I try to run the servlet I get this back:
javax.servlet.http.HttpSession: method setAttribute(Ljava/lang/String;Ljava/lang/Object V not found
java.lang.NoSuchMethodError: javax.servlet.http.HttpSession: method setAttribute(Ljava/lang/String;Ljava/lang/Object V not found at ........
???
what is this?
what is (Ljava/lang/String;Ljava/lang/Object V supposed to mean?
Does anyone know what can be wrong?
I feel a bit confused right now...
//tina
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Make sure that the servlet jar files are in the classpath of the server you are running. The jar files should be the same which you included while compiling.
Originally posted by Tina Ljuslin:
Hi,
does anyone know what are causing this?
I've replaced the depricated methods getValue and putValue in my servlet with getAttribute and setAttribute, I don't get any compile errors but when I try to run the servlet I get this back:
javax.servlet.http.HttpSession: method setAttribute(Ljava/lang/String;Ljava/lang/Object V not found
java.lang.NoSuchMethodError: javax.servlet.http.HttpSession: method setAttribute(Ljava/lang/String;Ljava/lang/Object V not found at ........
???
what is this?
what is (Ljava/lang/String;Ljava/lang/Object V supposed to mean?
Does anyone know what can be wrong?
I feel a bit confused right now...
//tina

 
Tina Ljuslin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works when I'm using the depricated methods, and all the other servlets in the same directory are working fine. Can it still be something with the jar files?
//tina
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think you still did not understand what I said. Let me explain in detail. You have stated that you do not have problems in compiling. So notedown the classpath and make sure that the server has those files in the classpath. You did not mention the server you are using and the platform (windows/unix). I could have helped you more if you have mentioned that. If it is jserv then open jserv.properties and add "wrapper.classpath=classpath you found while compiling". If you are using tomcat server then open the script file by which you start the server. Include the classpath here properly.

Hope you understand what I trying to explain.

S.Mohamed Yousuff

 
Tina Ljuslin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohamed,
thanks for your replies.
I'm using websphere 3.5 on windows2000.
The class is where it is supposed to be and the classpath is properly set.
Every other servlet I write works fine, its just those two methods that doesn't work.
Could it be that the earlier methods are supported by this server and not the new ones? (maybe silly question?)
Very thankfull for your help!!!
//tina
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe Wepsphere 3.5 supports the older Servlet API.
Bosun
 
Julio Lopez
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you go to your WebSphere Administration Console, expand out the machine name, expand out the server you are dealing with and highlight the servlet engine of that server there is an option to change to Servlet 2.2/JSP 1.1 Full Compliance Mode. If you do this your problem should be solved.
Julio Lopez
M-Group Systems
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!