Note that there are some explanatory texts on larger screens.

plurals
  1. POSeam & multiple wars: Contexts.getSessionContext() is null in other war
    text
    copied!<p>I am using Seam 2.2.1.CR1 on Weblogic 10.3.2 and JSF 1.2.</p> <p>I have an ear application with 2 war files. The first war is a JSF / Seam application, the second one does have JSF / Seam, but also has some Servlets pages as well.</p> <p>When I set things in the Session context in the first web application:</p> <pre><code>Contexts.getSessionContext().set("pimUser", pimUser); </code></pre> <p>I can inject it normally in Seam components in the second war. However, if I try to get the outjected pimUser from a Servlet, I cannot access it:</p> <pre><code>PimUser user1 = (PimUser) Contexts.getSessionContext().get("pimUser"); </code></pre> <p>The Contexts.getSessionContext() is null. I noticed that the Javadoc of the</p> <pre><code>org.jboss.seam.contexts.Contexts </code></pre> <p>Says:</p> <blockquote> <pre><code>Provides access to the current contexts associated with the thread. </code></pre> <p>Author(s): Gavin King Thomas Heute</p> </blockquote> <p>Does this mean that the 2 war files are supposed to have different <code>Contexts.getSessionScope()</code>?</p> <p>I found a way which does allow me to access it through the Session like this:</p> <pre><code>PimUser user2 = (PimUser) httpRequest.getSession().getAttribute("pimUser"); </code></pre> <p>The latter way, however does not seem to be a correct one. I would like to access Seam session context through Seam.</p> <p>I found that there used (?) to be issues with Seam and multi-war applications (<a href="http://seamframework.org/Community/MultipleWarsInEarWorking" rel="nofollow">link</a>), however, these are supposed to have been resolved by 2.2.0.GA.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload