Hi people,

i'm experiencing a strange session behaviour in several of my projects
running on Tomcat 5.5.12. When the page is being rendered inside servlet's
doGet (or doPost, actually it doesn't matter), i call
request.getSession(true) many times in order to get data, and at random
times it suddenly returns null, eventhough by specification it MUST return a
valid session. That, of course, crashes my application in random time
intervals. Probably anybody has experienced the same and could help me solve
this problem?? I'm totally confused with tomcat, because not a single forum
has a post related to this. Here is some of my code:


// Servlet class
public class IntranetServlet extends HttpServlet {
    // called from doGet && doPost
    public void syncGet(HttpServletRequest request, HttpServletResponse
response) {
        ResourceManager resourceManager = new ResourceManager(this, request,
response);
        VelocityEngine ve = ResourceManager.getTemplateEngine();
        ....
    }
}

// Code which causes null to pop-up
public class ResourceManager {
    private static HttpServlet servlet;
    private HttpServletRequest request;
    private HttpServletResponse response;

    public ResourceManager(HttpServlet aServlet, HttpServletRequest
aRequest, HttpServletResponse aResponse) throws FileUploadException {
        servlet = aServlet;
        request = aRequest;
        response = aResponse;
        ....
    }

    public HttpSession getSession() {
        HttpSession session = request.getSession(true);
        // null, randomly
        System.out.println(session);
        return session;
    }



it's just a standard session handling, nothing else. And there are no code
that explicitly does anything else but session.set/get/removeAttribute on
the session.

i'll appreciate any help alot.


vienzo
--
View this message in context: 
http://www.nabble.com/Tomcat%27s-getSession%28true%29-returning-null-t1405617.html#a3783393
Sent from the Tomcat - User forum at Nabble.com.

Reply via email to