我創建了一個使用OAuthentication登錄到Twitter的Web應用程序,並且登錄過程在單個servlet上成功運行。在那個servlet上,我得到了用戶的會話。但是,一旦我第一次移動到另一個servlet並嘗試重新獲取會話,就會創建一個新的會話。我認爲網絡應用程序會讀取客戶端cookie併爲每個客戶端創建一個會話?在下面,您可以看到客戶端會話ID在整個OAuth進程中保持不變,但在新servlet上發生變化。如果cookie不起作用,我會放入encodedURLS。但是,一旦我重做OAuth進程並再次嘗試一切同步...同步servlet會話
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)
感謝您的快速響應。兩個servlet都運行在相同的上下文中/在同一個Web應用程序中。我在一個servlet上運行OAuth並將響應傳遞給JSP。一旦在該JSP中有一個指向新servlet的鏈接,並且在該新servlet中會話ID發生變化。我敢肯定,我沒有在webapp中的任何地方使用invalidate,所以我要尋找客戶端cookie爲什麼會使ID無效或發送無效ID。 – Kirn 2010-09-09 18:29:49