List of usage examples for javax.management ReflectionException getCause
public Throwable getCause()
From source file:net.nicoll.boot.daemon.SpringApplicationAdminClient.java
/** * Stop the application managed by this instance. * @throws JmxException if the JMX service could not be contacted * @throws IOException if an I/O error occurs * @throws InstanceNotFoundException if the lifecycle mbean cannot be found *///from w w w . j av a 2 s. c om public void stop() throws IOException, InstanceNotFoundException { try { this.connection.invoke(this.objectName, "shutdown", null, null); } catch (ReflectionException ex) { throw new JmxException("Shutdown failed", ex.getCause()); } catch (MBeanException ex) { throw new JmxException("Could not invoke shutdown operation", ex); } }
From source file:org.apache.hadoop.hdfs.tools.JMXGet.java
/** * get single value by key// w w w . j a v a2 s .com */ public String getValue(String key) throws Exception { Object val = null; for (ObjectName oname : hadoopObjectNames) { try { val = mbsc.getAttribute(oname, key); } catch (AttributeNotFoundException anfe) { /* just go to the next */ continue; } catch (ReflectionException re) { if (re.getCause() instanceof NoSuchMethodException) { continue; } } err("Info: key = " + key + "; val = " + (val == null ? "null" : val.getClass()) + ":" + val); break; } return (val == null) ? "" : val.toString(); }
From source file:org.mc4j.ems.impl.jmx.connection.bean.attribute.DAttribute.java
/** * Updates the local value of this mbean from the server * <p/>// w w w . j a va 2 s . c o m * TODO we should not update to null on failure, but retain the last known */ public synchronized Object refresh() { loaded = true; Object newValue = null; try { MBeanServer server = bean.getConnectionProvider().getMBeanServer(); newValue = server.getAttribute(bean.getObjectName(), getName()); } catch (ReflectionException e) { supportedType = false; registerFailure(e); throw new EmsException("Could not load attribute value " + e.toString(), e); } catch (InstanceNotFoundException e) { registerFailure(e); throw new EmsException( "Could not load attribute value, bean instance not found " + bean.getObjectName().toString(), e); } catch (MBeanException e) { registerFailure(e); Throwable t = e.getTargetException(); if (t != null) throw new EmsException( "Could not load attribute value, target bean threw exception " + t.getLocalizedMessage(), t); else throw new EmsException("Could not load attribute value " + e.getLocalizedMessage(), e); } catch (AttributeNotFoundException e) { registerFailure(e); throw new EmsException("Could not load attribute value, attribute [" + getName() + "] not found", e); } catch (UndeclaredThrowableException e) { if (e.getUndeclaredThrowable() instanceof InvocationTargetException) { Throwable t = e.getCause(); if (t.getCause() instanceof NotSerializableException) { supportedType = false; registerFailure(t.getCause()); throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(), t.getCause()); } else throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(), t); } throw new EmsException("Could not load attribute value " + e.getLocalizedMessage(), e); } catch (RuntimeException re) { supportedType = false; // TODO GH: Figure this one out // Getting weblogic.management.NoAccessRuntimeException on wl9 registerFailure(re); throw new EmsException("Could not load attribute value " + re.getLocalizedMessage(), re); } catch (NoClassDefFoundError ncdfe) { supportedType = false; registerFailure(ncdfe); throw new EmsException("Could not load attribute value " + ncdfe.getLocalizedMessage(), ncdfe); } catch (Throwable t) { throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(), t); } alterValue(newValue); return newValue; }