public Exception getCausedByException() { Throwable cause = getCause(); if (cause instanceof Exception) { return (Exception) cause; } return null; }
/** * Obtain the exception that caused the EJBException to be thrown. * It is recommended that the inherited Throwable.getCause() method * be used to retrieve the cause instead of this method. */ public Exception getCausedByException() { return (Exception) getCause(); }
public Exception getCausedByException() { Throwable cause = getCause(); if (cause instanceof Exception) { return (Exception) cause; } return null; }
/** * Obtain the exception that caused the EJBException to be thrown. * It is recommended that the inherited Throwable.getCause() method * be used to retrieve the cause instead of this method. */ public Exception getCausedByException() { return (Exception) getCause(); }
public Exception getCausedByException() { Throwable cause = getCause(); if (cause instanceof Exception) { return (Exception) cause; } return null; }
/** * Obtain the exception that caused the EJBException to be thrown. * It is recommended that the inherited Throwable.getCause() method * be used to retrieve the cause instead of this method. */ public Exception getCausedByException() { return (Exception) getCause(); }
try { Field field = fieldService.findByTitle(title); } catch (EJBException e) { if (e.getCause() instanceof NonUniqueResultException) { LogManager.logInfo("Oh no!"); } return; }
/** * Obtain the exception that caused the EJBException to be thrown. * It is recommended that the inherited Throwable.getCause() method * be used to retrieve the cause instead of this method. */ public Exception getCausedByException() { return (Exception) getCause(); }
/** * Obtain the exception that caused the EJBException to be thrown. * It is recommended that the inherited Throwable.getCause() method * be used to retrieve the cause instead of this method. */ public Exception getCausedByException() { return (Exception) getCause(); }
try { getEntityRepository().update("Some Persistence Obj"); } catch (EJBException e) { if (e.getCause() instanceof OptimisticLockException) { // code goes here } }
public class BeamBusinessDelegate implements Bean { // your stateless session bean goes here private Bean bean; public BeamImpl() { InitialContext i = new InitialContext(); bean = (Bean) i.lookup(<GLOBAL_JNDI_ADDRESS_OR_RELATIVE_ENVIRONMENT_NAMING_CONTEXT_ADDRESS>); } public void doSomething() { try { bean.doSomething() } catch(EJBException e) { throw e.getCause(); } } }
private static <T> T getBeanManually(Class<T> targetClass, boolean optional) { T result = null; if (OPTIONAL_BEAN.containsKey(targetClass)) { result = (T) OPTIONAL_BEAN.get(targetClass); } else { if (OPTIONAL_BEAN_INFO.containsKey(targetClass)) { Method method = OPTIONAL_BEAN_INFO.get(targetClass); Object bean = BeanProvider.getContextualReference(method.getDeclaringClass()); try { result = (T) method.invoke(bean); OPTIONAL_BEAN.put(targetClass, result); } catch (IllegalAccessException e) { LOGGER.error("Exception occured during invocation of producer method", e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof EJBException) { EJBException ejbException = (EJBException) e.getTargetException(); if (ejbException.getCause() instanceof OctopusUnauthorizedException) { throw (OctopusUnauthorizedException) ejbException.getCause(); } } } } } if (result == null && !optional) { throw new IllegalArgumentException("No bean found for " + targetClass.getName()); } return result; }
cause = EJBException.class.cast(cause).getCause();
} catch (EJBException ex) { logger.info("caught " + ex); Throwable cause = ex.getCause(); while (cause.getCause() != null) { logger.info("caused by... " + cause);
public String confirmAndCreateAccount() { ShibAuthenticationProvider shibAuthProvider = new ShibAuthenticationProvider(); String lookupStringPerAuthProvider = userPersistentId; AuthenticatedUser au = null; try { au = authSvc.createAuthenticatedUser( new UserRecordIdentifier(shibAuthProvider.getId(), lookupStringPerAuthProvider), internalUserIdentifer, displayInfo, true); } catch (EJBException ex) { /** * @todo Show the ConstraintViolationException, if any. */ logger.info("Couldn't create user " + userPersistentId + " due to exception: " + ex.getCause()); } if (au != null) { logger.fine("created user " + au.getIdentifier()); logInUserAndSetShibAttributes(au); /** * @todo Move this to * AuthenticationServiceBean.createAuthenticatedUser */ userNotificationService.sendNotification(au, new Timestamp(new Date().getTime()), UserNotification.Type.CREATEACC, null); return "/dataverseuser.xhtml?selectTab=accountInfo&faces-redirect=true"; } else { JsfHelper.addErrorMessage(BundleUtil.getStringFromBundle("shib.createUser.fail")); } return getPrettyFacesHomePageString(true); }
throw e; } catch (EJBException e) { if (e.getCause() instanceof NoResultsException) { close(queryId);