Juha & Group,

> make sure you add the getMethod and setMethod mapping to your MMB
> attributes.

Thanks.  I did this and started re-reading your JMX book.  I now have a new
error :)

Below, I include my MBean Info generation code, and some error output.  When
I try to view the jmx-console page for my new MBean, the servlet tries to
get all of the bean's attributes.  The attribute "getId" is requested, but
this information is stored by the name "Id".  I assume that there is
something wrong with my MBean info, but I can't figure out what it is.
Error & debug output are listed below.  Any help would be appreciated.

  - Matt

### metadata generation

  public ModelMBeanInfo getModelMBeanInfo()
  {
    final boolean READABLE = true;
    final boolean WRITABLE = true;
    final boolean BOOLEAN = true;
    // build 'Id' read-write attribute
    Descriptor descr1 = new DescriptorSupport();
    descr1.setField("name", "Id");
    descr1.setField("descriptorType", "attribute");
    descr1.setField("displayName", "Identification");
    descr1.setField("setMethod", "setId");
    descr1.setField("getMethod", "getId");
    ModelMBeanAttributeInfo idAttrInfo;
    idAttrInfo = new ModelMBeanAttributeInfo("Id",
                                             String.class.getName(),
                                             "Identification.",
                                             READABLE,
                                             WRITABLE,
                                             !BOOLEAN,
                                             descr1);
    // MBean descriptor
    Descriptor descr4 = new DescriptorSupport();
    descr4.setField("name", "Widget");
    descr4.setField("descriptorType", "mbean"); // was MBean
    // create ModelMBeanInfo
    ModelMBeanAttributeInfo[] attrInfo = new ModelMBeanAttributeInfo[] {
idAttrInfo };
    ModelMBeanOperationInfo[] operationInfo = new ModelMBeanOperationInfo[]
{};
    ModelMBeanInfo info = new
ModelMBeanInfoSupport(RequiredModelMBean.class.getName(),
                                                    "Widget",
                                                    attrInfo,
                                                    null,
                                                    operationInfo,
                                                    null,
                                                    descr4);
    return info;
  }

### AttributeOperationREsolver constructor

11:33:33,020 INFO  [STDOUT] !!!m attributes[0]:
ModelMBeanAttributeInfo[Name=Id,Type=java.lang.String,Access=RW,Descript
or(setMethod=setId,descriptorType=attribute,name=Id,displayName=Identificati
on,getMethod=getId)]

### AttributeOperationREsolver.store()

11:33:33,020 INFO  [STDOUT] !!!m storing attrName: Id and code: 0

### AttributeOperationREsolver.lookup()

11:34:06,141 INFO  [STDOUT] !!!m looking up actionName: getId and signature:
[Ljava.lang.String;@1c87031

### error

java.lang.NoSuchMethodException: Unable to locate method for: getId()
        at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispat
cher.java:300)
        at
org.jboss.mx.interceptor.ObjectReferenceInterceptor.invoke(ObjectReferenceIn
terceptor.java:66)
        at
org.jboss.mx.interceptor.MBeanAttributeInterceptor.invoke(MBeanAttributeInte
rceptor.java:54)
        at
org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceIntercepto
r.java:91)
        at org.jboss.mx.server.MBeanInvoker.invoke(MBeanInvoker.java:79)
        at
org.jboss.mx.interceptor.MBeanAttributeInterceptor.invoke(MBeanAttributeInte
rceptor.java:129)
        at
org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceIntercepto
r.java:99)
        at
org.jboss.mx.server.MBeanInvoker.getAttribute(MBeanInvoker.java:110)
        at
javax.management.modelmbean.RequiredModelMBean.getAttribute(RequiredModelMBe
an.java:147)
        at
org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:455)
        at
org.jboss.jmx.adaptor.control.Server.getMBeanAttributeResultInfo(Server.java
:125)
        at
org.apache.jsp.inspectMBean_jsp._jspService(inspectMBean_jsp.java:179)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
02)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:362)
        at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandl
er.java:284)
        at
org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:216)
        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:151)
        at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.inspectMBean(HtmlAdaptorServle
t.java:113)
        at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServ
let.java:73)
        at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doGet(HtmlAdaptorServlet.java:
54)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:362)
        at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandl
er.java:284)
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:565)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
        at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext
.java:544)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1614)
        at org.mortbay.http.HttpServer.service(HttpServer.java:875)
        at org.jboss.jetty.Jetty.service(Jetty.java:531)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:785)
        at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:935)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:802)
        at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:200)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:294)
        at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
        at java.lang.Thread.run(Thread.java:536)






-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server 
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to