As the title suggests, I have been trying to access a TreeCacheAop inside of a session 
EJB with absolutely no luck.

Please help!!!

First some background.  
JBoss version 4.0.0DR3
JDK 1.4.2_04


I have successfully created  a TreeCacheMBean, via the MBeanServerFactory.

public class TesterBean
  |     implements SessionBean {
  |   SessionContext sessionContext;
  |   protected TreeCacheMBean cache=null;
  |   protected MBeanServer server=null;
  |   static final String cache_service="jboss.cache:service=TreeCacheAop";
  |   protected ObjectName cacheService = null;
  | 
  |   public void setSessionContext(SessionContext sessionContext) {
  |     this.sessionContext = sessionContext;
  |     List servers=MBeanServerFactory.findMBeanServer(null);
  |     if(servers == null || servers.size() == 0)
  |     {
  |       //throw new Exception("TreeCacheView.init(): no MBeanServers found");
  |     }
  |     else
  |     {
  |         server=(MBeanServer)servers.get(0);
  |         try {
  |           cacheService = new ObjectName(cache_service);
  |           cache = (TreeCacheMBean) MBeanProxyExt.create
  |                                                        (TreeCacheMBean.class,
  |                                                         cache_service, server);
  |         }
  |         catch (MalformedObjectNameException ex) {
  |           System.out.println(ex.getMessage());
  |         }
  |     }
  |   }

And I did add a node via the put methods.

....
       cache.put("/aNode", "test", "foo");
....

All well and good. After that I tried to add an AOP object and found that there is no 
putObject method in TreeCacheMBean. So I tried the following:

  public void addSoemthing(int ID, String name) {
  | 
  |     try {
  |     
  |       Fqn fqn = new Fqn(new Integer(sportID));
  |       Sport newSport = new Sport(sportID, name);
  |       Object[] args = {fqn, newSport};
  |       String[] sig = {String.class.getName(), Object.class.getName()};
  |       server.invoke(cacheService, "putObject", args, sig);    
  |     }
  |     catch (ReflectionException ex) {
  |       System.out.println(ex);
  |     }
  |     catch (MBeanException ex) {
  |       System.out.println(ex);
  |     }
  |     catch (InstanceNotFoundException ex) {
  |       System.out.println(ex);
  |     }
  |   }

And I get the reflection exception:
Cause: java.lang.IllegalArgumentException: Unable to find operation 
putObject(java.lang.String,java.lang.Object)

I have just downloaded the JBoss source code and I can't even find the code for 
TreeCacheMBean??? 

What am I missing???

Thanks in advance.


<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3827165#3827165";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3827165>Reply 
to the post</a>


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to