6 Replies Latest reply: Aug 4, 2012 11:04 PM by 953260 RSS

    Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)

    953260
      Hi,
      I have two different applications using Toplink 11g (11.1.1.0.1) version and are deployed to a Weblogic 11(10.3.5) Server.
      If I login to application app1 first I cannot login to app2. if I login to app2 first I cannot access app1. This has been working in webloigc 10 earlier only after migrating to weblogic 11 I am facing this issue.


      Both the applications have their individual toplink map files (mwp) and two different sessions.xml file each connecting to a different datasource.

      Error -

      Exception Description: Missing descriptor for [com.setupNow.model.SNOUsers] for query named [findHomeAndRoleByUser].

      --
      Sree
      Additional Note
      I have added this to the startup script of weblogic server
      -Dtoplink.xml.platform=oracle.toplink.platform.xml.jaxp.JAXPPlatform
        • 1. Re: Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)
          953260
          In continuation to my above question, I get this Missing Descriptor exception to the second app accessed. the first accessed app continues to work perfectly.

          Both the sessions.xml (has different names) are placed in directory added in CLASSPATH of the WL11 Startup Script.

          Please help me in this regard.
          --
          Sree
          • 2. Re: Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)
            cdelahun
            Can you post the error stack trace and the code used to get the session?

            Best Regards,
            Chris
            • 3. Re: Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)
              953260
              Chris, thanks for your reply and here is the code


              public class SessionUtil {
              public SessionUtil() {
              }

              /**
              * This method is used to create a sever session and aquire a client session
              * from this server session.
              * -It's useful in 3-tire environment.
              * @return a client session from server session
              */
              public static Session createSession() {

              XMLSessionConfigLoader loader =
              new XMLSessionConfigLoader(getSessionsXmlPath());
              SessionManager mgr =
              oracle.toplink.tools.sessionmanagement.SessionManager.getManager();

              ClassLoader classLoader = null;
              try {
              classLoader = Class.forName("com.cnow.dao.toplink.SessionUtil").getClassLoader();
              } catch (Exception ex) {
              ex.printStackTrace();
              }

              Server serverSession =
              (Server)mgr.getSession(loader, getSessionName(), classLoader,
              true, false);
              Session clientSession = serverSession.acquireClientSession();

              return clientSession;
              }

              protected static String getSessionName() {
              return "default";

              }

              protected static String getSessionsXmlPath() {
              return "classpathDir/sessions.xml"; //classpathDir is a directoy which has sessions.xml file for both the apps.
              }
              }

              --
              sree

              Edited by: anusai on 1 Aug, 2012 9:36 PM

              Edited by: anusai on 1 Aug, 2012 9:37 PM
              • 4. Re: Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)
                953260
                Can some one help me with this.
                --
                Sree
                • 5. Re: Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)
                  cdelahun
                  You mention that each app has its own session.xml, but the code shown only shows a single sessions.xml location - I assume the second app uses a different sessions.xml location or name. If so, are the session names within each sessions.xml also unique? This could be caused if both sessions.xml use the same session name internally.

                  If they are using the same sessions.xml or the same session name, the problem could be that they are both using the same static SessionManager instance - it depends on how classloaders work and how you shared the TopLink jars in the prior WebLogic version. If this is the case, the first app works because it causes the SessionManager to load in its sessions.xml/sessions using its classloader. The second app will then use the same SessionManager, and use the sessions loaded with the first's classloader, resulting in the exceptions seen.
                  This should not occur if you have different sessions.xml and different session names though. If you do, try also using the getSession method that takes in the shouldCheckClassLoader boolean. For example:
                  Server serverSession = (Server)mgr.getSession(loader, getSessionName(), classLoader, true, false, true);

                  Best Regards,
                  Chris
                  • 6. Re: Two Toplink Projects (two individual applications) in Weblogic11 (10.3.5)
                    953260
                    Hey Chris,

                    You made my day. Now I am able to access both my app's. Its actually the session name. Both the session files had the same name that created this issue. But how did the same configuration worked in Weblogic 10. We are jsut moving to Weblogic 11 and encoutered this issue. Any ideas.

                    Marking this thread answered and thanks to Chris.
                    --
                    Sree

                    .