List of usage examples for javax.ejb Handle getEJBObject
public EJBObject getEJBObject() throws RemoteException;
From source file:org.openamf.invoker.EJBServiceInvoker.java
public Object invokeService() throws ServiceInvocationException { Object serviceResult = null;//w w w . j a v a 2 s . c o m try { Object ejb = null; if (persistService) { log.debug("Trying to get Handle from persistentObject"); Handle handle = (Handle) getPersistentServiceObject(); if (handle != null) { log.debug("Got Handle from persistentObject"); ejb = handle.getEJBObject(); } } if (ejb == null) { if (home == null) { log.warn("Home is NULL - unable to find EJB " + request.getServiceName()); return null; } Method ejbCreateMethod = home.getClass().getMethod("create", new Class[0]); log.info("Calling Create Method: " + request.getServiceName()); ejb = ejbCreateMethod.invoke(home, new Object[0]); } serviceResult = invokeServiceMethod(ejb, ejb.getClass(), request.getServiceMethodName(), request.getParameters()); if (persistService) { if (ejb instanceof EJBObject) { log.debug("setting persistentObject = Handle"); setPersistentServiceObject(((EJBObject) ejb).getHandle()); } } } catch (InvocationTargetException e) { //use the cause since the exception is thrown when //the service method throws an exception throw new ServiceInvocationException(request, e.getTargetException()); } catch (Exception e) { throw new ServiceInvocationException(request, e); } return serviceResult; }