aspose file tools*
The moose likes JSP and the fly likes Setting priority of server jar file default imports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Setting priority of server jar file default imports" Watch "Setting priority of server jar file default imports" New topic
Author

Setting priority of server jar file default imports

Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
I have a strange problem.. I am using an Oracle 9 HTTP server to run my JSPs.
I developed on Tomcat and all sessions worked correctly. However, when moving my site over to the Oracle 9i HTTP server, it gives an error saying that the method session.setAttribute (as well as getAttribute and other session methods) are not found.
I thought that it might be since the servlet.jar included in Oracle 9i was oudated (it's creation date was almost two years older!) so I simply replaced that file with Tomcat's servlet.jar but the problem persists.
Is there another file I should be looking to replace this method within?.. or, better yet, is there a way to simply prioritize the intended servlet.jar file and place it at the top of the priority list?
I included the servlet.jar as <%@ include file = "/WEB-INF/lib/servlet.jar" %> at the beginning of my jsp but it is still taking the other predefined version. (I still replaced every servlet.jar I found with the newer one... this one in /WEB-INF/lib/ is only used for this include file line)
Using another JSP server (such as Tomcat) is not an option since it would disrupt other services which cannot be moved over.
Here is the error message I recieve any time I use .setAttribute or .getAttribute..

[ May 06, 2003: Message edited by: Jeff Grant ]
[ May 06, 2003: Message edited by: Jeff Grant ]
Michael Zalewski
Ranch Hand

Joined: Apr 23, 2002
Posts: 168
You really will need to use the version of servlet.jar that came with your application container.
I suppose your version of Oracle 9i supports the Servlet API at v 2.1 or less. The methods named HttpSession.setAttribute and HttpSession.getAttribute were added in Servlet API v 2.2.
You have two choices. 1) Replace .setAttribute with .putValue and replace .getAttribute with .getValue. That will be compatible with v 2.1 of the servlet API. (But .getValue and .putValue are now deprecated, so you will get warnings when you compile for Tomcat).
Or 2) Upgrade your Oracle 9i to a more current version which supports Servlet 2.2.
You should not try to put servlet.jar into your classpath, because the HttpSession object which your version of Oracle 9i puts in your session does not support .getAttribute and .putAttribute. Putting in a newer version of servlet.jar will not make it so that the newer methods will work.
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
Wonderful!
Strange that http://java.sun.com/products/servlet/industry.html says that Oracle 9i has support for Servlets v2.3... but using session.putValue worked great!
I researched Servlets v2.1 http://java.sun.com/products/servlet/2.1/servlet-2.1.pdf and the only thing I cannot seem to figure out is why session.setMaxInactiveInterval(int) is still not working... but I will figure it out! It's just saying that the method is not found just like when I was using setAttribute.
Thanks though, I would have figured this out a while ago but I thought it was setValue not putValue so I was completely stumped... thanks again!!!
-Jeff
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
Strange... I cannot seem to get session.setMaxInactiveInterval(900) to work... anyone have any thoughts on that?
Perhaps it's called something else in whatever version of servlet my Oracle server is running?
Thanks.
 
jQuery in Action, 2nd edition
 
subject: Setting priority of server jar file default imports