I am trying to create a simple caching XMBean using JBoss 3.2.1 and everything is 
working fine until I try to use the proxy for the MBean I get the following exception 
on the client:

java.lang.reflect.UndeclaredThrowableException
        at $Proxy0.create(Unknown Source)
        at com.sempra.cache.jmx.JmxSimpleCacheTest.testInvalidStateFetch(JmxSim
leCacheTest.java:95)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
Caused by: java.lang.NoSuchMethodException: Unable to locate method for: invoke
org.jboss.invocation.Invocation)
        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBe
nDispatcher.java:288)
        at org.jboss.mx.interceptor.ObjectReferenceInterceptor.invoke(ObjectRef
renceInterceptor.java:59)
        at org.jboss.mx.interceptor.MBeanAttributeInterceptor.invoke(MBeanAttri
uteInterceptor.java:43)
        at org.jboss.mx.interceptor.PersistenceInterceptor2.invoke(PersistenceI
terceptor2.java:93)
        at org.jboss.mx.server.MBeanInvoker.invoke(MBeanInvoker.java:75)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
        at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java
359)
        at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:
60)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTranspor
.java:701)
        at java.lang.Thread.run(Thread.java:536)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Strea
RemoteCall.java:247)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java
223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
        at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Sou
ce)
        at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInv
kerProxy.java:135)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.ja
a:87)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:
5)
        at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodIntercept
r.java:55)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
        ... 17 more

The code fragment that is failing is as follows:

        try {
            SimpleCache xmbean = (SimpleCache) ctx.lookup("jrmp/SimpleCache");
            xmbean.create("test");
            assertTrue("Able to call MBean without security", false);
        } catch (NamingException e) {
        } catch (CacheException e) {
        }

The proxy fails when calling the xmbean.create("test") method.

The mbean xml descriptor is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.0//EN" 
"http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd";>

<mbean>
    <description>The JNDIMap XMBean Example Version 2</description>

    <descriptors>
       <state-action-on-update value="keep-running"/>
    </descriptors>


    <class>com.sempra.cache.jmx.JmxSimpleCache</class>

    <constructor>
        <description>The default constructor</description>
        <name>JmxSimpleCache</name>
    </constructor>

    <!-- Attributes -->
    <attribute access="read-write" getMethod="getJndiName" setMethod="setJndiName">
        <description>The location in JNDI where the cache will be bound</description>
        <name>JndiName</name>
        <type>java.lang.String</type>
        <descriptors>
            <default value="cache/SimpleCache" />
        </descriptors>
    </attribute>

    <!-- Operations -->
    <operation>
        <description>The start lifecycle operation</description>
        <name>start</name>
    </operation>

    <operation>
        <description>The stop lifecycle operation</description>
        <name>stop</name>
    </operation>

    <operation impact="ACTION">
        <description>Create a new cache</description>
        <name>create</name>
        <parameter>
            <description>The name the cache will be stored under</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
    </operation>

    <operation impact="ACTION">
        <description>Create and initialize a new cache</description>
        <name>create</name>
        <parameter>
            <description>The name the cache will be stored under</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>The initial state of the cache</description>
            <name>state</name>
            <type>java.util.Map</type>
        </parameter>
    </operation>

    <operation impact="ACTION">
        <description>Add a new value to the cache</description>
        <name>add</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>The key of the object to be cached</description>
            <name>key</name>
            <type>java.lang.Object</type>
        </parameter>
        <parameter>
            <description>The object to be cached</description>
            <name>value</name>
            <type>java.lang.Object</type>
        </parameter>
    </operation>

    <operation impact="ACTION">
        <description>Add multiple values to the cache</description>
        <name>add</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>A map of the key/value pairs to be added to the 
cache</description>
            <name>state</name>
            <type>java.util.Map</type>
        </parameter>
    </operation>

    <operation impact="ACTION">
        <description>Remove a value from the cache</description>
        <name>remove</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>The key of the object to be removed</description>
            <name>key</name>
            <type>java.lang.Object</type>
        </parameter>
    </operation>

    <operation impact="ACTION">
        <description>Remove multiple values from the cache</description>
        <name>remove</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>A set of the keys to be removed from the cache</description>
            <name>keys</name>
            <type>java.util.Set</type>
        </parameter>
    </operation>

    <operation impact="INFO">
        <description>Retrieve a value from the cache</description>
        <name>get</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>The key of the object to be retrieved</description>
            <name>key</name>
            <type>java.lang.Object</type>
        </parameter>
        <return-type>java.lang.Object</return-type>
    </operation>

    <operation impact="INFO">
        <description>Retrieve a range of values from the cache</description>
        <name>get</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <parameter>
            <description>The starting key (inclusive) of the object to be 
retrieved</description>
            <name>fromKey</name>
            <type>java.lang.Object</type>
        </parameter>
        <parameter>
            <description>The ending key (not inclusive) of the object to be 
retrieved</description>
            <name>toKey</name>
            <type>java.lang.Object</type>
        </parameter>
        <return-type>java.util.Map</return-type>
    </operation>

    <operation impact="INFO">
        <description>Retrieve the entire cache state</description>
        <name>get</name>
        <parameter>
            <description>The name of the cache</description>
            <name>name</name>
            <type>java.lang.String</type>
        </parameter>
        <return-type>java.util.Map</return-type>
    </operation>

</mbean>

And the jboss-service.xml is as follows:

<?xml version='1.0' encoding='UTF-8' ?>
<!--DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 3.2//EN" 
"http://www.jboss.org/j2ee/dtd/jboss-service_3_2.dtd";
This instance goes beyond the jboss-service_3_2.dtd model
due to its use of the embedded <interceptors> element in the
ClientInterceptors attribute of the JRMPProxyFactory config.
-->

<server>
   <mbean code="com.sempra.cache.jmx.JmxSimpleCache"
      name="com.sempra.cache:service=SimpleCache"
      xmbean-dd="META-INF/simple-cache-xmbean.xml">
      <attribute name="JndiName">cache/SimpleCache</attribute>
      <depends>jboss:service=Naming</depends>
   </mbean>

   <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
      name="jboss.cache:service=proxyFactory,type=jrmp,target=SimpleCache">
      <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
      <attribute name="TargetName">com.sempra.cache:service=SimpleCache</attribute>
      <attribute name="JndiName">jrmp/SimpleCache</attribute>
      <attribute name="ExportedInterface">com.sempra.cache.SimpleCache</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>com.sempra.cache:service=SimpleCache</depends>
   </mbean>

</server>

The com.sempra.cache.jmx.JmxSimpleCache simple contains an instance of 
com.sempra.cache.DefaultSimpleCache that implements com.sempra.cache.SimpleCache. All 
work is delegated to this object. Attached is the JmxSimpleCache, DefaultSimpleCache, 
and SimpleCache classes/interfaces. Any constructive advice would be helpful. I have 
searched the forums, but all the searches are returning hundreds of postings. All of 
the ones I have looked at are unrelated

 <<DefaultSimpleCache.java>>  <<SimpleCache.java>>  <<JmxSimpleCache.java>> 
Karl Koster
[EMAIL PROTECTED]



**********************************************************************
This e-mail contains privileged attorney-client communications and/or confidential 
information, and is only for the use by the intended recipient. Receipt by an 
unintended recipient does not constitute a waiver of any applicable privilege.

Reading, disclosure, discussion, dissemination, distribution or copying of this 
information by anyone other than the intended recipient or his or her employees or 
agents is strictly prohibited.  If you have received this communication in error, 
please immediately notify us and delete the original material from your computer.

Sempra Energy Trading Corp. (SET) is not the same company as SDG&E or SoCalGas, the 
utilities owned by SET's parent company.  SET is not regulated by the California 
Public Utilities Commission and you do not have to buy SET's products and services to 
continue to receive quality regulated service from the utilities.
**********************************************************************

Attachment: DefaultSimpleCache.java
Description: DefaultSimpleCache.java

Attachment: SimpleCache.java
Description: SimpleCache.java

Attachment: JmxSimpleCache.java
Description: JmxSimpleCache.java

Reply via email to