Package javax.management

Examples of javax.management.ReflectionException


   private ObjectInstance registerMBean(Object object, ObjectName name, Map valueMap)
      throws MBeanException, ReflectionException, InstanceNotFoundException
   {
      if (object == null)
      {
         throw new ReflectionException(new IllegalArgumentException(
               "Attempting to register a null object"
         ));
      }
     
      return (ObjectInstance)
View Full Code Here


      InvocationContext ctx = (InvocationContext)operationContextMap.get(key);

      // if the server does not contain this context, we do not have the operation
      if (ctx == null)
      {
         throw new ReflectionException(new IllegalArgumentException(
               "Unable to find operation " + operationName +
               getSignatureString(signature))
         );
      }
     
View Full Code Here

         if (loaderName != null)
            cl = (ClassLoader)registry.get(loaderName).getResourceInstance();
      }
      catch (ClassCastException e)
      {
         throw new ReflectionException(e, loaderName + " is not a class loader.");
      }

      if (cl == null)
         cl = this.getClass().getClassLoader();
View Full Code Here

      {
         throw new OperationsException("I/O exception deserializing: " + e.getMessage());
      }
      catch (ClassNotFoundException e)
      {
         throw new ReflectionException(e, "Class not found from default repository: " + className);
      }
   }
View Full Code Here

      if (className == null)
         throw new RuntimeOperationsException(new IllegalArgumentException(
                   "Null className"));

      if (className.equals(""))
         throw new ReflectionException(new ClassNotFoundException("empty class name"));
        
      Thread thread = Thread.currentThread();
      ClassLoader oldTCL = thread.getContextClassLoader();
      try
      {
         Class clazz = null;
         if (cl != null)
         {
            if (cl != oldTCL)
               thread.setContextClassLoader(cl);
            clazz = cl.loadClass(className);
         }
         else
            clazz = DefaultLoaderRepository.loadClass(className);

         Class[] sign = new Class[signature.length];
         for (int i = 0; i < signature.length; ++i)
         {
            try
            {
               if (cl != null)
                  sign[i] = cl.loadClass(signature[i]);
               else
                  sign[i] = DefaultLoaderRepository.loadClass(signature[i]);
            }
            catch (ClassNotFoundException e)
            {
               // FIXME: should we delegate to DLR before throwing the exception?
               throw new ReflectionException(e, "Constructor parameter class not found: " + signature[i]);
            }
         }
         Constructor constructor = clazz.getConstructor(sign);
         return constructor.newInstance(params);
      }
View Full Code Here

    * Handles errors thrown during class instantiation
    */
   protected void handleInstantiateExceptions(Throwable t, String className) throws ReflectionException, MBeanException
   {
      if (t instanceof ClassNotFoundException)
         throw new ReflectionException((Exception)t, "Class not found: " + className);

      else if (t instanceof InstantiationException)
         throw new ReflectionException((Exception)t, "Cannot instantiate with no-args constructor: "  + className);

      else if (t instanceof IllegalAccessException)
         throw new ReflectionException((Exception)t, "Illegal access to default constructor: "  + className);

      else if (t instanceof NoSuchMethodException)
         throw new ReflectionException((Exception)t, className + " does not have a public no args constructor.");

      else if (t instanceof SecurityException)
         throw new ReflectionException((Exception)t, "Can't access default constructor for " + className + ": " + t.toString());

      else if (t instanceof InvocationTargetException)
      {
         Throwable root = ((InvocationTargetException)t).getTargetException();

View Full Code Here

      {
         cl = (ClassLoader)registry.get(loaderName).getResourceInstance();
      }
      catch (ClassCastException e)
      {
         throw new ReflectionException(e, loaderName + " is not a class loader.");
      }
      if (cl == null)
         cl = getClass().getClassLoader();

      return registerMBean(mbean, name, cl);
View Full Code Here

     
      // assume all other exceptions are reflection related
      else if (t instanceof Exception)
      {
         throw new InvocationException(
               new ReflectionException((Exception)t, t.toString())
         );
      }
     
      else if (t instanceof Error)
      {
View Full Code Here

            if (member == null) throw new AttributeNotFoundException(s);

            return member.get();
        } catch (Exception e) {
            e.printStackTrace();
            throw new ReflectionException(e);
        }
    }
View Full Code Here

        }

        try {
            return method.invoke(member.target, args);
        } catch (InvocationTargetException e) {
            throw new ReflectionException((Exception)e.getCause());
        } catch (Exception e) {
            throw new ReflectionException(e);
        }
    }
View Full Code Here

TOP

Related Classes of javax.management.ReflectionException

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.