java类javax.management.ReflectionException的实例源码

JMXProxyServlet.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr,
                                  String attributeName,
                                  String value)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, attributeName);
    Object valueObj=registry.convertValue(type, value );
    mBeanServer.setAttribute( oname, new Attribute(attributeName, valueObj));
}
MBeanServerAccessController.java 文件源码 项目:OpenJSharp 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
public MBeanInfo getMBeanInfo(ObjectName name)
    throws
    InstanceNotFoundException,
    IntrospectionException,
    ReflectionException {
    checkRead();
    return getMBeanServer().getMBeanInfo(name);
}
MBeanServerAccessController.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkCreate(className)</code>, then forward this method to the
 * wrapped object.
 */
public Object instantiate(String className,
                          Object params[],
                          String signature[])
    throws ReflectionException, MBeanException {
    checkCreate(className);
    return getMBeanServer().instantiate(className, params, signature);
}
RMIConnectorLogAttributesTest.java 文件源码 项目:jdk8u-jdk 阅读 42 收藏 0 点赞 0 评论 0
private JMXConnector connectToServer(JMXConnectorServer server) throws IOException, MalformedObjectNameException, NullPointerException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, ReflectionException, MBeanException {
    JMXServiceURL url = server.getAddress();
    Map<String, Object> env = new HashMap<String, Object>();
    JMXConnector connector = JMXConnectorFactory.connect(url, env);

    System.out.println("DEBUG: Client connected to RMI at: " + url);

    return connector;
}
JwalaAuthenticationProvider.java 文件源码 项目:jwala 阅读 26 收藏 0 点赞 0 评论 0
/**
 *
 * @param authentication
 * @return Authentication
 */
@Override
public Authentication authenticate(Authentication authentication) {
    Realm realm;
    Set<GrantedAuthority> auths = new HashSet<>();
    try {
        realm = getTomcatContextRealm();
        if(realm instanceof NullRealm) {
            throw new ProviderNotFoundException("No Realms configured for Jwala to Authenticate");
        }
        Principal principal = realm.authenticate(authentication.getName(),
                authentication.getCredentials().toString());
        if (principal == null) {
            throw new BadCredentialsException("Username or Password not found.");
        } else {
            if (principal instanceof GenericPrincipal) {
                String[] roles = ((GenericPrincipal) principal).getRoles();
                for (String role : roles) {
                    auths.add(new SimpleGrantedAuthority(role));
                }
            }
            GrantedAuthoritiesMapperImpl grantedAuthoritiesMapper = new GrantedAuthoritiesMapperImpl();
            return new UsernamePasswordAuthenticationToken(authentication.getName(),
                    authentication.getCredentials(), grantedAuthoritiesMapper.mapAuthorities(auths));
        }
    } catch (AttributeNotFoundException | InstanceNotFoundException | MBeanException | ReflectionException e) {
        LOGGER.error("Error getting realms", e);
        throw new ProviderNotFoundException(e.getMessage());
    }
}
MBeanServerAccessController.java 文件源码 项目:OpenJSharp 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkCreate(className)</code>, then forward this method to the
 * wrapped object.
 */
public ObjectInstance createMBean(String className,
                                  ObjectName name,
                                  ObjectName loaderName,
                                  Object params[],
                                  String signature[])
    throws
    ReflectionException,
    InstanceAlreadyExistsException,
    MBeanRegistrationException,
    MBeanException,
    NotCompliantMBeanException,
    InstanceNotFoundException {
    checkCreate(className);
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
        Object object = getMBeanServer().instantiate(className,
                                                     loaderName,
                                                     params,
                                                     signature);
        checkClassLoader(object);
        return getMBeanServer().registerMBean(object, name);
    } else {
        return getMBeanServer().createMBean(className, name, loaderName,
                                            params, signature);
    }
}
MBeanServerAccessController.java 文件源码 项目:OpenJSharp 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, data);
}
JwalaAuthenticationProvider.java 文件源码 项目:jwala 阅读 23 收藏 0 点赞 0 评论 0
/**
 *
 * @return Tomcat Realms
 * @throws AttributeNotFoundException
 * @throws InstanceNotFoundException
 * @throws MBeanException
 * @throws ReflectionException
 */
public Realm getTomcatContextRealm() throws AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException {
    try {
        ObjectName name = new ObjectName("Catalina", "type", "Engine");
        Engine engine = (Engine) JwalaAuthenticationProvider.getmBeanServer().getAttribute(name, "managedResource");
        return engine.getRealm();
    } catch (MalformedObjectNameException ex) {
        LOGGER.error("Invalid Realm", ex);
    }
    return null;
}
DefaultMBeanServerInterceptor.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
public Object instantiate(String className) throws ReflectionException,
                                                   MBeanException {
    throw new UnsupportedOperationException("Not supported yet.");
}
FolderMBean.java 文件源码 项目:Pogamut3 阅读 24 收藏 0 点赞 0 评论 0
@Override
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException {
    // there are no methods to be invoked
    return null;
}


问题


面经


文章

微信
公众号

扫码关注公众号