8 Replies Latest reply on Oct 4, 2006 1:38 PM by Steven Si

    PojoCacheMBean   getObject(fqn);   throws java.lang.IllegalA

    Steven Si Newbie

      Hi there,
      I'm using PojoCacheMBean with JBoss AS.

      In the deploy\mycache-service.xml, I use the following lines to add the pojocache service:

      <mbean code="org.jboss.cache.aop.PojoCache"
       name="jboss.cache:service=testPojoCache">



      In the java code, I use the following lines to get the cache object:
      MBeanServer server=MBeanServerLocator.locateJBoss();
      cache_=(PojoCacheMBean)MBeanProxyExt.create(PojoCacheMBean.class, "jboss.cache:service=testPojoCache", server);


      To get an object in the cache:
      PojoCacheMBean cache = BaseCacheManager.getCache();
      String fqnStr = "/test";
      Fqn fqn = Fqn.fromString(fqnStr);
      Object obj = cache.getObject(fqn);


      Then I got the following exception, which is caused by the line "Object obj = cache.getObject(fqn) " :
      java.lang.IllegalArgumentException: argument type mismatch
      --------------------------------------------------------------------------------
      java.lang.IllegalArgumentException: argument type mismatch
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy65.gutObject(Unknown Source)
      at com.letu.netprint.modules.bos.base.BaseBO.getObject(BaseBO.java:280)


      If I change the last line from
      Object obj = cache.getObject(fqn);

      to
      Object obj = cache.getObject(fqnStr);


      Thinks become OK.
      Why this could happen?

      My evironment is :
      jdk1.5.0_09
      jboss-4.0.4.GA
      jboss-cache.jar is from JBossCache-1.4.0.SP1

      Any help or remind will be very appreciating, thanks in advance!


      Steven Si