Is javax.servlet.http.HttpSession is Serialized

Hi All,
I just want to know, whether HTTPSession i.e., HttpSession got from HttpServletRequest is serialized?
As per my opinion its serialized.
Thanks in advance.
Pankaj Chomal

In a servlet container you obtain an object of the type implementing HttpSession. The very type can implement Serializable or not, depending on the implementation, the API does not mandate this.
As if I had seen somewhere a hint that you should only put Serializable stuff into the session, that is, that very container appears to use serialization to distribute the session information in a cluster.
What do you need?

Similar Messages

  • Custom Class file errors out on import javax.servlet.http.HttpSession

    I am trying to write a class file to handle events. This is a test class file copied from the UIX Docs. When I put this in JDeveloper 903 ,and build it the compiler gives the error:
    Error(2,27): cannot access class javax.servlet.http.HttpSession; file javax\servlet\http\HttpSession.class not found
    I am not sure what is the problem? Can anyone please help?
    Here is the code:--
    package mypackage1;
    import javax.servlet.http.HttpSession;
    import oracle.cabo.servlet.Page;
    import oracle.cabo.servlet.BajaContext;
    import oracle.cabo.servlet.event.PageEvent;
    import oracle.cabo.servlet.event.EventResult;
    public class MyClass
    /** This is handleStoreNameEvent version 1 */
    public static EventResult handleStoreNameEvent(BajaContext context,
    Page page,
    PageEvent event)
    String userName = event.getParameter("txt1");
    HttpSession session = context.getServletRequest().getSession(true);
    session.putValue("User Name", userName);
    Page nextPage = new Page("NextPage");
    return new EventResult(nextPage);
    }

    Hi, you are missing the servlet.jar file from your classpath.
    In JDeveloper, you can add this by opening up your project -> libraries and adding the servlet runtime library.

  • Error 500: javax.servlet.http.HttpSession: method getServletContext()Ljavax

    I think that I have an older version of servlet class files... is there any way to solve the following issue?
    in old version, getServletContext() method isn't included in HttpSession object. is there any way to get around this problem? cuz our client has an old version... i am not sure if it's possible...
    HttpSession session = e.getSession () ;
    // Retreive our context so we can initialize the runtime settings.
    ServletContext context = session.getServletContext () ;
    i'd greatly appreciated in advance...

    sorry, in e.getSession(), "e" object comes from "HttpSessionBindingEvent"

  • Why my servlet receives NoClassDefFoundError : javax/servlet/http/HttpSession

    I developed an application which has one servlet.
    The war context-root that has the servlet is 'workflowclient'.
    When invoking the servlet with URL "http://localhost/workflowclient/WfAgentManagerSRMIServlet, an exception with NoClassDefFoundException is raised.
    Why ?
    The fortune example operates well.
    Please let me know how to solve this problem.

    Hi,
    I would like to go through your code, if it isn't properietry, please send me the codes so that I can have a look and test at my end to provide you results.
    Thanks & Regards
    Ganesh .R
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Package javax.servlet.http does not exist

    Hello All,
    A few problems here
    1. My classpath doesnt seem to work.:
    .;"C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
    2. As a result, i get many errors in my simple code, but there are still a few that are not related to javac not recognizing the servlet api.
    I also tried setting the classpath at the command line (event hough its temporary)
    set classpath="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
    but the servlet package is still not recognized
    I have 2 classes, one to read the database connection details from a file and another class, my servlet.
    Servlet Code:
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class CustomQuery extends HttpServlet
         public void init() throws ServletException
              EstablishDBConnetion.establishConnection();
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              response.setContentType("text/html");
              PrintWriter printer = new response.getWriter();
              String title = "Result from custom query";
              Statement stmt = EstablishDBConnetion.establishConnection.con.createStatement();
              ResultSet rs = stmt.executeQuery("select customerID from customer");
              while(rs.next())
                   printer.println("<html> <head><title>" + title + "</title><br><br><table border=\"0\"> <tr><td>" + rs.getString(1));
              rs.close();
              stmt.close();
              EstablishDBConnetion.establishConnection.con.close();
    Database connection code
    import java.io.*;
    import java.sql.*;
    import java.util.StringTokenizer;
    class EstablishDBConnetion
         public static void establishConnection()
              try
                   String dbDriver = "";
                   String dbUrl = "";
                   String dbName = "";
                   String dbUser = "";
                   String dbPassword = "";
                   String newLine = "";
                   BufferedReader fileRead = new BufferedReader(new FileReader("connection.txt"));
                   boolean readerStatus = fileRead.ready();
                   newLine = fileRead.readLine();
                   while (readerStatus)
                        StringTokenizer st = new StringTokenizer(newLine, ",");
                        while (st.hasMoreTokens())
                            dbDriver   = st.nextToken();
                           dbUrl      = st.nextToken();
                           dbName     = st.nextToken();
                            dbUser     = st.nextToken();
                            dbPassword = st.nextToken();
                        readerStatus = fileRead.ready();
                   Class.forName(dbDriver);
                   String url = dbUrl + dbName;
                   System.out.print(url);
                   Connection con = DriverManager.getConnection(url, dbUser, dbPassword);
              catch (IOException e)
                   System.out.println("IO exception in establishConnection()");
                   e.printStackTrace();
              catch (java.lang.Exception ex)
                   System.out.println("General exception in establishConnection()");
                   ex.printStackTrace();
         public static void main(String[] args)
              //EstablishDBConnetion edbc = new EstablishDBConnetion();
              establishConnection();
    }also, full error list below
    CustomQuery.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    CustomQuery.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    CustomQuery.java:7: cannot find symbol
    symbol: class HttpServlet
    public class CustomQuery extends HttpServlet
    ^
    CustomQuery.java:10: cannot find symbol
    symbol : class ServletException
    location: class CustomQuery
    public void init() throws ServletException
    ^
    CustomQuery.java:16: cannot find symbol
    symbol : class HttpServletRequest
    location: class CustomQuery
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    ^
    CustomQuery.java:16: cannot find symbol
    symbol : class HttpServletResponse
    location: class CustomQuery
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    ^
    CustomQuery.java:16: cannot find symbol
    symbol : class ServletException
    location: class CustomQuery
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    ^
    CustomQuery.java:19: package response does not exist
    PrintWriter printer = new response.getWriter();
    ^
    CustomQuery.java:24: cannot find symbol
    symbol : variable establishConnection
    location: class EstablishDBConnetion
    Statement stmt = EstablishDBConnetion.establishConnection.con.createStatement();
    ^
    CustomQuery.java:39: cannot find symbol
    symbol : variable establishConnection
    location: class EstablishDBConnetion
    EstablishDBConnetion.establishConnection.con.close();
    ^
    10 errors
    I appreciate your help
    Message was edited by:
    paulchwd
    null
    Message was edited by:
    paulchwd

    The library is in tomcat/common/lib, not in tomcat/lib.

  • Javax.servlet.http.* package does not exist ?

    i am using j2sdk which does not include servlets, so in the forums i found that including servlet.jar file in jdk1.6.0\jre\lib\ext javax.servlet.* was included but javax.servlet.http did not ..... now this is strange either both do not work or both work. here is the code
    import javax.servlet.*;
    import javax.servlet.Http.*;
    class login
    error is package javax.servlet.Http.*; does not exist.

    Dear,
    javax.servlet is one of the J2EE (Java Enterprise Edition) packages that is not included in the J2SE (Java Standard Edition) , so that one used for developing server side application.
    I hope this help.
    Regards.

  • Error:    package javax.servlet.http does not exist

    Hi all,
    How do I import javax.servlet?
    package com.example.web;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class BeerSelect extends HttpServlet {
      public void doPost(HttpServletRequest request,
                         HttpServletResponse response)
                         throws IOException, ServletException {
        response.setContentType("text/html");
        PrintWriter out = response.getWrite();
        out.println ("Beer Selection Advide<br>");
        String c = request.getParameter("color");
        out.println ("<br>Got beer color " + c);
    }What does this error mean? The error message:
    Compiling 1 source file to C:\Program Files\Apache Software Foundation\MyProjects\J2EE\build\classes
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:3:
    package javax.servlet does not exist
    import javax.servlet.*;
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:4:
    package javax.servlet.http does not exist
    import javax.servlet.http.*;
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:7:
    cannot find symbol
    symbol: class HttpServlet
    public class BeerSelect extends HttpServlet {
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:8:
    cannot find symbol
    symbol  : class HttpServletRequest
    location: class com.example.web.BeerSelect
      public void doPost(HttpServletRequest request,
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:9:
    cannot find symbol
    symbol  : class HttpServletResponse
    location: class com.example.web.BeerSelect
                         HttpServletResponse response)
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:10:
    cannot find symbol
    symbol  : class ServletException
    location: class com.example.web.BeerSelect
                         throws IOException, ServletException {
    6 errors
    BUILD FAILED (total time: 0 seconds)Thank you.

    Hi,
    The file servlet-api.jar / servlet.jar is not available in your classpath.
    To compile an Servlet you need the jar file to be in classpath.
    The jar file can be found in your webserver / application server lib folder.
    Regards,
    Zack

  • Package javax.servlet does not exist, package javax.servlet.http does not

    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    I tried locating these packages, but in vain. I also tried setting the CLASSPATH to many values, still it did not work.
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    Thank you very much.

    davidgoodman wrote:
    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    What servlet/JSP engine do you plan to deploy to? Tomcat, perhaps?I think it's Tomcat (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14). Are there other engines that come with NetBeans IDE 6.0 (when I downloaded NetBeans, I chose ALL)
    >
    If so, you'll need to put the servlet JAR in your CLASSPATH. (servlet-api.jar for Tomcat 5.5 and earlier, servlet.jar for 6.0 >and later.)
    I tried locating these packages, but in vain.
    You won't find them until you realize that you have to deploy that servlet someplace.How to deploy?
    I also tried setting the CLASSPATH to many values, still it did not work.
    See above. What were you planning to set CLASSPATH to?First I set to:
    C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\lib (because I found jar named servlet-api.jar in this folder)
    Later I added this:
    C:\Program Files\Java\jdk1.6.0_04\lib (out of trial-and-fail)
    Finally I added some paths that lead to a library such as
    C:\Program Files\glassfish-v2\lib
    C:\Program Files\glassfish-v2\lib\ant\lib
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    You have to get a servlet/JSP engine. Step 1.Thank you for your help

  • Javax.servlet.http.* error

    I am trying to compile a file, but got the error message "package javax.servlet.http does not exist",
    "import javax.servlet.http.*"
    It seems to me that this particular package is missing. how and where exactlly do I get this particular package and make it to work??
    thanks

    As you are using the package I assume that you're targetting a servlet engine (such as Tomcat) or a J2EE server. The package is in servlet.jar which is part of the binary release of the container that you are using.
    You can download containers from the following links:
    http://java.sun.com/products/servlet/index.html
    http://jakarta.apache.org/tomcat/index.html

  • Why I  got package javax.servlet.http do not exist

    I have package javax.servlet.http do not exist problem, can anyone tell me why?
    Thank you

    Hi all
    Thank you for all kinds of replies. It is Windows problems. but I got a new questions here
    1) it seems I don't need to including
    install_dir\common\lib\jsp-api.jar in classpath!!
    2) when I try servletUtilities,
    from http://www.coreservlets.com/Apache-Tomcat-Tutorial/#Configure-Tomcat
    I got error
    HelloServlet3.java:23: cannot resolve symbol
    symbol : variable ServletUtilities
    location: class coreservlets.HelloServlet3
    out.println(ServletUtilities.headWithTitle(title) +
    ^
    1 error
    both my HelloServlet3 and servletUtilities under
    WEB-INF\classes\coreservlets
    thank you

  • Package javax.servlet.http does not exists

    Hi,
    I am new to J2EE and am writing my first servlet. I tried to compile a servlet I wrote and got the following error.
    "package javax.servlet.http does not exists".
    What do i do to correct this error?
    Also is there any links which has a complete servlet tutorial.
    Please advice
    Thanx

    Most probably you need to include the servlet-api library in your classpath when compiling.
    You should find this file in the lib directory of your container.
    It will be called servlet-api.jar (Tomcat) or j2ee.jar (Suns J2EE server) or something along those lines.
    The j2ee tutorial is a decent place to start learning about servlets...
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
    Good luck,
    evnafets

  • How solve  import javax.servlet.http.HttpServlet err import javax.servlet.

    Hi
    I am trying to compile one servlet code using commancd prompt and i get
    package javax.servlet.http does not exist import javax.servlet.http.HttpServlet;
    error for following code
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    public class SampleServlet extends HttpServlet
    public void saveToSession(HttpServletRequest request)
         String testparam = request.getParameter("testparam");
         request.getSession().setAttribute("testAttribute", testparam);
    please help me

    Try giving servlet..jar path in the class path variable

  • Cannot Import javax.servlet.* and javax.servlet.http.*

    Hello,
    I am a University Student and now doing a project using Servlet and JSP
    I have installed WinXP and Tomcat 5.0 on my computer
    When I compile the servlet , there are error messages "package javax.servlet does not exist" and "package javax.servlet.http does not exist" coming out.
    I have set the classpath already
    i.e. %CATALINA_HOME%\common\lib\servlet-api.jar;%CATALINA_HOME%\common\lib\jsp-api.jar
    ( Of course "%CATALINA_HOME%" = my folder that install the Tomcat )
    Can Anybody Explain what is happening and suggest a solution to me?
    Please give a hand.

    When you ran that command, what happened? Let javac.exe tell you the right answer.
    I'd advise two things:
    (1) Installing any s'ware in a directory whose name contains spaces (e.g., "Apache Software Foundation" or "Tomcat 5.0") is a very bad idea, IMO. I'd reinstall to a new directory.
    (2) Your HelloServlet.java servlet probably doesn't have a package statement in it. Tomcat 5.0 won't play nicely with servlets or beans that aren't in packages. I'd add one and use the -d . option on javac.exe to make sure it created the package directory structure for me.

  • SAPNoClassDefFoundError: javax.servlet.http.HttpSessionListener

    Hi,
    I have deployed an application in to Netweaver WAS, and have given a hard reference to one of the libraries which is already deployed in the same server. But when starting the application, it gives an error telling that <b><i>javax.servlet.http.HttpSessionListener</i></b> is not available. I gave the servlet.jar in the classpath and still its giving the same error.
    Can anyone tell me what can i do to get rid of this problem? This is the error message iam getting in the defaulttrace file:
    <b><i>The error is: com.sap.engine.frame.core.load.SAPNoClassDefFoundError: javax.servlet.http.HttpSessionListener</i></b>

    Hi Venkat
    Check in the visual admin-deploy service,whether or not your application is deployed.Try to start it.
    Also check out the below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/1b/92e4e701b242c2833a7adde6ecad09/frameset.htm
    Message was edited by:
            Rajat Anand
    Message was edited by:
            Rajat Anand

  • Package javax.servlet.http

    Hi,
    i work whith Solaris 2.6
    my java version is 1.3.0
    The package javax.servlet.http is not a standard package?
    Where he is?
    I can download it?
    look my error when i start weblogic server:
    Servlet failed with Exception
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
    Thanks!

    Download latest version of j2ee.jar from http://java.sun.com/j2ee/index.jsp
    Amar.

Maybe you are looking for

  • MTP Device Issue When trying to Connect my 5250 to...

    Hi All, I don't know what to try anymore. My phone just cannot connect to PC suite via USB cable. The bubble MTP device detected is popping up all the time and the connection is refreshed constantly so the devices cannot really connect. I read articl

  • Nested tables and subforms (Web Dynpro Java)

    Hi to all you gurus, my scenario is the following: I have 3 nested nodes in a view context like these DEFECTS_NODE |          ACTIONS_NODE |           |        SUBS_NODE |           |          |__action value |           |          |__defect value | 

  • New computer files transfer

    Just bought a new macbook and wanting to transfer files from an imac (which has OX10.2.8) using firewire cord. When I have the imac set up as an external drive (icon showing) I get a message on the macbook saying that the imac does not have OS X (whi

  • "Row modification counter" in T-code db02

    Hi experts, In Transaction code DB02, when you enter the name of a table in Detailed analysis, you can see some indicators like Reserved (KB), Data size (KB), Total rows, Row modification counter... Do you know what does the indicator "Row modificati

  • The body of the mail message is blank

    The preview shows the first few lines of the message but when I open the message the body is blank. It does show the sender, receivers and subject line, but the body is blank. How do I fix this?