Refine search
private static void handleThrowable(Throwable t, StatefulSessionComponentInstance statefulSessionComponentInstance) { ROOT_LOGGER.discardingStatefulComponent(statefulSessionComponentInstance, t); try { // discard the SFSB instance statefulSessionComponentInstance.discard(); } finally { // release the lock associated with the SFSB instance releaseLock(statefulSessionComponentInstance); } // throw back an appropriate exception if (t instanceof RuntimeException) throw (RuntimeException) t; if (t instanceof Error) throw (Error) t; throw (EJBException) new EJBException().initCause(t); } }
private Response causeToResponse(EJBException exception) { final Exception cause = exception.getCausedByException(); if (cause != null) { final ExceptionMapper mapper = mappers.get().findMapping(cause); if (mapper != null && mapper != this) { return mapper.toResponse(cause); } else if (cause instanceof WebApplicationException) { return ((WebApplicationException) cause).getResponse(); } } return null; } }
@Override public final EJBException unexpectedError(final Throwable cause) { final EJBException result = new EJBException(String.format(getLoggingLocale(), unexpectedError$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String transactionNotComplete1 = "WFLYEJB0443: EJB 3.1 FR 13.3.3: BMT bean %s should complete transaction before returning.";
@Override public final EJBException timerServiceWithIdNotRegistered(final String timedObjectId) { final EJBException result = new EJBException(String.format(getLoggingLocale(), timerServiceWithIdNotRegistered$str(), timedObjectId)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String timerHandleIsNotActive = "WFLYEJB0339: Timer for handle: %s is not active";
public EJBHome returnEJBHome() throws javax.ejb.EJBException { EJBHome data = null; try { final InitialContext ctx = new InitialContext(); data = (EJBHome) ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); } catch (final Exception e) { e.printStackTrace(); throw new javax.ejb.EJBException(e); } return data; }
public void ejbCreate() throws javax.ejb.CreateException { try { jndiContext = new InitialContext(); } catch (Exception e) { throw new EJBException(e.getMessage()); } }
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 void registerSynchronization(Synchronization synchronization) { try { final Transaction tx = this.getTransaction(); // register for lifecycle events of transaction tx.registerSynchronization(synchronization); } catch (RollbackException e) { throw new EJBException(e); } catch (SystemException e) { throw new EJBException(e); } }
"Unexpected Error", remoteTxRollback.detail); cause = new EJBException(msg); "Unexpected Throwable", remoteTxRollback.detail); cause = new EJBException(msg); (((EJBException) cause).getCausedByException() != null)) cause = ((EJBException) cause).getCausedByException(); if (ejbException.getCausedByException() != null) ejbException.getCausedByException()); return new EJBException("UnmarshalException", runtimeException); return new EJBException("RuntimeException", runtimeException); return new EJBException(msg); return new EJBException((RemoteException)e); if (isLocal) return new EJBException(msg);
/** * 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(); }
throw new CommandException("Command " + aCommand.toString() + " failed: " + ejbe.getMessage(), ejbe.getCausedByException(), aCommand);
public EJBHome returnEJBHome() throws javax.ejb.EJBException{ EJBHome data = null; try{ InitialContext ctx = new InitialContext(); data = (EJBHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home"); } catch (Exception e){ e.printStackTrace(); throw new javax.ejb.EJBException(e); } return data; }
@Override public final EJBException acquireSemaphoreInterrupted() { final EJBException result = new EJBException(String.format(getLoggingLocale(), acquireSemaphoreInterrupted$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String isDeprecatedIllegalState = "WFLYEJB0380: %s is deprecated";
/** * {@inheritDoc} */ @Override public void cancel() throws IllegalStateException, EJBException { try { timerService.cancelTimer(this); } catch (InterruptedException e) { throw new EJBException(e); } }
public Exception getCausedByException() { Throwable cause = getCause(); if (cause instanceof Exception) { return (Exception) cause; } return null; }
alr.setInfo( alr.getInfo() + "// " + ejbx.getMessage()); if ( ejbx.getCausedByException() instanceof IllegalArgumentException ) { return error(Status.BAD_REQUEST, "Bad request: can't save user. " + ejbx.getCausedByException().getMessage()); } else { logger.log(Level.WARNING, "Error saving user: ", ejbx); return error(Status.INTERNAL_SERVER_ERROR, "Can't save user: " + ejbx.getMessage());
public EJBHome returnEJBHome() { EJBHome data = null; try { InitialContext ctx = new InitialContext(); data = (EJBHome) ctx.lookup("java:comp/env/cmp/rmi-iiop/home"); } catch (Exception e) { e.printStackTrace(); throw new EJBException(e); } return data; }
/** * Create EJBException using the exception that is passed in */ protected EJBException createEJBException( Exception ex ) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); return ejbEx; }
@Override public final EJBException cannotCallGetPKOnSessionBean() { final EJBException result = new EJBException(String.format(getLoggingLocale(), cannotCallGetPKOnSessionBean$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String ejb2xViewNotApplicableForSingletonBeans = "WFLYEJB0076: Singleton beans cannot have EJB 2.x views";
public void handleException(IOException cause) { receiverInvocationContext.requestFailed(new EJBException(cause), getRetryExecutor()); }