Package javax.management

Examples of javax.management.ServiceNotFoundException


      Logger logger = getLogger();

      // Find operation descriptor
      ModelMBeanInfo info = getModelMBeanInfo();
      if (info == null) throw new MBeanException(new ServiceNotFoundException("ModelMBeanInfo is null"));
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("ModelMBeanInfo is: " + info);

      // This is a clone, we use it read only
      ModelMBeanOperationInfo operInfo = info.getOperation(method);
      if (operInfo == null)
      {
         // Bug #940161 Required ModelMBean methods are not invoked
         try
         {
            // Look in RMMB public methods
            Class[] clzArgs = new Class[params.length];
            for (int i = 0; i < clzArgs.length; i++)
            {
               ClassLoader loader = getClass().getClassLoader();
               if (loader == null) loader = Thread.currentThread().getContextClassLoader();
               clzArgs[i] = loader.loadClass(params[i]);
            }

            // Class.getMethod only returns public methods
            Method invocationMethod = getClass().getMethod(method, clzArgs);
            operInfo = new ModelMBeanOperationInfo("", invocationMethod);
         }
         catch (Exception e)
         {
            throw new MBeanException(new ServiceNotFoundException("Cannot find ModelMBeanOperationInfo for operation " + method));
         }
      }
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Operation info is: " + operInfo);

      // This descriptor is a clone
      Descriptor operationDescriptor = operInfo.getDescriptor();
      if (operationDescriptor == null) throw new MBeanException(new ServiceNotFoundException("Operation descriptor for operation " + method + " cannot be null"));
      String role = (String)operationDescriptor.getFieldValue("role");
      if (role == null || !role.equals("operation")) throw new MBeanException(new ServiceNotFoundException("Operation descriptor field 'role' must be 'operation', not " + role));
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Operation descriptor is: " + operationDescriptor);

      // This returns a clone of the mbean descriptor, we use it read only
      Descriptor mbeanDescriptor = info.getMBeanDescriptor();
      if (mbeanDescriptor == null) throw new MBeanException(new ServiceNotFoundException("MBean descriptor cannot be null"));
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("MBean descriptor is: " + mbeanDescriptor);

      Object returnValue = null;

      String lastUpdateField = "lastReturnedTimeStamp";
View Full Code Here


      catch (NoSuchMethodException x)
      {
         realTarget = target;
      }

      if (realTarget == null) throw new MBeanException(new ServiceNotFoundException("Could not find target"));

      if (method == null)
      {
         try
         {
View Full Code Here

      return getMBeansFromURL(createURL(url));
   }

   public Set getMBeansFromURL(URL url) throws ServiceNotFoundException
   {
      if (url == null) throw new ServiceNotFoundException("Cannot load MBeans from null URL");

      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("MLet " + this + ", reading MLET file from " + url);

      InputStream is = null;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      BufferedOutputStream os = new BufferedOutputStream(baos);
      try
      {
         is = url.openStream();
         readFromAndWriteTo(is, os);
      }
      catch (IOException x)
      {
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot read input stream from URL " + url, x);
         throw new ServiceNotFoundException(x.toString());
      }
      finally
      {
         try
         {
View Full Code Here

         return mbeans;
      }
      catch (MLetParseException x)
      {
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot parse MLet file", x);
         throw new ServiceNotFoundException(x.toString());
      }
   }
View Full Code Here

      return codebase;
   }

   private Object createMBean(MLetTag tag) throws ServiceNotFoundException
   {
      if (server == null) throw new ServiceNotFoundException("MLet not registered on the MBeanServer");

      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("MLet " + this + ", creating MBean from\n" + tag);

      try
      {
         Object mbean = null;
         if (tag.getObject() != null)
         {
            // Read the file from the codebase URLs of this classloader
            String name = tag.getObject();
            InputStream is = getResourceAsStream(name);
            if (is == null) throw new ServiceNotFoundException("Cannot find serialized MBean " + name + " in MLet " + this);

            InputStream bis = new BufferedInputStream(is);

            // Deserialize using the MLet classloader
            ObjectInputStream ois = new ClassLoaderObjectInputStream(bis, this);
View Full Code Here

         URL url = new URL(urlString);
         return url;
      }
      catch (MalformedURLException x)
      {
         throw new ServiceNotFoundException(x.toString());
      }
   }
View Full Code Here

        // Acquire the ModelMBeanOperationInfo information for
        // the requested operation
        OperationInfo opInfo =
                operations.get(createOperationKey(aname, signature));
        if (opInfo == null)
            throw new MBeanException(new ServiceNotFoundException(
                    "Cannot find operation " + aname),
                    "Cannot find operation " + aname);

        // Prepare the signature required by Java reflection APIs
        // FIXME - should we use the signature from opInfo?
View Full Code Here

      {
         mbeansURL = mlet.getResource("examples/services/loading/mbeans.mlet");
      }

      // If the URL is still null, abort
      if (mbeansURL == null) throw new ServiceNotFoundException("Could not find MBeans to load");

      // Load the MBeans
      Set mbeans = mlet.getMBeansFromURL(mbeansURL);

      System.out.println("MLet has now the following classpath: " + Arrays.asList(mlet.getURLs()));
View Full Code Here

            // Ok, the MBean was registered successfully
            System.out.println("Registered MBean: " + mbean);
         }
      }

      if (!allLoaded) throw new ServiceNotFoundException("Some MBean could not be loaded");
   }
View Full Code Here

                  new Object[] { endpointConnection.getEndpoint(),
                      endpointConnection.getServerUri() });
        }
      }
      if (endpointConnection.send(tm, 0, startTimer) != true) {
        throw new ServiceNotFoundException();
      }

    } catch (Exception e) {
      if (delegate != null && aCommand == AsynchAEMessage.GetMeta) {
        delegate.cancelDelegateTimer();
View Full Code Here

TOP

Related Classes of javax.management.ServiceNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.