5 Replies Latest reply on Jul 30, 2014 3:52 AM by pmm

    EJB lookup problem using local client view at "java:global/.." (from outside EAR)

    rakcheru

      Jboss : 7.1.1

      EJB 2.1

       

      Hi,

      My deployment scenario consists of an EAR and a separate WAR as follows

      - An Ear

          |_ EJB jar

          |_ EJB Client Jar

      - Another War

          (contains EJB Client Jar in WEB-INF/lib folder)

       

      When the EAR is deployed, i can see that the EJB (with both remote and local client views) is deployed at following "java:global/.." JNDI locations apart from other locations



      java:global/Ear/Ejb/LocalAndRemoteBean!package.LocalHome
      java:global/Ear/Ejb/LocalAndRemoteBean!package.Local

       

      An EJB client servlet (in "Another WAR") is not working when it tries to use local client view at "java:global/.." locations. The lookup using following JNDI names is returning an object. However, any casting attempt using either LocalHome or Local interface is resulting in ClassCastException.

      java:globa/Ear/Ejb/LocalAndRemoteBean!package.LocalHome
      java:global/Ear/Ejb/LocalAndRemoteBean!package.Local

       

      The lookup code in both cases are as follows

      LocalHome localHome = (LocalHome)ctx.lookup("java:global/Ear/Ejb/LocalAndRemoteBean!package.LocalHome");
      Local l = localHome.create();
      l.businessMethod();
      

       

      Local local = (Local)ctx.lookup("java:global/Ear/Ejb/LocalAndRemoteBean!package.Local");
      local.businessMethod();
      

       

      The lookup returned objects of following types respectively

      package.LocalHome$$$view3

      package.Local$$$view4

       

      My question is : "If the lookup is returning an object, what should be done to invoke the business method ?"


      Thanks in advance