1 Reply Latest reply on May 13, 2017 9:48 PM by Nooruddin Shaik

    java.lang.ClassCastException occurred. atg.adapter.gsa.ChangeAwareSet cannot be cast to java.util.List

    3236725

      I want to get the category id from parentCategories property  of a product in java , then iterate them until a specific category comes up. But , I am getting class cast exception on line number 2 . Please help me.

       

      java.lang.ClassCastException: atg.adapter.gsa.ChangeAwareSet cannot be cast to java.util.List

       

      1) RepositoryItem productItem = getCatalogTools().findProduct(id);

      2) List<RepositoryItem> catList = (List<RepositoryItem>)productItem.getPropertyValue("parentCategories");

      3)  for (RepositoryItem category : catList) {

        vlogDebug("Category:{0}", category.getRepositoryId());

      }