Hi,
yes, I have found that post two days ago... after several hours figuring out myself :-(

what I did after that:
I got MBeanNotCompliant, since the lifecycleinterceptor seems to be missing the 
default constructor, so I added

   public LifeCycleInterceptor() {
        super();
        this.log = Logger.getLogger(this.getClass());
    }  // just to have a logger, else will result in a null pointer in the invoke()

In NukesBuilder I changed

Descriptor mbeanDesc = resourceInfo.getDescriptor(null, 
ModelMBeanConstants.MBEAN_DESCRIPTOR);
 
to:

      Descriptor mbeanDesc = resourceInfo.getMBeanDescriptor();

since in getDescriptor you can not have null as a first parameter:
        public Descriptor getDescriptor(String inDescriptorName,
                                        String inDescriptorType)
                throws MBeanException, RuntimeOperationsException {
            if (inDescriptorName==null) { throw new RuntimeOperationsException(new 
IllegalArgumentException("Descriptor is invalid"),
                                                         ("Exception occurred trying 
to set the descriptors of the MBeanInfo"));
            }


But I don't know if I took the correct function

And in LifeCycleManager I added the (missing) getNext() function (from 
AbstractInterceptor) and replaced all the getNext().invoke(incovation) with a call to 
that:


    // copied from AbstractInterceptor
    private Object getNext(Invocation invocation) throws Throwable{
      Interceptor ic = invocation.nextInterceptor();

      // if the invocation object does not provide us with more interceptors,
      // invoke the dispatcher that lands the invocation to its final target
      // in the resource object
      if (ic == null)
         return invocation.dispatch();

      // see if the next interceptor in the chain is shared
      if (ic.isShared())
      {
         // we require a common interface for all shared interceptors
         SharedInterceptor shared = (SharedInterceptor)ic;

         // we invoke shared interceptor it via the MBean server bus, get the
         // interceptors view to its MBean server
         MBeanServer server = shared.getMBeanServer();

         // And the object name the interceptor is registered under
         ObjectName name = shared.getObjectName();

         return server.invoke(
                  name, "invoke",
                  new Object[] { invocation },                    // args
                  new String[] { Invocation.class.getName() }     // signature
         );
      }

      // invoke non-shared interceptor directly via Java reference
      else
      {
         return ic.invoke(invocation);
      }
    }


... ending up with the following exceptions:

Caused by: java.lang.Exception: org.jboss.util.UnreachableStatementException: in
voke
        at org.jboss.nukes.mx.LifeCycleInterceptor.create(LifeCycleInterceptor.j
ava:112)
        at org.jboss.nukes.mx.LifeCycleInterceptor.invoke(LifeCycleInterceptor.j
ava:61)
        ... 80 more
Caused by: org.jboss.util.UnreachableStatementException: invoke
        at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelM
BeanAttributeInterceptor.java:199)
        at org.jboss.nukes.mx.LifeCycleInterceptor.getNext(LifeCycleInterceptor.
java:150)
        at org.jboss.nukes.mx.LifeCycleInterceptor.create(LifeCycleInterceptor.j
ava:110)
        ... 81 more


So, I don't exactly know what I am doing here, since I am into the JMX stuff since two 
days (beginning to understand how that ModelMBean works) and have a hard time figuring 
out what the hell you guys are doing with that interceptor/invoker stuff...




View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3844060#3844060

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3844060


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to