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

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.

  • Session persistence across web apps

    Hi,
    I am working on a project where we have two web applications deployed in single enterprise application. I want the session object to be shared across the web applications.
    Does weblogic had any mechanism to allow for the session object to be shared across the multiple Servlet contexts inside a single enterprise application?
    I am using Weblogic 8.1
    Thanks,
    Anil

    Session data is not shared between web applications. User data is definantly important to share between applications. The single-sign-on security option is an example of this. But that's kindof a black box. If you use single-sign-on, then simply getting the remote user from the request in your servlet can be used as a key to get user data from your persistance layer (ejb's or jdbc or even jms).
    If you don't want to use single-sign-on, you can use a filter. There's some url prestidigitation, also, but otherwise this approach is pretty simple:
    1. Protect access to all of your web-app's urls with some naming convention /webappname/secure*. However, don't use these urls in any web page. All servlets and jsps you use should map names beginning with "secure".
    2. Filter all access to your webapp (this is a new feature in servlet spec 2.3). Within the filter, use the session id as a key to find out if the user is already login to any other web application. You will need a stateless session bean to do this. The doFilter would be something like this:
    SecurityBean securitybean = Utilities.getSecurityBean();
    HttpSession session = request.getSession(true);
    if (session.getAttribute("myuserdata") == null){
    UserData userdata = securitybean.getUserdata(sessionid);
    if(userdata != null)
    session.setAttribute("myuserdata",userdata);
    ... now forward the request to the "secure*" url in the filter. If the user was logged in with the slsb securitybean, then your web app will have all of your user data. If the user is not logged in by the securitybean, then the login prompt established in your web.xml will pop-up.
    The only extra work is to have a slsb securitybean. This can use the RoleManager in oc4j or it can use the jaas implementation in oc4j to log the user in, using the sessionid to get the username.
    The shared="true" attribute should be used for all application in the *-web-site.xml, so that the sessionid's are the same.
    regards,
    the elephantwalker
    www.elephantwalker.com

  • 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

  • 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

  • Session sharing acrossed ears

    Is it possible to share a session across multiple EAR's? I have successfully shared sessions across multiple WAR's in a single EAR by using the session scoping and session path information.

    According to the spec, Sessions aren't suppose cross WARs. However, with IBM's Websphere, you are able to "enable" "Shared Session Context" across multiple WARS in a single EAR and provided the virtual domains for each WAR are the same.
    This is nice because it gives a developer the flexibility to logically breakup a large site into multiple war applications under the same EAR without having to worry about session management. For example, you can have a BrochureWAR, LoginWAR and a MemberForumWAR, MemberPaymentWAR, etc... all in the same EAR. The LoginWAR would put a UserObject into Session and the other MemberWARs could use it. Otherwise you would have to use the dreaded EJB solution or roll-your-own webservice state machine.
    As a quick note, be sure that any Object you put into the Shared Session Context is loaded using the Server's classpath and not the WAR's classpath. If you don't and you load a FooObject from WAR1 lib into session, a read from Session by WAR2 will throw a ClassNotFound error because of differing classloaders. Know what I mean?
    Now with all that said, I want Shared Sessions across EARs (obviously for WARs of the same domain of course). In this way, I would be able to completely remove/upgrade certain area's of a Very Large webappliction without effecting other areas for example: someWebSitesMemberPaymentEAR without effecting someWebSitesMemberForumEAR. Of course I could achieve this with all webapplications calling some Stateful WebService or EJB thing backend too but GOSH... thats alot of work for Session Management across EARs. Where's the easy button?

  • 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]

  • Pros & Cons of having multiple web applications under one EAR project

    Could anybody let me know what are the advantages and disadvantages of having multiple web applications under one single EAR project?

    Either this is homework, in which case, do it yourself, or you already think you have some pros for doing this. Share with us

  • 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.

  • Web-application deployment problem (404 - File not found)

    Hello
    Does anyone have had the same problems like me on deploying java web-applications on iPlanet WS 6.0?
    I started with the HelloWorld.war example that came with the server and went through the manual but no luck so far. Heres what I did:
    0. Checked that webapps are enabled in the servler.xml file
    1. Created a directory /opt/webapps and /opt/webapps/hello with sufficient permissions
    2. Copied the HelloWorld.war example to /opt/webapps
    3. Deployed the excample on my test-server using the webinterface.
    Heres the content of the web-apps.xml file of my testserver after step 3:
    [DTD here]
    <vs>
    <jsp-servlet enable="true">
    <init-param>
    <param-name>use-precompiled</param-name>
    <param-value>true</param-value>
    </init-param>
    </jsp-servlet>
    <web-app uri="/hello" dir="/opt/webapps/hello" enable="true"/>
    </vs>
    All files have been extracted to /opt/webapps/hello properly. The server has been restarted.
    When I finally point my browser to http://server/hello or hello/index.jsp I get only a 404 - File not found message by the server. The context path seems to be totaly ignored.
    Heres the error log of the server
    [17/Feb/2003:16:17:38] info (12040): successful server startup
    [17/Feb/2003:16:17:38] info (12040): iPlanet-WebServer-Enterprise/6.0SP2 B11/13/2001 00:49
    [17/Feb/2003:16:17:39] info (12041): Installing a new configuration
    [17/Feb/2003:16:17:39] info (12041): [LS ls1] http://XXX.XXX.XXX.XX, port 1080 ready to accept requests
    [17/Feb/2003:16:17:39] info (12041): A new configuration was successfully installed
    [17/Feb/2003:16:17:40] info (12041): Using the Solaris VM v1.2.2 from Sun Microsystems Inc.
    [17/Feb/2003:16:17:40] info (12041): Java VM classpath: /www/ns-home6sp2/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar:/opt/jdk1.2.2/lib/tools.jar:/www/ns-home6sp2/bin/https/jar/NSServletLayer.jar:/www/ns-home6sp2/bin/https/jar/NSJavaUtil.jar:/www/ns-home6sp2/bin/https/jar/NSJavaMiscUtil.jar:/www/ns-home6sp2/bin/https/jar/servlet.jar:/www/ns-home6sp2/bin/https/jar/servlet-2.3-filters-api.jar:/www/ns-home6sp2/bin/https/jar/jsp092.jar:/www/ns-home6sp2/bin/https/jar/jaxp.jar:/www/ns-home6sp2/bin/https/jar/crimson.jar:/www/ns-home6sp2/bin/https/jar/xalan.jar:/www/ns-home6sp2/bin/https/jar/jspengine.jar:
    [17/Feb/2003:16:17:40] info (12041): Loading IWSSessionManager by default.
    [17/Feb/2003:16:17:40] info (12041): IWSSessionManager: Maximum number of sessions is 1000
    [17/Feb/2003:16:17:40] info (12041): Adding web application (/hello) at (/opt/webapps/hello)
    [17/Feb/2003:16:17:40] info (12041): Loading IWSSessionManager by default.
    [17/Feb/2003:16:17:40] info (12041): IWSSessionManager: Maximum number of sessions is 1000
    [17/Feb/2003:16:17:40] info (12041): vs(https-duke)servlet 'snoop' class = 'SnoopServlet' loaded in context = '/hello'
    [17/Feb/2003:16:17:40] info (12041): snoop: init
    [17/Feb/2003:16:17:40] info (12041): Successfully initialized web application environment (web-apps.xml) for virtual server (https-duke)

    i had similar problem due to the incorrect jdk path...
    try http://..../hello/snoop, if this works, it seems that the jsp file cannot be compiled automatically and jdk path needs to be checked...

  • Putting web service in an ear file

    I am using the jwsc ANT to to create a web service. The docs say by default it creates an exploded directory. I don't want an exploded directory, I would rather have an ear file. I see that the jwsc task has an explode attribute, but setting that to false has no affect (actually I see no difference in behavior whether I set that to true or false).
    So how can I get it into an ear file?
    I would rather have the ear file because I am having no luck deploying an exploded directory with the wldeploy ant task. It claims it can't find any application files:
    [Deployer:149003]Unable to access application source information in '/java_projects/vacd-webservices/dist/RealtimeStatsEar' for application 'RealtimeStats'. The specific error is: No application files exist.
    <target name="build-realtimestats-service" depends="clean">
    <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask"/>
    <jwsc srcdir="src/java" destdir="${distdir}/RealtimeStatsEar">
    <jws file="com/wic/vacd/wsimpl/realtimeStats/RealtimeStatsImpl.java"/>
    </jwsc>
    </target>
    <target name="deploy-realtimestats-service-devel">
    <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy"/>
    <wldeploy action="deploy"
    debug="true"
    name="RealtimeStats"
    source="${distdir}\RealtimeStatsEar"
    user="system"
    password="wicsysdev"
    adminurl="removed for security">
    targets="7001" />
    </target>
    Under the dist directory exists a directory named RealtimeStatsEar that contains a war file (under the appropriate package path), a META-INF directory and a APP-INF directory. Both those directories contain the appropriate descriptor files so I really don't know why it claims it can't find the files.
    I have followed the docs exactly and am having no luck deploying this thing.
    This is with Weblogic 9.0.

    Just want to mention that I do see a difference when I use the explode attribute on the jws task (its not on the jwsc task like I mentioned before).
    The war file containing the service is expanded.

  • Error exporting application into a ear file

    I'm developing an application with the Sun One 5 IDE,and Application server 8, i'm making CMP entity bean, when i try to export to an ear file an error occur
    Validation failed for entities.CMPAdministradorBean. Verify that all fields are mapped.
    CMP Mapping Error in bean CMPAdministrador:: Warning: The bean pcImpl0.moduleComp0.entities.CMPAdministrador is not mapped.
    Set the primary table for the bean.
    No jndi-name defined for the cmp-resource element of this module.
    Select the SunONE tab for the ejb module and configure the CMP Resource property.
    and they can't make the ear
    somebody can help me with this.
    Thank you

    Figured it out, found similar post that stated changing the HEAP size
    Increase the page size in odiparams.bat in the bin folder and restart Designer.
    For eg:
    set ODI_INIT_HEAP=128m
    set ODI_MAX_HEAP=1024m

  • How to use application params in .EAR files

    When we build an ear file , Weblogic-application.xml provides application-param
    tag?
    are they similar to env-entry in ejb-jar.xml.
    Can I use application-param tag to define a configurable params
    say myName and value as "Harshad"
    How do i read it in the application say a simple java class that is included in
    a jar inside the ear file.

    application-param tag in weblogic-application.xml may be used to define parameters:
    webapp.encoding.default
    webapp.encoding.usevmdefault
    webapp.getrealpath.accept_context_path
    http://e-docs.bea.com/wls/docs81/programming/app_xml.html#1034632
    "Harshad Nanal" <[email protected]> wrote:
    >
    When we build an ear file , Weblogic-application.xml provides application-param
    tag?
    are they similar to env-entry in ejb-jar.xml.
    Can I use application-param tag to define a configurable params
    say myName and value as "Harshad"
    How do i read it in the application say a simple java class that is included
    in
    a jar inside the ear file.

  • Application.xml in ear file

    Hi
    When we deploy to ear file the application.xml file is created with the following root tag:
    <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    Previously (Jdev10.1.2) it was created with only:
    <application>
    We are running on an older app server which does not accept the new tag. Any way to set up 10.1.3 to deploy the same tag as the previous version?
    If I manually edit the ear file and change the application.xml file, it runs fine on the older app server. We do not want this manual intervention.
    Thank you

    Does setting a target platform in the deployment profile that points to a 10.1.2 application server works?
    Also you can create a 1.3 application.xml using New->deployment descriptor->J2EE deployment descriptor wizard

Maybe you are looking for

  • I have an ipad and want to buy an ipad mini. Can I transfer everything over?

    I have 3 ipads under one apple ID and soon to have a fourth. I want to rearrage who has what device. Here is how they are now: iPad 3 16m wifi:User 1 iPad 2 16m wifi:User 2 iPad 2 16m wifi:User 3 User 4 currently has no ipad. User 1 is getting a new

  • Safari 2.0.3 Not showing images, flakiness, etc

    Hello, I am an advanced Mac Tech who just upgraded to Safari 2.0.3 (with Mac OSX 10.4.4). As of this morning I am noticeing flakiness. When I go to all my usual pages, I am noticeing that all the images with the within the web pages are not drawing,

  • Lyrics in other languages?

    My Ipod Touch has no problem displaying lyrics in English. However, in other languages, it's not displaying right. Any thoughts? I don't think it supports other languages for displaying lyrics.

  • BT Infinity Variable Speed

    I had BT Infinity installed on 27 July, previously no problems with BT Broadband. After 10 day bedding in period the speed was variable, and on occaision dropped to below 1 Mbps, although it could provide 37+ Mbps for a lot of the time. BT Engineer a

  • Identifying and grouping consecutive rows in sql

    I have following data set: CREATE TABLE APPS.T1   ROW_NUM               NUMBER,   EFFECTIVE_START_DATE  DATE                    NOT NULL,   EFFECTIVE_END_DATE    DATE                    NOT NULL,   STATUS                VARCHAR2(30 BYTE) SET DEFINE O