Search in sources :

Example 11 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class PermissionAdminMBeanHandler method constructInjectMBean.

/**
     * @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
     */
@Override
protected StandardMBean constructInjectMBean(Object targetService) {
    PermissionAdminMBean paMBean = new PermissionAdmin((org.osgi.service.permissionadmin.PermissionAdmin) targetService);
    StandardMBean mbean = null;
    try {
        mbean = new StandardMBean(paMBean, PermissionAdminMBean.class);
    } catch (NotCompliantMBeanException e) {
        Logger logger = agentContext.getLogger();
        logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
    }
    return mbean;
}
Also used : StandardMBean(javax.management.StandardMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) PermissionAdminMBean(org.osgi.jmx.service.permissionadmin.PermissionAdminMBean) Logger(org.apache.aries.jmx.Logger)

Example 12 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class UserAdminMBeanHandler method constructInjectMBean.

/**
     * @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
     */
@Override
protected StandardMBean constructInjectMBean(Object targetService) {
    UserAdminMBean uaMBean = new UserAdmin((org.osgi.service.useradmin.UserAdmin) targetService);
    StandardMBean mbean = null;
    try {
        mbean = new StandardMBean(uaMBean, UserAdminMBean.class);
    } catch (NotCompliantMBeanException e) {
        Logger logger = agentContext.getLogger();
        logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
    }
    return mbean;
}
Also used : StandardMBean(javax.management.StandardMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) UserAdminMBean(org.osgi.jmx.service.useradmin.UserAdminMBean) Logger(org.apache.aries.jmx.Logger)

Example 13 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project uPortal by Jasig.

the class RequestCacheAspect method getCacheStatistics.

protected final CacheStatistics getCacheStatistics(ProceedingJoinPoint pjp, RequestCache requestCache) {
    final Signature signature = pjp.getSignature();
    final String signatureString = signature.toString();
    CacheStatistics cacheStatistics = this.methodStats.get(signatureString);
    if (cacheStatistics == null) {
        final CacheStatistics newStats = new CacheStatistics();
        cacheStatistics = ConcurrentMapUtils.putIfAbsent(this.methodStats, signatureString, newStats);
        if (this.mBeanExportOperations != null && cacheStatistics == newStats) {
            final String nameString = "uPortal:section=Cache,RequestCache=RequestCache,name=" + EhcacheHibernateMbeanNames.mbeanSafe(signatureString);
            try {
                final ObjectName name = new ObjectName(nameString);
                registerMbean(cacheStatistics, name);
            } catch (MalformedObjectNameException e) {
                logger.warn("Failed to create ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
            } catch (NullPointerException e) {
                logger.warn("Failed to create ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
            } catch (InstanceAlreadyExistsException e) {
                logger.warn("ObjectName {} is already registered, the corresponding CacheStatistics will not be registered with JMX", nameString, e);
            } catch (MBeanRegistrationException e) {
                logger.warn("Failed to register ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
            } catch (NotCompliantMBeanException e) {
                logger.warn("Failed to register ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
            }
        }
    }
    return cacheStatistics;
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) Signature(org.aspectj.lang.Signature) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName)

Example 14 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.

the class DefaultMBeanServerInterceptor method getNewMBeanClassName.

private static String getNewMBeanClassName(Object mbeanToRegister) throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe = new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
Also used : DynamicMBean(javax.management.DynamicMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) IntrospectionException(javax.management.IntrospectionException) OperationsException(javax.management.OperationsException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ReflectionException(javax.management.ReflectionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) RuntimeMBeanException(javax.management.RuntimeMBeanException) RuntimeErrorException(javax.management.RuntimeErrorException) ListenerNotFoundException(javax.management.ListenerNotFoundException) RuntimeOperationsException(javax.management.RuntimeOperationsException) AttributeNotFoundException(javax.management.AttributeNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) JMRuntimeException(javax.management.JMRuntimeException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException)

Example 15 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.

the class Introspector method throwException.

/**
     * Throws a NotCompliantMBeanException or a SecurityException.
     * @param notCompliant the class which was under examination
     * @param cause the raeson why NotCompliantMBeanException should
     *        be thrown.
     * @return nothing - this method always throw an exception.
     *         The return type makes it possible to write
     *         <pre> throw throwException(clazz,cause); </pre>
     * @throws SecurityException - if cause is a SecurityException
     * @throws NotCompliantMBeanException otherwise.
     **/
static NotCompliantMBeanException throwException(Class<?> notCompliant, Throwable cause) throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException) cause;
    final String classname = (notCompliant == null) ? "null class" : notCompliant.getName();
    final String reason = (cause == null) ? "Not compliant" : cause.getMessage();
    final NotCompliantMBeanException res = new NotCompliantMBeanException(classname + ": " + reason);
    res.initCause(cause);
    throw res;
}
Also used : NotCompliantMBeanException(javax.management.NotCompliantMBeanException)

Aggregations

NotCompliantMBeanException (javax.management.NotCompliantMBeanException)58 ObjectName (javax.management.ObjectName)37 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)29 MBeanRegistrationException (javax.management.MBeanRegistrationException)29 MBeanServer (javax.management.MBeanServer)26 MalformedObjectNameException (javax.management.MalformedObjectNameException)24 StandardMBean (javax.management.StandardMBean)15 InstanceNotFoundException (javax.management.InstanceNotFoundException)9 MBeanException (javax.management.MBeanException)5 ReflectionException (javax.management.ReflectionException)5 AttributeNotFoundException (javax.management.AttributeNotFoundException)4 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)4 Logger (org.apache.aries.jmx.Logger)4 RegistrableStandardEmitterMBean (org.apache.aries.jmx.util.shared.RegistrableStandardEmitterMBean)4 IntrospectionException (javax.management.IntrospectionException)3 JMRuntimeException (javax.management.JMRuntimeException)3 ObjectInstance (javax.management.ObjectInstance)3 RuntimeOperationsException (javax.management.RuntimeOperationsException)3 PackageAdmin (org.osgi.service.packageadmin.PackageAdmin)3 IOException (java.io.IOException)2