Juni 27th, 2006
MBean per JNDI zur Verfügung stellen
Um ein MBean, wie z.B. einen TreeCache, auch per JNDI zur Verfügung zu stellen, muss lediglich ein weiteres MBean erstellt werden. Dazu wird in die entsprechende Service.xml-Datei folgender Code am Ende eingefügt:
<?xml version=”1.0″ encoding=“UTF-8″?> <server> … <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=MyTreeCache</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=MyTreeCache</depends> </mbean> </server>
Es wird dazu die JrmpProxyFactory verwendet um den Zugriff zu ermöglichen.