I've created a web app that uses OAuthentication to log in to Twitter and the login process works successfully on a single servlet. On that servlet I get the session for the user. However, once I move to another servlet for the first time and try to get the session again, a new one is created. I thought the web app would read client cookies and create one session for each client? Below, you can see that the client session ID remains the same throughout the OAuth process but changes on the new servlet. I put in encodedURLS in case cookies didn't work as well. But once I redo the OAuth process and try again everything syncs up...
Creating Authentication Session...
Session ID before getting Request Token: 5E5932F144E4838EFDD398407D4BA351
Retrieving request token...
Request token retrieved...
Session ID after getting Request Token: 5E5932F144E4838EFDD398407D4BA351
Swapping request token for access token...
Session ID: F97463A1A2D239B7E6D15D1C5FDAE26B
Sep 9, 2010 1:37:03 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet PostUpdatesServlet threw exception
java.lang.NullPointerException
at com.twf.PostUpdatesServlet.doPost(PostUpdatesServlet.java:31)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:637)