3 Replies Latest reply on Nov 9, 2005 6:59 AM by Manik Surtani

    JBossCache-1.2.4 & Weblogic 8.1 SP4 (ClassCastException)

    Raj Subramani Newbie

      JBossCache-1.2.4 & Weblogic 8.1 SP4 (ClassCastException)




      I have managed to insert the TreeCache object into the JNDI tree following the example given in the wiki:

      http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheAndWebLogic

      But when I try and retreive the TreeCache object in my stateless session bean

       weblogic.jndi.Environment env = new weblogic.jndi.Environment();
       Context wctx = env.getInitialContext();
       Object obj = wctx.lookup(JNDIConstInterface.CACHE_BIND_NAME);
       org.jboss.cache.TreeCache c = (org.jboss.cache.TreeCache)obj;
      
      


      I get the following:




      java.lang.ClassCastException
      at service.staticdata.StaticDataServiceBeanImpl.setSessionContext(StaticDataServiceBeanImpl.java:277)
      at service.staticdata.StaticDataService_jti2xc_Impl.setSessionContext(StaticDataService_jti2xc_Impl.java:111)
      at weblogic.ejb20.manager.StatelessManager.createBean(StatelessManager.java:268)
      at weblogic.ejb20.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:168)
      at weblogic.ejb20.pool.StatelessSessionPool.getBean(StatelessSessionPool.java:110)
      at weblogic.ejb20.manager.StatelessManager.preInvoke(StatelessManager.java:140)
      at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:137)
      at weblogic.ejb20.internal.StatelessEJBObject.preInvoke(StatelessEJBObject.java:69)


      I have examined the "obj" Object on line 3 (of the above code snippet) and Eclipse tells me that it IS A org.jboss.cache.TreeCache.

      It shows up as a

      Object To String: org.jboss.cache.TreeCache [0 nodes, 0 locks]


      in the JNDI browser.

      I am baffled.

      Any help would be much appreciated.

      Cheers
      -raj