Package javax.management.remote

Examples of javax.management.remote.JMXProviderException


      String providerPackages = null;
      if (environment != null)
      {
         Object pkgs = environment.get(key);
         RmiConnectorActivator.log(LogService.LOG_DEBUG, "Provider packages in the environment: " + pkgs, null);
         if (pkgs != null && !(pkgs instanceof String)) throw new JMXProviderException("Provider package list must be a string");
         providerPackages = (String)pkgs;
      }
      return providerPackages;
   }
View Full Code Here


      {
         String pkg = tokenizer.nextToken().trim();
         RmiConnectorActivator.log(LogService.LOG_DEBUG,"Provider package: " + pkg, null);

         // The spec states the package cannot be empty
         if (pkg.length() == 0) throw new JMXProviderException("Empty package list not allowed: " + packages);

         String providerClassName = constructClassName(pkg, protocol, className);

         Class providerClass = null;
         try
         {
            providerClass = loadClass(providerClassName, loader);
         }
         catch (ClassNotFoundException x)
         {
            RmiConnectorActivator.log(LogService.LOG_DEBUG,"Provider class " + providerClassName + " not found, continuing with next package",null);
            continue;
         }
         catch (Exception x)
         {
            RmiConnectorActivator.log(LogService.LOG_WARNING,"Cannot load provider class " + providerClassName, x);
            throw new JMXProviderException("Cannot load provider class " + providerClassName, x);
         }

         try
         {
            return providerClass.newInstance();
         }
         catch (Exception x)
         {
            RmiConnectorActivator.log(LogService.LOG_WARNING,"Cannot instantiate provider class " + providerClassName, x);
            throw new JMXProviderException("Cannot instantiate provider class " + providerClassName, x);
         }
      }

      // Nothing found
      RmiConnectorActivator.log(LogService.LOG_DEBUG,"Could not find provider for protocol " + protocol + " in package list '" + packages + "'", null);
View Full Code Here

            // now have to make sure not an empty entry
            if(providerPackage.startsWith("|") || providerPackage.endsWith("|") ||
               providerPackage.indexOf("||") != -1)
            {

               throw new JMXProviderException("Error processing " + providerPackageKey + " from the " +
                                              "environment map.  An empty provider package exists.");
            }
         }
         else
         {
            throw new JMXProviderException("Error processing " + providerPackageKey + " from the " +
                                           "environment map.  Is is not of type String.");
         }
      }
      else
      {
View Full Code Here

      if (providerPackages == null)
      {
         providerPackages = findSystemPackageList(providerPkgsKey);
      }

      if (providerPackages != null && providerPackages.trim().length() == 0) throw new JMXProviderException("Provider package list cannot be an empty string");

      if (providerPackages == null)
         providerPackages = MX4JRemoteConstants.PROVIDER_PACKAGES;
      else
         providerPackages += MX4JRemoteConstants.PROVIDER_PACKAGES_SEPARATOR + MX4JRemoteConstants.PROVIDER_PACKAGES;
View Full Code Here

      {
         String pkg = tokenizer.nextToken().trim();
         if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Provider package: " + pkg);

         // The spec states the package cannot be empty
         if (pkg.length() == 0) throw new JMXProviderException("Empty package list not allowed: " + packages);

         String providerClassName = constructClassName(pkg, protocol, className);

         Class providerClass = null;
         try
         {
            providerClass = loadClass(providerClassName, loader);
         }
         catch (ClassNotFoundException x)
         {
            if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Provider class " + providerClassName + " not found, " + (tokenizer.hasMoreTokens() ? "continuing with next package" : "no more packages to try"));
            continue;
         }
         catch (Exception x)
         {
            if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot load provider class " + providerClassName, x);
            throw new JMXProviderException("Cannot load provider class " + providerClassName, x);
         }

         try
         {
            Object provider = providerClass.newInstance();
            result.add(provider);
         }
         catch (Exception x)
         {
            if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot instantiate provider class " + providerClassName, x);
            throw new JMXProviderException("Cannot instantiate provider class " + providerClassName, x);
         }
      }

      try
      {
View Full Code Here

      return jp;
   }

   public JMXProviderException createJMXProviderException()
   {
      JMXProviderException ex = new JMXProviderException();
      return ex;
   }
View Full Code Here

      if (!valid) throw new RuntimeException();
   }

   public void compareJMXProviderException(Object obj1, Object obj2)
   {
      JMXProviderException jpe1 = (JMXProviderException)obj1;
      JMXProviderException jpe2 = (JMXProviderException)obj2;
      boolean valid = true;
      /*
      if (jpe1.getCause() != null)
        valid = valid && (jpe1.getCause().equals(jpe2.getCause()));
        */
      if (jpe1.getLocalizedMessage() != null)
         valid = valid && (jpe1.getLocalizedMessage().equals(jpe2.getLocalizedMessage()));
      if (jpe1.getMessage() != null)
         valid = valid && (jpe1.getMessage().equals(jpe2.getMessage()));

      valid = valid && (jpe1.toString().equals(jpe2.toString()));
      if (!valid) throw new RuntimeException();
   }
View Full Code Here

  private static Throwable makeThrowable(Random r, Throwable cause) {
    int exType = r.nextInt(4);
    switch(exType) {
    case 0: return new IllegalArgumentException("an illegal argument was passed", cause);
    case 1: return new Exception("this is a test", cause);
    case 2: return new JMXProviderException("jmx provider exception error occured", cause);
    case 3: return new OutOfMemoryError("ran out of memory");
    }
    return null;
  }
View Full Code Here

        called = true;
        System.out.println("JMXConnectorServerProviderImpl called");
        if(protocol.equals("rmi"))
            return new RMIConnectorServer(url, map, mbeanServer);
        if(protocol.equals("throw-provider-exception"))
            throw new JMXProviderException("I have been asked to throw");

        throw new IllegalArgumentException("UNKNOWN PROTOCOL");
    }
View Full Code Here

        System.out.println("JMXConnectorProviderImpl called");

        if(protocol.equals("rmi"))
            return new RMIConnector(url, map);
        if(protocol.equals("throw-provider-exception"))
            throw new JMXProviderException("I have been asked to throw");

        throw new IllegalArgumentException("UNKNOWN PROTOCOL");
    }
View Full Code Here

TOP

Related Classes of javax.management.remote.JMXProviderException

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.