3 Replies Latest reply: Apr 6, 2013 5:04 AM by alexey.ragozin RSS

    ReflectionExtractor can't access member HashMap Values withmodifiers public

    user576356
      Hi ,
      I am getting the below exception when trying to apply chained filter. The cache values are objects which have methods to return collection.
      public Collection<Property> getProperties() and I want result filtered based on value of Property object inside this collection.

      NamedCache cache = CacheFactory.getCache("mycacheName");
      CacheFactory.ensureCluster();

      ValueExtractor ex = new ChainedExtractor("getProperties.iterator.next.getPropertyName");

      Filter filter = new EqualsFilter(ex, "CHANNEL");
      Set keys = cache.keySet(filter);
      System.out.println("keys set with filter : "+keys.size());


      //where cache object structure is:
      cache.put(propertyId,ArticleProperties);

      ==========//ArticleProperties.java
      public class ArticleProperties implements Serializable {
           
           private static final long serialVersionUID = 1L;


           private ArticleId _articleId;
           private Map<String, Property> _Properties = new HashMap<String, Property>();
           private Article article;
           
           public ArticleProperties(ArticleId articleId) {
                _articleId = articleId;
           }

           public ArticleId getArticleId() {
                return _articleId;
           }
           
           /**
           * Returns all the ArticleProperty objects associated with this
           * @return
           */
           public Collection<Property> getProperties() {
                return _Properties.values();
           }
           
           ===========================
           ///Property.java
           public class Property implements Serializable {
           
           private static final long serialVersionUID = 1L;
           private static final Long object = new Long(1);
           private String _PropertyName;
           private Map<String,Object> _PropertyValues = new ConcurrentHashMap<String,Object>();
           
           public Property(String PropertyName) {
                _PropertyName = PropertyName;
           }
           
           public Property(String PropertyName, String PropertyValue) {
                _PropertyName = PropertyName;
                _PropertyValues.put(PropertyValue,object);
           }
           
           public String getPropertyName() {
                return _PropertyName;
           }

           public Collection<String> getPropertyValues() {
                return _PropertyValues.keySet();
           }
           
      Exception in thread "main" (Wrapped: Failed request execution for DistributedCache service on Member(Id=14, Timestamp=2013-04-04 19:14:41.457, Address=xxx, MachineId=xxx, Location=site:corp.surjan.com,machine:surjan,process:1121,member:surjan_14211) (Wrapped: java.util.HashMap$Values.iterator()([com.surjan.ssr.article.Property@16c5f1a2, com.surjan.ssr.article.Property@16c5f98a, com.surjan.ssr.article.Property@16c5fd24, com.surjan.ssr.article.Property@16c5ffdf])) Class com.tangosol.util.extractor.ReflectionExtractor can not access a member of class java.util.HashMap$Values with modifiers "public") java.lang.IllegalAccessException: Class com.tangosol.util.extractor.ReflectionExtractor can not access a member of class java.util.HashMap$Values with modifiers "public"
           at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.tagException(Grid.CDB:36)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onQueryRequest(DistributedCache.CDB:72)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$QueryRequest.run(DistributedCache.CDB:1)
           at com.tangosol.coherence.component.net.message.requestMessage.DistributedCacheRequest.onReceived(DistributedCacheRequest.CDB:12)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
           at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
           at java.lang.Thread.run(Thread.java:619)