2 Replies Latest reply on Dec 30, 2004 12:24 PM by fredatwork

    JBoss cache fails with a StringIndexOutOfBounds exception

    fredatwork Newbie


      JBoss cache throws a StringIndexOutOfBounds exception when I attempt to access to the cache. See below the exception stack.

      Method getObject in called on an instance of TreeCacheAopMBean inside qn EJB ession bean, which then trigger the calls of getObject on an instance of TreeCacheAop as expected.

      At the time the getObject() is called, noobject is inthe cache yet. But looking at the exception, it looks like it does not matter. Constructor of org.jboss.cache.aop.CachedType triggers the exception.

      How can I debug this failure ? Anybody has an idea why JBoss cache fails like this ? Is this a bug ?


      java.lang.StringIndexOutOfBoundsException: String index out of range: 4
      at java.lang.String.substring(Unknown Source)
      at org.jboss.cache.aop.CachedType.attributeName(CachedType.java:202)
      at org.jboss.cache.aop.CachedType.getAttribute(CachedType.java:210)
      at org.jboss.cache.aop.CachedType.analyze(CachedType.java:155)
      at org.jboss.cache.aop.CachedType.<init>(CachedType.java:55)
      at org.jboss.cache.aop.TreeCacheAop.getCachedType TreeCacheAop.java:590)
      at org.jboss.cache.aop.TreeCacheAop.getObject(TreeCacheAop.java:446)
      at org.jboss.cache.aop.TreeCacheAop.getObject(TreeCacheAop.java:421)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy1065.getObject(Unknown Source)
      at com.rubis.util.cache.JBossCacheAccessor.getObject JBossCacheAccessor.java:54)

        • 1. Re: JBoss cache fails with a StringIndexOutOfBounds exceptio

          Again, please specify the version of JBossCache you are using? Or the JBoss AS version. I have tested it on 1.2 release, and it works for me when getObject tries to retrieve a non-existent object.


          • 2. Re: JBoss cache fails with a StringIndexOutOfBounds exceptio
            fredatwork Newbie


            I'm running JBoss AS 4.0.0 (build: CVSTag=JBoss_4_0_0 date=200409200418, says the startuplog trace).

            Actually, I have put an object in the cache. I get the StringIndexOutOfBoundsException when I attempt to retrieve the object from the cache. The object has been put successfully in the cache by the init() method of a servlet loaded at deployment time of my ear file.

            Here are my findings:

            1/ I wanted to test my serializable POJOs to see if there was something wrong with them. I deployed a custom jar file with a session bean having 2 methods for putting and getting the object (and its dependant POJOs) in the JBossCache. It worked with no particular problem.

            2/ But when I use an ear file (zith one EJB jar and one WAR file), the POJO class files being deployed in an EJB jar file, putting the object in the cache does not work anymore. I get a ClassNotFound exception with "No ClassLoaders found for: com.rubis.app.runtime.programs.SignalProgramCache" message.

            Then, when I wrap my SignalProgramCache POJO inside a org.jboss.aop.util.MarshalledValue instance (as proposed by a post of this forum), the putObject() method succeeds (the object being put in the cache by my servlet's init method).

            However, when using my application, the getObject still triggers the StringIndexOutOfBoundsException exception when I attempt to get the object from the cache.

            I do not know what to do now. Can you help ?