2 Replies Latest reply on Mar 12, 2008 9:30 AM by Manik Surtani

    ClassCastException: java.util.TreeSet: while trying to attac

    Bahata Mukhopadhyay Newbie

      Hi
      I am getting the exception ClassCastException: java.util.TreeSet , for
      the code "cache.attach("datamodel",dataModel);" I am using JBossCache 'Habanero' 2.0.0.GA. Kindly help! It is a blocking condition for our project!

      -----------------------------------------------------------------------------------
      Code:
      String configFile = "resource/replSync-service.xml";
      PojoCache cache = PojoCacheFactory.createCache(configFile);

      cache.start();

      Object obj=cache.find("datamodel");
      DataModel dataModel;
      if(obj!=null)
      {
      dataModel=(DataModel) obj;
      }
      else
      {
      dataModel= new DataModel();
      DatabaseController.loadFromDatabase(dataModel, loadDates);
      cache.attach("datamodel",dataModel);
      }

      ----------------------------------------------------------------------------------

      Exception in thread "main" java.lang.ClassCastException: java.util.TreeSet
      at java.util.TreeMap.compare(Unknown Source)
      at java.util.TreeMap.getEntry(Unknown Source)
      at java.util.TreeMap.remove(Unknown Source)
      at java.util.TreeSet.remove(Unknown Source)
      at org.jboss.cache.pojo.impl.CollectionClassHandler.checkSetRecursion(CollectionClassHandler.java:230)
      at org.jboss.cache.pojo.impl.CollectionClassHandler.put(CollectionClassHandler.java:193)
      at org.jboss.cache.pojo.impl.PojoCacheDelegate.putObjectII(PojoCacheDelegate.java:174)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.putObject(PojoCacheImpl.java:136)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.org$jboss$cache$pojo$impl$PojoCacheImpl$attach$aop(PojoCacheImpl.java:115)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java)
      at org.jboss.cache.pojo.impl.AdvisedPojoHandler.put(AdvisedPojoHandler.java:141)
      at org.jboss.cache.pojo.impl.PojoCacheDelegate.putObjectII(PojoCacheDelegate.java:170)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.putObject(PojoCacheImpl.java:136)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.org$jboss$cache$pojo$impl$PojoCacheImpl$attach$aop(PojoCacheImpl.java:101)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java)
      at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java:93)
      at ft.oots.controller.ServerController.loadDataModel(ServerController.java:227)
      at ft.oots.controller.SynchronizationController.loadDataModel(SynchronizationController.java:62)
      at ft.oots.Application.(Application.java:130)
      at ft.oots.Application.main(Application.java:522)
      09:47:13,312 INFO Thread-8 CacheImpl.internalStop() - stop(): closing the channel
      09:47:13,437 INFO Thread-8 CacheImpl.internalStop() - stop(): stopping the dispatcher