- 
        1. Re: Help: I need code examples for TreeCachebelaban Jun 22, 2005 9:26 AM (in response to dbufarini)
- 
        2. Re: Help: I need code examples for TreeCachedbufarini Jun 22, 2005 9:49 AM (in response to dbufarini)Thanks, but... I've already read that chapter and the code shown can be used only inside a servlet. 
 Does that work even inside a session ejb?
- 
        3. Re: Help: I need code examples for TreeCachebelaban Jun 22, 2005 10:46 AM (in response to dbufarini)It works inside the same VM. If you want remote access, read on (ch 11) for how to do this. 
- 
        4. Re: Help: I need code examples for TreeCachedbufarini Jun 22, 2005 10:55 AM (in response to dbufarini)I read all the chapter 11, but there is only an example of an xml configuration file and NO code example. 
 I still don't know how to look for the mbean (even if I can resonably suppose that I can through JNDI) and, more important, I don't know which interface I have to use to cast the reference returned by PortableRemoteObject.narrow().
- 
        5. Re: Help: I need code examples for TreeCachebelaban Jun 22, 2005 11:16 AM (in response to dbufarini)It is there: http://docs.jboss.com/jbcache/current/TreeCache/html/ 
 Go to chapter 11, here is the code:<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory" name="mydomain:service=proxyFactory,type=jrmp,target=factory"> <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute> <attribute name="TargetName">jboss.cache:service=TreeCache</attribute> <attribute name="JndiName">MyCache</attribute> <attribute name="InvokeTargetMethod">true</attribute> <attribute name="ExportedInterface">org.jboss.cache.TreeCacheMBean</attribute> <attribute name="ClientInterceptors"> <iterceptors> <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor> <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor> <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor> </iterceptors> </attribute> <depends>jboss:service=invoker,type=jrmp</depends> <depends>jboss.cache:service=TreeCache</depends> </mbean> 
 The JNDI name is MyCache
- 
        6. Re: Help: I need code examples for TreeCachebelaban Jun 22, 2005 11:18 AM (in response to dbufarini)You cast it to TreeCacheMBean 
- 
        7. Re: Help: I need code examples for TreeCachedbufarini Jun 22, 2005 11:19 AM (in response to dbufarini)Hi again, 
 I've tried with the following code:
 final Context ctx = new InitialContext();
 final Object ref = ctx.lookup( "MyCache" );
 ctx.close();
 cache_ = (TreeCache)
 javax.rmi.PortableRemoteObject.narrow( ref, TreeCache.class );
 Is that code correct?
 I've then tried to call a get() method, but Eclipse incremental compiler complaint that
 "The type org.jboss.system.ServiceMBeanSupport cannot be resolved. It is indirectly referenced from required .class files"
 The code used is something like this:
 cache_.put( "/global/ejb", key, value );
 Thanks!
- 
        8. Re: Help: I need code examples for TreeCachedbufarini Jun 22, 2005 11:30 AM (in response to dbufarini)Ok, I've missed some jar inside the Eclipse ide. 
 Thanks for all!
 
    