3 Replies Latest reply: Nov 16, 2012 11:31 PM by Nooruddin Shaik RSS

    JNDI lookup for request scope component,


      I have 2 web applications part of single ear file.
      Where One application is ATG application having ATG pipeline defined in its web.xml

      and 2nd one is a simple j2ee web application.

      From 2nd application if I try to lookup a request scoped component by following code

      String jndiName = "dynamo:/------compenent path------";
      Context ctx = new javax.naming.InitialContext ();
      Scheduler s = (Scheduler) ctx.lookup (jndiName);

      it shows me following error.

      ** Error Fri Nov 16 11:04:20 CST 2012 1353085460117 / Invalid attempt to resolve component /atg/-------component path------/ in scope global. It is defined in scope request

      Is there any way to resolve it ?

      Edited by: Arvind Pal on Nov 16, 2012 2:00 PM
        • 1. Re: JNDI lookup for request scope component,
          Samdani Gulam
          using JNDI only global scope component can be resolved,
          for resolving session components you need to use DynamoRequest.resolveName
          you cannot resolve request scope component either with JNDI lookup or NucleusResolverUtil
          • 2. Re: JNDI lookup for request scope component,
            If I use same code in application 1 (which have ATG servlet pipelint) it works,
            Only thing is this is not working in application which don't have ATG servlet pipeline in the web.xml
            • 3. Re: JNDI lookup for request scope component,
              Nooruddin Shaik
              It seems the scheduler global component is resolving the request scope component internally.
              For request scope components there should be DynamoHttpServletRequest object in context to resolve.
              DynamoHttpServletRequest object is created as part of servlet pipeline.

              As you request is not going thru servlet pipeline, there is no DynamoHttpServletRequest and hence the request scope components cannot be resolved.

              So check in the scheduler why do you need to resolve the request scope component. Its not good practice to resolve them in schedulers.