[jboss-user] [JBossCache] - PojoCacheMBean getObject(fqn); throws java.lang.IllegalA

sting_hz do-not-reply at jboss.com
Wed Oct 4 10:58:24 EDT 2006


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976036#3976036

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976036



More information about the jboss-user mailing list