I am using Salesforce SOAP API through the jar files. We have set the session timeout to 12 hours. I am using one username/password to login in for all the client instances running on different JVMs.

The "INVALID_SESSION_ID" problem happened all the time when there are two or more clients are running. When it fails I just restart the client and that will solve the problem. After a while, few minutes or hours, it will fail again. This is an internal app and no one is hacking it and it is not expired. What could I do troubleshoot the issue? This session shared by multiple logins seems very unstable.

These are the URLs: AuthPoint:https://test.salesforce.com/services/Soap/c/35.0/0DFf0000000CbYO ServiceEndPoint:https://cs16.salesforce.com/services/Soap/c/35.0/00Df0000003cDQb/0DFf0000000CbYO

503087.266: [GC (Allocation Failure) 503087.340: [SoftReference, 0 refs, 0.0019997 secs]503087.342: [WeakReference, 18 refs, 0.0005289 secs]503087.342: [FinalReference, 601 refs, 0.0030421 secs]503087.345: [PhantomReference, 0 refs, 0 refs, 0.0073157 secs]503087.353: [JNI Weak Reference, 0.0000337 secs][PSYoungGen: 796740K->1254K(917504K)] 1201079K->410538K(1966080K), 0.0890802 secs] [Times: user=0.17 sys=0.00, real=0.09 secs] [UnexpectedErrorFault [ApiFault exceptionCode='INVALID_SESSION_ID' exceptionMessage='Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: FBVEDrptWO/J5/ozTzhwBw== This is expected, it can happen if the session has expired and swept away, or if the user logs out, or if its just someone trying to hack in. ' ]

Thank you!

  • When the same user credentials login you typically get the same SessionId back. Have you tried comparing the Session Ids from the various instances to see at what point the value changes? Do you ever explicitly call logout() for that SessionId? It would likely invalidate all of them Commented Apr 14, 2016 at 22:43

3 Answers 3


As a generally rule it is probably better to just code the external clients to be able handle expired sessions.

They could expire for any number of reasons:

  1. One of the clients could have called the logout() method
  2. An admin could have explicitly expired the session
  3. ...

One way or another it will just be easier to handle the INVALID_SESSION_ID errror, make a new session, and then carry on.


I found the problem of my client. My client is a Spring bean and before it is destroyed it logs out Salesforce. That invalidated the session. After removing the log out code. No more "INVALID_SESSION_ID" occurred.


I had the same problem in the C# SOAP API. I changed my pattern to logging in before any major section and never logging out. That seemed to fix it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .