My Oracle Support Banner

How to Pass/Share JSESSIONID Between Two Web Apps Deployed on a WebLogic Server (Doc ID 1917549.1)

Last updated on MARCH 25, 2024

Applies to:

Oracle Coherence - Version and later
Information in this document applies to any platform.


How to pass/share the JSESSIONID cookie programmatically between two web apps deployed on same weblogic node?

Two web apps, app1 and app2 deployed on the same weblogic node. Weblogic coherence node is storage enabled. Only 1 member is in the Coherence cluster and that is the weblogic coherence node.

App1 URL: http://localhost:7031/app1/
App2 URL: http://localhost:7031/app2/

Request flow is as follows:

  1. Browser opens App1 URL
  2. App1 index.jsp gets/creates the JSESSIONID and calls App2 using HttpURLConnection in the same jsp by passing the JSESSIONID
  3. App1 gets response from App2 and sends it to browser

The problem here is with the very first request to App1. App2 is creating a new JSESSIONID even though App1 is sending its JSESSIONID. However, all subsequent requests to App1 from same browser shows that App1 and App2 have same JSESSIONID, which is created in the very first request to App1.

This is the original code in App1's index.jsp passing JSESSIONID to app2

It appears that when the session object is created the very first time, it is not shared between the 2 apps until the Http response is written to the client.

Is there any workaround for such scenario?


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.