0 Replies Latest reply on Dec 5, 2012 12:02 AM by Veerapu Nagarjun

    How to Build a Generic Lookup which accepts the lookup bean dynamically in a method.

    Veerapu Nagarjun Newbie

      Hi All,

      I have an issue such that in normal way we directly type cast the lookup class like this

       

          TestClass t = (TestClass)context.lookup(some jndi name);

       

      but this type cast should be of generic one like

       

      T t = (T) context.lookup(some jndi name);

       

      this T should be the remote class which we are looking for. I have instead saved it to an object like this

       

      Object x = context.lookup(some jndi name);

       

      but after this if i wanted to convert it to a specific remote bean class then it is giving me the javax.naming.reference cannot be casted to this particular class. So can you guys please help me regarding this.

       

       

      Thank you,

      Arjun.