private void throwExceptionWithTarget(String m, MBeanException e) { if (!ignoreErrors) { throw new GroovyRuntimeException(m + e, e.getTargetException()); } } }
EjbLogger.ROOT_LOGGER.trace("Exception in EJBObject invocation", e); if (e instanceof MBeanException) { e = ((MBeanException) e).getTargetException();
@Test @DirtiesContext public void changeMessageHistoryPatterns() throws Exception { Set<ObjectInstance> mbeans = server.queryMBeans(null, null); boolean tested = false; for (ObjectInstance mbean : mbeans) { if (mbean.toString().contains("MessageHistoryConfigurer")) { ObjectName objectName = mbean.getObjectName(); try { server.setAttribute(objectName, new Attribute("ComponentNamePatternsString", "foo, bar")); fail("Exception expected"); } catch (MBeanException e) { assertThat(e.getTargetException(), instanceOf(IllegalStateException.class)); assertThat(e.getTargetException().getMessage(), containsString("cannot be changed")); } catch (Exception e) { throw e; } server.invoke(objectName, "stop", new Object[]{}, new String[]{}); server.setAttribute(objectName, new Attribute("ComponentNamePatternsString", "foo, bar")); assertEquals("bar,foo", server.getAttribute(objectName, "ComponentNamePatternsString")); tested = true; break; } } assertTrue(tested); }
return getErrorJSON(404,e, pJmxReq); } catch (MBeanException e) { return getErrorJSON(500,e.getTargetException(), pJmxReq); } catch (AttributeNotFoundException e) { return getErrorJSON(404,e, pJmxReq);
public Object handleMBeanException(ProxyContext ctx, MBeanException e, Method m, Object[] args) throws Exception { // assuming MBeanException only wraps mgmt interface "application" // exceptions therefore we can safely rethrow the target exception // as its declared in the mgmt interface throw e.getTargetException(); }
public Object handleMBeanException(ProxyContext ctx, MBeanException e, Method m, Object[] args) throws Exception { // assuming MBeanException only wraps mgmt interface "application" // exceptions therefore we can safely rethrow the target exception // as its declared in the mgmt interface throw e.getTargetException(); }
private Throwable unwrapException(Throwable pExp) { if (pExp instanceof MBeanException) { return ((MBeanException) pExp).getTargetException(); } return pExp; }
protected void handleInvocationException(Throwable th) throws Exception { if (th instanceof MBeanException) { throw ((MBeanException)th).getTargetException(); } if (th instanceof Exception) { throw (Exception)th; } if (th instanceof Error) { throw (Error)th; } throw new UndeclaredThrowableException(th); }
protected void handleInvocationException(Throwable th) throws Exception { if (th instanceof MBeanException) { throw ((MBeanException)th).getTargetException(); } if (th instanceof Exception) { throw (Exception)th; } if (th instanceof Error) { throw (Error)th; } throw new UndeclaredThrowableException(th); } }
protected void handleInvocationException(final Throwable t) throws Exception { if (t instanceof MBeanException) { throw ((MBeanException) t).getTargetException(); } if (t instanceof Exception) { if (t instanceof InvocationTargetException) { throw (Exception) t; } else { throw new InvocationTargetException(t); } } if (t instanceof Error) { throw (Error) t; } throw new UndeclaredThrowableException(t); }
@Override public void validateBean(ObjectName configBeanON) throws ValidationException { try { configMBeanServer.invoke(configBeanON, "validate", null, null); } catch (MBeanException e) { Exception targetException = e.getTargetException(); if (targetException instanceof ValidationException){ throw (ValidationException) targetException; } else { throw new RuntimeException(e); } } catch (JMException e) { throw new RuntimeException(e); } }
private void throwExceptionWithTarget(String m, MBeanException e) { if (!ignoreErrors) { throw new GroovyRuntimeException(m + e, e.getTargetException()); } } }
private void throwExceptionWithTarget(String m, MBeanException e) { if (!ignoreErrors) { throw new GroovyRuntimeException(m + e, e.getTargetException()); } } }
private void throwExceptionWithTarget(String m, MBeanException e) { if (!ignoreErrors) { throw new GroovyRuntimeException(m + e, e.getTargetException()); } } }
private void throwExceptionWithTarget(String m, MBeanException e) { if (!ignoreErrors) { throw new GroovyRuntimeException(m + e, e.getTargetException()); } } }
private void throwExceptionWithTarget(String m, MBeanException e) { if (!ignoreErrors) { throw new GroovyRuntimeException(m + e, e.getTargetException()); } } }
public void undeploy(URI uri, boolean force) throws CommunicationException, DeploymentManagementException { try { if (!isConnected()) { throw new IllegalStateException("Not connected"); } MBeanServerConnection conn = jmxc.getMBeanServerConnection(); ObjectName oName = new ObjectName(DOMAIN_MBEAN); conn.invoke(oName, "undeploy", new Object[]{uri, force}, new String[]{URI.class.getName(), Boolean.TYPE.getName()}); } catch (MBeanException e) { throw new DeploymentManagementException(e.getTargetException().getMessage(), e.getTargetException()); } catch (JMException e) { throw new CommunicationException(e); } catch (IOException e) { throw new CommunicationException(e); } }
/** * Create the MBeans that correspond to every existing node of our tree. */ protected void createMBeans() { try { MBeanFactory factory = new MBeanFactory(); createMBeans(factory); createMBeans(ServerFactory.getServer()); } catch (MBeanException t) { Exception e = t.getTargetException(); if (e == null) e = t; log.error("createMBeans: MBeanException", e); } catch (Throwable t) { log.error("createMBeans: Throwable", t); } }