1 2 Previous Next 16 Replies Latest reply on Sep 14, 2004 10:43 PM by jae77 Go to original post
      • 15. Re: Nukes compatibility to JBoss upgrade path
        invisiblemage

        ok, had some time today to have a look again...

        The getNext() is now done in the AbstractInterceptor.Invoke()...
        so I just deleted all the lines in the LifecycleInterceptor.

        Some strange things happen now and then wenn in the LifeCycle the invoke() is called with type "invoke"... debug showed that "invoke, getLanguage" is called on the MBeanAttributeInterceptor, which then throws an Exception because it does not understand the command.
        I just catched this exception and returned null in LifeCycle.invoke. It should not be done this way, but now nukes deploys, at least...

        Next problem ist a nullpointer:

        15:02:19,484 ERROR [Engine] StandardWrapperValve[NukeServlet]: Servlet.service()
        for servlet NukeServlet threw exception
        java.lang.NullPointerException: charsetName
        at java.lang.String.(String.java:410)
        at java.lang.String.(String.java:440)
        at org.apache.coyote.tomcat5.CoyoteRequest.setCharacterEncoding(CoyoteRe
        quest.java:1523)
        at org.apache.coyote.tomcat5.CoyoteRequestFacade.setCharacterEncoding(Co
        yoteRequestFacade.java:240)
        at org.jboss.nukes.servlet.ParameterEncodingFilter.doFilter(ParameterEnc
        odingFilter.java:58)


        LifeCycleInterceptor:


        public class LifeCycleInterceptor
         extends AbstractInterceptor {
        
         // Attributes ----------------------------------------------------
        
         private Logger log;
        
        
         // Constructors --------------------------------------------------
        
         public LifeCycleInterceptor() {
         super();
         this.log = Logger.getLogger(this.getClass());
         log.debug("called no-args-constructor");
         }
        
         public LifeCycleInterceptor(MBeanInfo info, MBeanInvoker invoker) {
         log.debug("called constructor:LifeCycleInterceptor(MBeanInfo info, MBeanInvoker invoker)");
         this.name=info.getClassName();
         this.log = Logger.getLogger(info.getClassName());
         }
        
         // Public --------------------------------------------------------
        
         public Object invoke(Invocation invocation) throws Exception,Throwable {
         this.name=invocation.getInvoker().getMetaData().getClassName();
         this.log = Logger.getLogger(invocation.getInvoker().getMetaData().getClassName());
         log.debug("LifeCycleInterceptor::invoke();invocation.getType()"+invocation.getType());
         log.debug("LifeCycleInterceptor::invoke();invocation.getName()"+invocation.getName());
         try {
         if (invocation.getType() == Invocation.OP_INVOKE &&
         // changed here
         //if (invocation.getInvocationType() == Invocation.OPERATION &&
         invocation.getSignature() != null &&
         invocation.getSignature().length == 0) {
         if ("create".equals(invocation.getName())) {
         log.info("Creating");
         create(invocation);
         log.info("Created");
         return null;
         } else if ("start".equals(invocation.getName())) {
         log.info("Starting");
         start(invocation);
         log.info("Started");
         return null;
         } else if ("stop".equals(invocation.getName())) {
         log.info("Stopping");
         stop(invocation);
         log.info("Stopped");
         return null;
         } else if ("destroy".equals(invocation.getName())) {
         log.info("Destroying");
         destroy(invocation);
         log.info("Destroyed");
         return null;
         }
         }
         }
         catch (Throwable e) {
         log.error(e.getMessage());
         log.debug("invocationtype:"+invocation.getType());
         throw new Exception(e);
         }
         //getNext().invoke;
         log.debug("calling interceptor.invoke()");
         try {
         return invocation.invoke();
         } catch (Throwable e) {// changed here
         log.debug("catched exception "+e.getMessage());
         return null;
         }
         }
        
         // Private -------------------------------------------------------
        
         private void setState(int nextState, MBeanInvoker invoker) throws Exception {
         // if state changes
         if (getState(invoker) != nextState) {
         try {
         // update the state
         invoker.setAttribute(new Attribute("State", new Integer(nextState)));
         } catch (MBeanException e) {
         log.error("Cannot send state changed notification", e);
         }
         }
         }
        
         private int getState(MBeanInvoker invoker) throws Exception {
         return ((Integer) invoker.getAttribute("State")).intValue();
         }
        
         private void create(Invocation invocation) throws Exception {
         setState(ServiceMBean.CREATED,invocation.getInvoker());
         }
        
         private void start(Invocation invocation) throws Exception {
         int state = getState(invocation.getInvoker());
         if (state == ServiceMBean.STARTING || state == ServiceMBean.STARTED) {
         return;
         }
         setState(ServiceMBean.STARTING,invocation.getInvoker());
         transition(invocation, ServiceMBean.STARTED, ServiceMBean.FAILED);
         }
        
         private void stop(Invocation invocation) throws Exception {
         if (getState(invocation.getInvoker()) != ServiceMBean.STARTED) {
         return;
         }
         setState(ServiceMBean.STOPPING,invocation.getInvoker());
         transition(invocation, ServiceMBean.STOPPED, ServiceMBean.FAILED);
         }
        
         private void destroy(Invocation invocation) throws Exception, Throwable {
         int state = getState(invocation.getInvoker());
         if (state == ServiceMBean.DESTROYED) {
         return;
         }
         if (state == ServiceMBean.STOPPED) {
         invocation.getInvoker().invoke("stop", new Object[0], new String[0]);
         }
         setState(ServiceMBean.DESTROYED,invocation.getInvoker());
         }
        
         private void transition(Invocation invocation, int success, int failure) throws Exception {
         try {
         setState(success,invocation.getInvoker());
         } catch (Throwable e) {
         setState(failure,invocation.getInvoker());
         throw new Exception(e);
         }
         }
        }


        • 16. Re: Nukes compatibility to JBoss upgrade path
          jae77

          has any further work gone into this? i've given this a go myself, and i keep getting the following error trying to deploy:

          2004-09-14 22:27:11,851 ERROR [org.jboss.nukes.core.Main] Cannot register on component nukes.themes:name=imagic
          java.lang.reflect.UndeclaredThrowableException
           at $Proxy206.handleNotification(Unknown Source)
           at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:98)
           at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:83)
           at org.jboss.nukes.core.Main$1.handleNotification(Main.java:400)
           at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138)
           at $Proxy206.handleNotification(Unknown Source)
           at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:98)
           at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:83)
           at javax.management.MBeanServerDelegate.sendNotification(MBeanServerDelegate.java:106)
           at org.jboss.mx.server.registry.BasicMBeanRegistry.sendRegistrationNotification(BasicMBeanRegistry.java:325)
           at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:223)
           at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
           at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1018)
           at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:981)
           at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:318)
           at org.jboss.system.ServiceCreator.install(ServiceCreator.java:121)
           at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:149)
           at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:114)
           at org.jboss.system.ServiceController.install(ServiceController.java:198)
           at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
           at $Proxy4.install(Unknown Source)
           at org.jboss.deployment.SARDeployer.create(SARDeployer.java:204)
           at org.jboss.deployment.MainDeployer.create(MainDeployer.java:790)
           at org.jboss.deployment.MainDeployer.create(MainDeployer.java:782)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:644)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
           at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
           at $Proxy7.deploy(Unknown Source)
           at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
           at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:460)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
          Caused by: java.lang.reflect.InvocationTargetException
           at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138)
           ... 62 more
          Caused by: java.lang.IllegalArgumentException: interface org.jboss.nukes.theme.Theme is not visible from class loader
           at java.lang.reflect.Proxy.getProxyClass(Proxy.java:331)
           at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:552)
           at org.jboss.mx.util.MBeanProxy.get(MBeanProxy.java:76)
           at org.jboss.mx.util.MBeanProxy.get(MBeanProxy.java:64)
           at org.jboss.nukes.core.modules.theme.ThemeModule$1.handleNotification(ThemeModule.java:189)
           ... 66 more
          


          i don't understand why it would be reported that the Theme interface is not visible via the class loader.

          my current thought is that something isn't right in the LifeCycleInterceptor, but i'm not really sure what that would be.

          this is what i've done w/ the class:

          public class LifeCycleInterceptor
           extends AbstractInterceptor
          {
          
           public LifeCycleInterceptor() {
           super("LifeCycle Interceptor");
           this.log = Logger.getLogger(this.getClass().getName());
          
           log.debug("no args life cycle interceptor");
           }
          
           //private MBeanInvoker invoker;
           private MBeanInfo info;
          
           // Attributes ----------------------------------------------------
          
           private Logger log;
          
           // Constructors --------------------------------------------------
          
           public LifeCycleInterceptor(MBeanInfo info, MBeanInvoker invoker)
           {
           //super(info, invoker);
           //this.invoker = invoker;
           this.info = info;
           this.log = Logger.getLogger(invoker.getResource().getClass());
           log.debug("constructor w/ args");
           }
          
           // Public --------------------------------------------------------
          
           public Object invoke(Invocation invocation) throws InvocationException
           {
           try
           {
           if (invocation.getType() == InvocationContext.OP_INVOKE &&
           invocation.getSignature() != null &&
           invocation.getSignature().length == 0)
           {
           if ("create".equals(invocation.getName()))
           {
           log.info("Creating");
           create(invocation);
           log.info("Created");
           return null;
           }
           else if ("start".equals(invocation.getName()))
           {
           log.info("Starting");
           start(invocation);
           log.info("Started");
           return null;
           }
           else if ("stop".equals(invocation.getName()))
           {
           log.info("Stopping");
           stop(invocation);
           log.info("Stopped");
           return null;
           }
           else if ("destroy".equals(invocation.getName()))
           {
           log.info("Destroying");
           destroy(invocation);
           log.info("Destroyed");
           return null;
           }
           }
           }
           catch (InvocationException e)
           {
           throw e;
           }
           catch (Exception e)
           {
           // dirty
           throw new InvocationException(e);
           }
           return invocation.nextInterceptor().invoke(invocation);
           }
          
           // Private -------------------------------------------------------
          
           private void setState(int nextState, MBeanInvoker invoker) throws Exception
           {
           // if state changes
           if (getState(invoker) != nextState)
           {
           try
           {
           // update the state
           invoker.setAttribute(new Attribute("State", new Integer(nextState)));
           }
           catch (MBeanException e)
           {
           log.error("Cannot send state changed notification", e);
           }
           }
           }
          
           private int getState(MBeanInvoker invoker) throws Exception
           {
           return ((Integer) invoker.getAttribute("State")).intValue();
           }
          
           private void create(Invocation invocation) throws Exception
           {
           invocation.nextInterceptor().invoke(invocation);
           setState(ServiceMBean.CREATED, invocation.getInvoker());
           }
          
           private void start(Invocation invocation) throws Exception
           {
           int state = getState(invocation.getInvoker());
           if (state == ServiceMBean.STARTING || state == ServiceMBean.STARTED)
           {
           return;
           }
           setState(ServiceMBean.STARTING, invocation.getInvoker());
           transition(invocation, ServiceMBean.STARTED, ServiceMBean.FAILED);
           }
          
           private void stop(Invocation invocation) throws Exception
           {
           if (getState(invocation.getInvoker()) != ServiceMBean.STARTED)
           {
           return;
           }
           setState(ServiceMBean.STOPPING, invocation.getInvoker());
           transition(invocation, ServiceMBean.STOPPED, ServiceMBean.FAILED);
           }
          
           private void destroy(Invocation invocation) throws Exception
           {
           int state = getState(invocation.getInvoker());
           if (state == ServiceMBean.DESTROYED)
           {
           return;
           }
           if (state == ServiceMBean.STOPPED)
           {
           invocation.getInvoker().invoke("stop", new Object[0], new String[0]);
           }
           try
           {
           invocation.nextInterceptor().invoke(invocation);
           }
           finally
           {
           setState(ServiceMBean.DESTROYED, invocation.getInvoker());
           }
           }
          
           private void transition(Invocation invocation, int success, int failure) throws Exception
           {
           try
           {
           invocation.nextInterceptor().invoke(invocation);
           setState(success, invocation.getInvoker());
           }
           catch (InvocationException e)
           {
           setState(failure, invocation.getInvoker());
           throw e;
           }
           }
          }
          


          any ideas?

          1 2 Previous Next