java类javax.management.modelmbean.InvalidTargetObjectTypeException的实例源码

MX4JModelMBean.java 文件源码 项目:monarch 阅读 19 收藏 0 点赞 0 评论 0
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException {
  Logger logger = getLogger();
  Object target = descriptor.getFieldValue("targetObject");
  if (logger.isEnabledFor(Logger.TRACE))
    logger.trace("targetObject is: " + target);
  if (target == null) {
    target = getManagedResource();
  } else {
    String targetObjectType = (String) descriptor.getFieldValue("targetObjectType");
    if (logger.isEnabledFor(Logger.TRACE))
      logger.trace("targetObjectType is: " + targetObjectType);
    if (targetObjectType == null) {
      // Not defined, assume object reference
      targetObjectType = OBJECT_RESOURCE_TYPE;
    }

    if (!isResourceTypeSupported(targetObjectType))
      throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
  }
  return target;
}
MX4JModelMBean.java 文件源码 项目:gemfirexd-oss 阅读 29 收藏 0 点赞 0 评论 0
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException
{
   Logger logger = getLogger();
   Object target = descriptor.getFieldValue("targetObject");
   if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObject is: " + target);
   if (target == null)
   {
      target = getManagedResource();
   }
   else
   {
      String targetObjectType = (String)descriptor.getFieldValue("targetObjectType");
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObjectType is: " + targetObjectType);
      if (targetObjectType == null)
      {
         // Not defined, assume object reference
         targetObjectType = OBJECT_RESOURCE_TYPE;
      }

      if (!isResourceTypeSupported(targetObjectType)) throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
   }
   return target;
}
MX4JModelMBean.java 文件源码 项目:gemfirexd-oss 阅读 24 收藏 0 点赞 0 评论 0
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException
{
   Logger logger = getLogger();
   Object target = descriptor.getFieldValue("targetObject");
   if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObject is: " + target);
   if (target == null)
   {
      target = getManagedResource();
   }
   else
   {
      String targetObjectType = (String)descriptor.getFieldValue("targetObjectType");
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObjectType is: " + targetObjectType);
      if (targetObjectType == null)
      {
         // Not defined, assume object reference
         targetObjectType = OBJECT_RESOURCE_TYPE;
      }

      if (!isResourceTypeSupported(targetObjectType)) throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
   }
   return target;
}
SpringModelMBean.java 文件源码 项目:lams 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
BaseModelMBean.java 文件源码 项目:lams 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
MX4JModelMBean.java 文件源码 项目:monarch 阅读 31 收藏 0 点赞 0 评论 0
public void setManagedResource(Object resource, String resourceType) throws MBeanException,
    RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException {
  if (resource == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
  if (!isResourceTypeSupported(resourceType))
    throw new InvalidTargetObjectTypeException(resourceType);

  Logger logger = getLogger();
  if (logger.isEnabledFor(Logger.DEBUG))
    logger.debug("Setting managed resource to be: " + resource);
  m_managedResource = resource;
}
SpringModelMBean.java 文件源码 项目:spring4-understanding 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
SpringModelMBean.java 文件源码 项目:my-spring-cache-redis 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
MX4JModelMBean.java 文件源码 项目:gemfirexd-oss 阅读 27 收藏 0 点赞 0 评论 0
public void setManagedResource(Object resource, String resourceType) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
{
   if (resource == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
   if (!isResourceTypeSupported(resourceType)) throw new InvalidTargetObjectTypeException(resourceType);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Setting managed resource to be: " + resource);
   m_managedResource = resource;
}
SpringModelMBean.java 文件源码 项目:spring 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
DefaultManagementMBeanAssembler.java 文件源码 项目:flowable-engine 阅读 19 收藏 0 点赞 0 评论 0
@Override
public ModelMBean assemble(Object obj, ObjectName name) throws JMException {
    ModelMBeanInfo mbi = null;

    // use the default provided mbean which has been annotated with JMX
    // annotations
    LOGGER.trace("Assembling MBeanInfo for: {} from @ManagedResource object: {}", name, obj);
    mbi = assembler.getMBeanInfo(obj, null, name.toString());

    if (mbi == null) {
        return null;
    }

    RequiredModelMBean mbean = new RequiredModelMBean(mbi);

    try {
        mbean.setManagedResource(obj, "ObjectReference");
    } catch (InvalidTargetObjectTypeException e) {
        throw new JMException(e.getMessage());
    }

    // Allows the managed object to send notifications
    if (obj instanceof NotificationSenderAware) {
        ((NotificationSenderAware) obj).setNotificationSender(new NotificationSenderAdapter(mbean));
    }

    return mbean;
}
MX4JModelMBean.java 文件源码 项目:gemfirexd-oss 阅读 21 收藏 0 点赞 0 评论 0
public void setManagedResource(Object resource, String resourceType) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
{
   if (resource == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
   if (!isResourceTypeSupported(resourceType)) throw new InvalidTargetObjectTypeException(resourceType);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Setting managed resource to be: " + resource);
   m_managedResource = resource;
}
HttpServerMBean.java 文件源码 项目:Wilma 阅读 19 收藏 0 点赞 0 评论 0
/** Constructor. 
 * @exception MBeanException 
 * @exception InstanceNotFoundException 
 */
protected HttpServerMBean(HttpServer httpServer)
    throws MBeanException, InstanceNotFoundException
{
    _httpServer=httpServer;
    _httpServer.addEventListener(this);
    try{super.setManagedResource(_httpServer,"objectReference");}
    catch(InvalidTargetObjectTypeException e){log.warn(LogSupport.EXCEPTION,e);}
}
HttpServerMBean.java 文件源码 项目:Wilma 阅读 22 收藏 0 点赞 0 评论 0
public void setManagedResource(Object o,String s)
    throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException
{
    if (o!=null)
        ((HttpServer)o).addEventListener(this);
    super.setManagedResource(o,s);
}
XmlUnmarshaller.java 文件源码 项目:serialisation 阅读 32 收藏 0 点赞 0 评论 0
private Class<?> getType(Attributes attributes, String nomAttribut) throws ClassNotFoundException, InvalidTargetObjectTypeException {
    Class<?> typeToUnmarshall;
    String typeEcrit = attributes.getValue("type");
    if(typeEcrit != null){
        typeToUnmarshall = getTypeDepuisNom(attributes.getValue("type"));
        if(isFirst) 
            checkType(typeToUnmarshall);
    }else{
        typeToUnmarshall = getType(nomAttribut);
    }
    return typeToUnmarshall;
}
XmlUnmarshaller.java 文件源码 项目:serialisation 阅读 24 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
private <T> void checkType(Class<T> typeToUnmarshall) throws InvalidTargetObjectTypeException {
    try {
        U test = (U) createInstance(typeToUnmarshall);
        test.getClass();
    } catch (Exception e) {
        LOGGER.error("le type attendu n'est pas celui du XML ou n'est pas instanciable", e);
        throw new InvalidTargetObjectTypeException(e, "not instanciable from " + typeToUnmarshall.getName());
    }
}
XmlUnmarshaller.java 文件源码 项目:serialisation 阅读 29 收藏 0 点赞 0 评论 0
protected void startElement(String qName, Attributes attributes) throws ClassNotFoundException, NotImplementedSerializeException, InvalidTargetObjectTypeException, InstanciationException, EntityManagerImplementationException{
    setCache(attributes);
    Class<?> type = getType(attributes, qName);
    isFirst = false;
    if(type != null){
        ActionXml<?> action = (ActionXml<?>) getAction(type);
        setNom(action, qName);
        setFieldInformation(action);
        setId(attributes, action);
        pileAction.push(action);
    }
}
SpringModelMBean.java 文件源码 项目:class-guard 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
SpringManagementMBeanAssembler.java 文件源码 项目:Camel 阅读 20 收藏 0 点赞 0 评论 0
public ModelMBean assemble(MBeanServer mBeanServer, Object obj, ObjectName name) throws JMException {
    ModelMBeanInfo mbi = null;

    // prefer to use the managed instance if it has been annotated with Spring JMX annotations
    if (obj instanceof ManagedInstance) {
        Object custom = ((ManagedInstance) obj).getInstance();
        if (custom != null && ObjectHelper.hasAnnotation(custom.getClass().getAnnotations(), ManagedResource.class)) {
            LOG.trace("Assembling MBeanInfo for: {} from custom @ManagedResource object: {}", name, custom);
            // get the mbean info from the custom managed object
            mbi = springAssembler.getMBeanInfo(custom, name.toString());
            // and let the custom object be registered in JMX
            obj = custom;
        }
    }

    if (mbi == null) {
        if (ObjectHelper.hasAnnotation(obj.getClass().getAnnotations(), ManagedResource.class)) {
            // the object has a Spring ManagedResource annotations so assemble the MBeanInfo
            LOG.trace("Assembling MBeanInfo for: {} from @ManagedResource object: {}", name, obj);
            mbi = springAssembler.getMBeanInfo(obj, name.toString());
        } else {
            // fallback and let the default mbean assembler handle this instead
            return super.assemble(mBeanServer, obj, name);
        }
    }

    LOG.trace("Assembled MBeanInfo {}", mbi);

    RequiredModelMBean mbean = (RequiredModelMBean) mBeanServer.instantiate(RequiredModelMBean.class.getName());
    mbean.setModelMBeanInfo(mbi);

    try {
        mbean.setManagedResource(obj, "ObjectReference");
    } catch (InvalidTargetObjectTypeException e) {
        throw new JMException(e.getMessage());
    }

    // Allows the managed object to send notifications
    if (obj instanceof NotificationSenderAware) {
        ((NotificationSenderAware)obj).setNotificationSender(new NotificationSenderAdapter(mbean));
    }

    return mbean;
}
JmxBuilderModelMBean.java 文件源码 项目:groovy 阅读 23 收藏 0 点赞 0 评论 0
public JmxBuilderModelMBean(Object objectRef) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException {
    super.setManagedResource(objectRef, "ObjectReference");
}
TestModelMBean.java 文件源码 项目:wildfly-core 阅读 25 收藏 0 点赞 0 评论 0
@Override
public void setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException,
        InstanceNotFoundException, InvalidTargetObjectTypeException {
}
BaseModelMBean.java 文件源码 项目:tomcat7 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
BaseModelMBean.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
BaseModelMBean.java 文件源码 项目:lazycat 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute all
 * methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException
 *                if the managed resource object cannot be found
 * @exception InvalidTargetObjectTypeException
 *                if the managed resource object is of the wrong type
 * @exception MBeanException
 *                if the initializer of the object throws an exception
 * @exception RuntimeOperationsException
 *                if the managed resource or the resource type is
 *                <code>null</code> or invalid
 */
public Object getManagedResource() throws InstanceNotFoundException, InvalidTargetObjectTypeException,
        MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException(new IllegalArgumentException("Managed resource is null"),
                "Managed resource is null");

    return resource;

}
BaseModelMBean.java 文件源码 项目:class-guard 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
BaseModelMBean.java 文件源码 项目:apache-tomcat-7.0.57 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
BaseModelMBean.java 文件源码 项目:apache-tomcat-7.0.57 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
BaseModelMBean.java 文件源码 项目:WBSAirback 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}


问题


面经


文章

微信
公众号

扫码关注公众号