Preserve session across web applications.

I've deployed 2 different web applications, each part of their own .ear . Is
there any way to make the two web applications use the SAME session object
? My problem is that when I store an object in the session within one
application, the object isn't available in the session-context for the other
application.
I've also verified that they are actually using two different sessions by
tracking the session-id at script-level. I'm using wl 6.1 if that helps
//Linus Nikander - [email protected]

Linus,
We were faced with a similar situation but our team responsible for the
Web applications decided to go with a single web-app in the end and we
bear the cost of not very nice build.
An alternative solution for you will be instead of setting the
authentication in the session to set the user object in a cookie and
then use it for all web applications.
I believe that is the idea behind the Weblogic Identity Assertion
security providers
(http://e-docs.bea.com/wls/docs70/dvspisec/ia.html#1145598) but we've
never had to deal with it yet.
Regards,
Dejan
Linus Nikander wrote:
Thank you for your answer, a few follow-up questions.
As you point out I definitely don't want to implement something that is
outside the spec. and vendor specific. But how then would you suggest
solving the following situation:
At the moment we are co-operating with other actors within a larger project.
Our task is to design and code one of the modules, which consists of EJBs,
JSPs and Servlets. From the beginning this was successfully deployed and
packaged in a single EAR.
Problems arose when we started to integrate our EAR with a WAR written by
one of the other participants in the project. The problem was that they are
responsible for authentication for the whole site, i.e. the login-module.
The've implemented the login so that when a user successfully logs in, a
"user"-object is stored in the session. The very fact that the user-object
exists means that the user is validated. The method for verifying that a
user is authenticated is thus to check the session for the occurence of this
object before execution of any JSP or Servlet. For files within their WAR
this works fine, but as soon as a call is made to a JSP or Servlet within
our EAR the method of authentication breaks because a new session is
generated, void of the user-object.
We've solved the problem by co-deploying a single WAR. In my opinion this is
a really ugly solution because there is no longer a clean separation of
"their" and our files, and it makes deployment a real hassle.
Skipping any points of view as to their chosen method of authentication (we
don't like it either but its going to remain unchanged no matter what), do
you see any other way for us to get things to work where we (hopefully) can
keep our files separate from one another.
//Linus Nikander - [email protected]
"Deyan D. Bektchiev" <[email protected]> wrote in message
news:[email protected]...
It would be a violation of the Servlet spec to do so and although in 6.0
you could share the session at least in 7.0 it isn't the case.
I'm not familiar with 6.1 but even if you could do it there then your
application is not going to be portable since you'll be relying on a
specific vendor implementation.
Regards,
Dejan
Linus Nikander wrote:
I've deployed 2 different web applications, each part of their own .ear .
Is
there any way to make the two web applications use the SAME session
object
? My problem is that when I store an object in the session within one
application, the object isn't available in the session-context for the
other
application.
I've also verified that they are actually using two different sessions by
tracking the session-id at script-level. I'm using wl 6.1 if that helps
//Linus Nikander - [email protected]

Similar Messages

  • Sessions across Web Applications (WARs)

    I've heard that you can't share session information (http session) across web applications or war files in the j2ee framework. However, I haven't seen any proof of this? I'm struggling to find information telling that I can't do this. Can someone elaborate a bit?
    Thanks.

    Hi !
    It is TOTALLY WRONG that someone wrote here that a
    separate JVM is started for each web-app! No way. Run
    any appserver and do a 'ps -ef|grep java' and I bet
    you will see only one forever :-). Correct
    Steve, it is the classloader hierarchy in all
    appservers that prevents you from sharing sessions (i
    would say classes loaded by various web-apps). There
    is something called a web-app / WAR classloader, which
    is 4th in the hierarchy of JVm classloader hierarchy.
    Since all your web-app loaded classes are loaded by
    this classloader and since each web-app has a "peer"
    classloader at same level for its own web-app, you
    will never be able to share across web-apps. Incorrect, just because you can have separate classloaders for separate web applications does not mean that those web applications cannot share instances.
    It is also possible to have classes which are globally available to ALL web applications which are loaded as part of the servlet container. Tomcat versions 4+ have a common area where classes can be made available. These classes are not loaded within the Web Application classloader at all.
    Not only that but it is possible to configure web application contexts such that they can also share things like sessions. This feature is definitely part of the Apache Tomcat release and as this is taken by Sun to be the Reference Implementation of the Servlet Container I would assume that is also part of the J2EE Standard as well.
    YOu can always use the DB stuff that other genltmen
    has already suggested.

  • Not able to clear session of web application running inside wpf browser control

    Hi,
    I have used below code to clear session of web application running inside wpf browser control .   
    [DllImport("wininet.dll", SetLastError = true)]
       private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
     InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);
    This code is working in Windows 8 but it is not working in windows 7 and windows 8.1.
    I want to know why it is not working and how to make it work in windows 7 and windows 8.1
    Please help.
    Thanks & Regards,
    Pritesh

    Hi,
    I have used below code to clear session of web application running inside wpf browser control .   
    [DllImport("wininet.dll", SetLastError = true)]
       private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
    InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);
    This code is working in Windows 8 but it is not working in windows 7 and windows 8.1.
    I want to know why it is not working and how to make it work in windows 7 and windows 8.1
    Please help.
    Thanks & Regards,
    Pritesh

  • Character encoding across Web application contexts

              If I submit an HTTP request encoded in SHIFT-JIS across Web application contexts,
              the characters seem to get mangled. Do I need to do anything special to pass request
              objects that are encoded in SHIFT-JIS to another context.
              

    a. EUC-JP
    EUC is Extended Unix Code.
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
    charset=x-euc-jp">x-euc-jp should be EUC-JP. You use x- for non-registered
    encoding names with IANA.
    b. JIS
    Japanese Industrial Standard
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
    charset=iso-2022-jp">To be precise, JIS means nothing. JIS has many standards.
    It is an ISO-2022 encoding applied to JIS code sets.
    c. Shift_JIS
    Microsoft's Japanese encoding method loosly based on
    JIS.
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
    charset=x-sjis">Use "charset=Shift_JIS" in most cases.
    >
    d. UTF-8You use charset=UTF-8.
    - Which one of the above 4 I should use? Either one is fine as long as you include the meta tag
    in HTML. If you want to support older generation of
    browsers, then skip UTF-8. If you target i-mode
    phone browser, use Shift_JIS.
    - Do I have to worry about the encoding of the
    Japanese data being entered by user in the input
    fields in the HTML form?Yes. Use the same encoding as the encoding of the form.
    Make sure to call response.setEncoding to set the
    enxoding for the parameter processing.
    - What should be encoding of the content of html
    output generated by the JSP?Use contentType tag in page directive.

  • Share graphic layout across web applications (WAR)

    Does somebody know how to share graphic layout across web applications?
    e.g. how to dynamically include a layout html across multiple webapps, so, if I make a change to that layout,, the change is automatically reflected in all webapplications already deployed.
    any idea will be appreciated

    Hi,
    To have a common layout across multiple web applications you can use cascading style sheets (css). By making use of the same style sheet you can have the same appearance in all the web applications. Changing the styles in the css will be reflected in all the pages that make use of this css. The changes wont be effected though in all the already deployed web applications. They will have to be re deployed for the changes to take effect.
    Hope this helps you
    Cheers
    Giri :-)
    Creator Team

  • Can't record web session in Web Application Transaction Monitoring using IE10 (Tried under Windows Server 2008R2 and 2012)

    Hi,
    In Operations Manager Console 2012 SP1 including RU2 I am trying to record a web session in Web Application Transaction Monitoring.
    I have check that:
    The add-on (Microsoft Web Recorder Helper) 64bit is Enabled.
    The 64bit version of IE10 is running/launched. See this link for how to modify your registry key if needed:  http://kevingreeneitblog.blogspot.co.uk/2012/01/scom-2012-recording-web-browser-session.html
    I have tried both on a Windows 2008R2 and 2012 server, but the recorder is not showing up as can been seen from Kevin's Blog (link above).
    Any Ideas?

    I managed to get this working on both Windows 8 IE10 and server 2012 IE10. Tested on SCOM 2012 SP1 UR2 and UR3. I've done this process in lab and production several times so hopefully this helps you out.
    Checklist:
    1. Ensure that the 64bit IE10 is launching when the "start web-capture" is started in SCOM.
    2. Enable IE10 internet options:
    a: Advanced - Security - Enable Enhanced Protected Mode
    b: Advanced - Browsing - Enable third-party browser extensions
    3. Close all running IE sessions and open the Registry Editor
    4. Registry Change (No reboot needed)
    - Browse to the following regkey:
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
    - Add a new DWORD called TabProcGrowth and set it to 0
    5. Registry Change (No reboot needed)
    - Browse to the following regkey:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories64\
    -You should see two subkeys labeled: (These are the cached BHO IE objects related to the Web Recorder)
    {00021493-0000-0000-C000-000000000046}
    {00021494-0000-0000-C000-000000000046}
    - Delete only the above two mentioned keys (This will force IE to recache them next launch)
    6. Try to start the web capture again from SCOM 2012 SP1.
    7. When IE10 Launches enable the add-on again if you are prompted.
    8. If you still don't see the Web-Recorder pane in IE you can now show it by:
     - View - Explorer bars - Web Recorder

  • SharePoint 2013 : Content organizer rules to move the document across web applications

    Hi,
    I wanted to move  the document in drop off library to another web application based on the metadata values.I am thinking of doing this using content organizer rules but I am not sure it will help across web application.
    Is there any other out of the box or no customization solution to achieve this requirement?

    Hi Prasad,
    According to your description, my understanding is that 
    you want to move documents across web applications and keep the metadata. Is it right?
    For moving documents across web applications, you can use Send To connection to achieve it. However, it may cause some meta data missing.
    More information about how to use Send To connection to route documents:
    http://www.informit.com/articles/article.aspx?p=2131831&seqNum=4
    So, for your issue, I suggest you use a third party tool or solution to do it.
    There is a CodePlex solution, check if it is useful for you:
    https://spdeploymentwizard.codeplex.com/
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • Unique Session en web application??  How?

    How can i to force in my web application that my clients can only loggon one time at same time?, local vars in the application? if the client shutdown de PC?, i use OID for authentication, any way?
    Any data, url?
    Thanks

    You basically have to keep track of who is logged in yourself. Use an HttpSessionBindingListener to make sure you are notified when a session expires, so you can let the user back in.

  • Maintaining session among Web Applications

    Hi!
    I would like to know if there is a good solution for this purpose: maintain the session in three, four or more web applications.
    We know that if a user navigates through the pages that belong to only one of the web apps, the session can possibly expire in other web apps. What would be a good strategy to eliminate this problem?
    I was thinking about a solution in which for each request the user does, or in other words, for each submit the user executes, I would call other servlets located in the other Web apps, and such servlets would have only this objective, that is maintaining the session, but I�m not sure whether it is really the best way.
    Any thoughts?
    Thanks.

    SSO will be a good options, using some available products, e.g, Sun Access Manager, or you can go for Webservices, with token management.

  • Sharing sessions between web applications (WAR files)

    I am using weblogic 6.1. The opinion I have read indicates that
              sessions cannot be shared between WAR files. That is, I cannot put an
              attribute on the session from a servlet/JSP in one WAR file and read
              it out from the other. The only justification I've seen is "security".
              Now, I find this rather difficult to accept for several reasons:
              1. I cannot fathom what kind of "security" would prevent me from
              sharing the session between two web applications that I wrote myself.
              Let's say I want to write a system that I divide up, for
              modularity/separate deployment purposes, into 5 different WAR files.
              Why should I not be able to just sign on once and pass that logon
              information in the session from one to the other? (I know, I can use
              cookies or URL rewriting - but that doesn't seem to be to be a good
              solution. And if you can share information through cookies, why not
              through sessions?) What about other user information like currently
              selected language?
              2. Several app servers (iPlanet and I have heard two others) allow you
              to share sessions between WARs. Why not weblogic?
              Thanks for any information you can give me. I have not been able to
              find anything in weblogic documentation about this. If I am
              misunderstanding the server capabilities, please enlighten me.
              Thanks,
              <>< gary
              

    http://www.weblogic.com/docs51/classdocs/webappguide.html
              --kumar allamraju
              Grant Lewis wrote:
              > I'm currently evaluating weblogic and I can't find any references in
              > their documentation set stating they support web applications or war
              > files. They explicitly state in their docs the Servlet 2.2 specification
              > has been supported since version 4.5. I'm evaluating version 5.1. Can
              > anybody clear up the confusion for me.
              >
              > Grant
              

  • How do i use the jsp session in web application

    pls i do i go about trying to maintain a user in a web application when he sign in so that his state would be mainain through out the other pages and also adding sound to my pge the page is being design with jsp thank u frm hamzah

    I see what you are saying.
    The JNDI approach should work-we will try to reproduce this internally.
    I would recommend leveraging the OSGi service registry, instead of using JNDI, however. The Event Server is a modular server based on OSGi, so one should use the OSGi service registry whenever possible instead of using the jndi registry. Jndi is primarily there to support legacy code that requires Jndi.
    Any data sources that you configure are automatically registered in the OSGi service registry. When there is more than one data source they can be distinguished using their name.
    There are a couple of options.
    If you want to inject a reference to your datasource into a Spring bean, you can use an annotation, @Service, to annotate a setter method on your bean (see my previous post). The container will then inject a reference to the data source into the bean.
    You can also put the following in your spring application context file
    <osgi:reference id="myDataSource"
    interface="javax.sql.DataSource"/>
    This creates a bean proxy that references the datasource by looking up the datasource in the OSGi service registry. It works similarly to JndiObjectFactoryBean, but it uses the OSGi service registry instead of the JNDI registry. You can read more about it here
    http://www.springframework.org/osgi/specification
    (Look in section 3.3)
    Hope that helps.
    Seth
    Edited by swhite at 08/01/2007 6:19 PM

  • Unable to forward requests across web applications

    Hi,
    please let me know if there is a solution to the following problem.
    I have 2 EARs, each having a web application inside.
    Whenever the user submits a request, it goes to a filter in webApp1. This filter checks the request.getRequestURI() and if a specific url pattern is present, it modifies the request using a wrapper and then dispatches it to webApp2. The code in the filter is as follows,
    The original url is,
    http://localhost:8001/ivx/odr/account/frameset.do
    HttpServletRequestWrapper rw = new HttpServletRequestWrapper((HttpServletRequest)request)
    public String getRequestURI()
         //Here I return "/odr/account/frameset.do"
    public String getContextPath()
         //Here I return "/odr" which is the context path of webApp2
    public StringBuffer getRequestURL()
         //Here I return "http://localhost:8001/odr/account/frameset.do"
    public String getServletPath()
         //Here I return "/account/frameset.do"
    Now the filter in webApp2 intercepts the request and after some security checks, does a chain.doFilter(). The struts RequestProcessor is called, which determines the mapping for "/account/frameset.do" and is able to create a valid ActionForward object. Finally when the request is forwarded from the requestProcessor, I get a "404-Page cannot be displayed" error.
    Is this because,
    1. The contextPath is getting lost somewhere ? (I checked the request, it has the context Path of webApp2 correctly)
    2. The request itself is lost ?
    3. The ActionForward object points to a JSP file location like "/account/frameset.jsp" ? (The jsp is located in the account folder directly below the webApp2 context root folder.)
    Thanks.

    I followed the instructions found in the App Server 7 documentation and everything worked fine.
    The instructions I followed are in the document found at this link:
    http://docs.sun.com/source/816-7156-10/agplugin.html#17655
    Just FYI...
    I also checked with Sun about why this process is now necessary and I asked about what happened to the web connector from 6.x. Sun had this reply:
    The Web Server Plug-in is the new web connector. It just hasn't been wrapped with an installation yet ... which is why it is tedious. The old Plug-in for 6.5 would ultimately have the same type of obj.conf entries. I'm not sure if there will be an installation wrapper for it once the Enterprise Edition is released.
    The Web Server Plug-in is different right now in that it doesn't 'know' about multiple instances yet. These are capabilities that will be introduced in the Enterprise Edition in March. Of course, that doesn't stop you from having multiple instances of the web server talking to multiple instances of the app server. It just means that the web server instances have to be directed to the app server instances rather than discovering them.

  • Session sharing across web applications in an EAR File

    Hi,
    I have an ear file which further has 5 war files. I want to share the same session
    object across all these war files in the ear file. Can u pls tell me if this is
    possible in weblogic. If yes how?
    Thanks,
    Akash

    I'm sorry, by the J2EE 1.3 specification this isn't allowed. I have sent it on
    to the servlet team to add as an option but that won't be in time for you. If
    you need to share state between them I would probably try and put it in another
    place like an EJB or a singleton class in the system classpath.
    Sam
    [email protected] wrote:
    Hi,
    I have an ear file which further has 5 war files. I want to share the same session
    object across all these war files in the ear file. Can u pls tell me if this is
    possible in weblogic. If yes how?
    Thanks,
    Akash

  • How Session based web Application should work even after session expiry??

    I am looking for an experts opinion that how could I develop an application that should work after the expiry of web session too in the same way as it works in web session.
    How the session should be activated.
    As I understood, what if I store all the required information in xml and then on unlock session reload all the information from XML.
    Am I right or is there any other better way to do using servlets.
    Basically I need to implement Lock and UnLock mechanism in an application.
    Thanks

    I'm not sure I understand your question. But since no one answered this yet, here is my idea:
    If the user's session expires, any unsaved data is lost. The user should expect this.
    If do need to save any data, normally you store it it a database table with the user's ID so you can retrieve it. Two free databases are Oracle Lite and MySql. However, this will take quite a bit of time to learn if you are not already familiar with databases. Storing it in a database and retrieving it is much much faster than storing it in a file.

  • How to share a session across applications?

    Hi
    I am developing a web application. There will be two web applications (including mine) running in one servlet container. The user can navigate from one application to other and vice versa. We need to know how can we share a session across these applications. Any inputs in this regard will be helpful!

    You may be interested (& probably discouraged at the end) in this discussion http://forum.java.sun.com/thread.jspa?threadID=619170
    cheers,
    ram.

Maybe you are looking for

  • 2011 iMac, Lion, iPod 3G, FireWire - charge yes, sync no

    I'm posting this in both the iPod community and in the iMac community. My appologies to any who are bother by this... I just bought a 2011 iMac (21.5 w/ 2.5GHz i5) and it came w/ Mac OS X Lion (currently at 10.7.2). I have a WD MyBook Studio connecte

  • Window 8.1 single language window store

    i upgrade my window 8 to window 8.1 single language. now after upgrading, my laptop can't open the window store app and my window music disappear. how to solve this problem. please help me. thank you.

  • Safari Web Inspector console clears on refresh

    Sometimes the console on Safari's Web Inspector doesn't show me javascript errors. This makes debugging a page harder (e.g., I think a page is free of JS errors, when really Safari just isn't showing them to me). This is how I expect it to work: I lo

  • Applet in an html invoking other classes

    I have an applet in an HTML page, invoking a another class, it doesn't work, do we have to include the classes as a jar, & reference it inside the HTML?

  • New Mac Pro - A graphics problem has been detected

    System: New Mac Pro (late 2013) AMD Firepro D300, 2GB 3.7G Quad Core Xeon E5 12GB Ram 250G SSD Internal dual display, 24" samsung BX2440 and older 19" dell logitech mx518 mouse Apple wired keyboard with numeric pad external USB 2T drive used for time