9 Replies Latest reply on Jan 3, 2013 3:28 AM by nickarls

    Getting proxy view for the class and getting class cast exception.

    gg.svce

      Hi i have interface and stateless bean implementing that interface:

       

      @Local

      public interface IRBAC {

       

          public Hashtable<String, Hashtable<String, Boolean>> loadPermissionMap();

       

          public Collection<String> loadPublicResourceList();

      }

       

      @Stateless

      @Name("rbachandler")

      @Scope(ScopeType.SESSION)

      public class RBACHandler implements IRBAC {

       

       

          @PersistenceContext

          private EntityManager em;

       

       

          public static final String PERMISSION_MAP_NAME = "PermissionMap";

       

       

          public static final String PUBLIC_RESOURCE_MAP_NAME = "PublicResourceMap";

       

       

          @Out(required = false)

          List<Role> roleList;

       

          @Override

          public Hashtable<String, Hashtable<String, Boolean>> loadPermissionMap() {

               //logic

              return createdPermissionMap;

          }

          @Override

          public Collection<String> loadPublicResourceList() {

             //logic

              return publicResourceList;

          }

      }

       

      public IRBAC getRBACHandler() {

              InitialContext context;

              try {

                 context = new InitialContext();

                  IRBAC rbac = (IRBAC ) context.lookup("java:global/protectoria/app.jar/RBACHandler");

                  return rbac;

              } catch (NamingException e) {

                  // e.printStackTrace();

                  logger.error("Lookup failed for class " + PERMISSION_LOOKUPHANDLER, e);

                  throw new RuntimeException(e);

              }

          }

       

      when i look up for context it returns:

      Proxy for view class: no.messageman.protectoria.core.security.IRBAC of EJB: RBACHandler


      and it simply gives class cast exception.

      in server.log i am getting:

       

      java.lang.ClassCastException: no.messageman.protectoria.core.utility.IRBAC$$$view61 cannot be cast to no.messageman.protectoria.core.utility.IRBAC

       

       

      can you please tell me how can i remove to overcome this issue?

       

      thanks in advamce.