Package javax.ejb

Examples of javax.ejb.NoSuchEJBException


            if (e instanceof java.lang.reflect.InvocationTargetException) {
                e = ((java.lang.reflect.InvocationTargetException) e).getTargetException();
            }
            String t = "The bean instance " + beanContext.getDeploymentID() + " threw a system exception:" + e;
            logger.error(t, e);
            throw new ApplicationException(new NoSuchEJBException("Singleton failed to initialize").initCause(e));
        }
    }
View Full Code Here


            if (interfaceType.isComponent() && interfaceType.isLocal()){
                throw new NoSuchObjectLocalException("reference is invalid");
            } else if (interfaceType.isComponent() || java.rmi.Remote.class.isAssignableFrom(method.getDeclaringClass())) {
                throw new NoSuchObjectException("reference is invalid");
            } else {
                throw new NoSuchEJBException("reference is invalid");
            }
        }
        getDeploymentInfo(); // will throw an exception if app has been undeployed.
    }
View Full Code Here

                return e;
            }
        }
        if (e instanceof NoSuchObjectException) {
            if (!rmiRemote && interfaceType.isBusiness()) {
                return new NoSuchEJBException(e.getMessage()).initCause(getCause(e));
            } else if (interfaceType.isLocal()) {
                return new NoSuchObjectLocalException(e.getMessage()).initCause(getCause(e));
            } else {
                return e;
            }
View Full Code Here

    @Override
    @SuppressWarnings({"unchecked"})
    public synchronized <S> S getBusinessObject(Class<S> businessInterfaceType) {
        if (isRemoved()) {
            throw new NoSuchEJBException("Bean has been removed");
        }
        if (viewServices.containsKey(businessInterfaceType.getName())) {
            final ServiceController<?> serviceController = CurrentServiceContainer.getServiceContainer().getRequiredService(viewServices.get(businessInterfaceType.getName()));
            final ComponentView view = (ComponentView) serviceController.getValue();
            try {
View Full Code Here

                      if(entry == null)
                      {
                         entry = pm.activateSession(key);
                         if (entry == null)
                         {
                            throw new NoSuchEJBException("Could not find stateful bean: " + key);
                         }
                         --passivatedCount;

                         // We cache the entry even if we will throw an exception below
                         // as we may still need it for its children and XPC references
                         if (log.isTraceEnabled())
                         {
                            log.trace("Caching activated context " + entry.getId() + " of type " + entry.getClass());
                         }

                         synchronized (cacheMap)
                         {
                            cacheMap.put(key, entry);
                            // remove the activation, worst case a new task will be constructed and
                            // the check whether someone has already activated it will prevent actual activation.
                            activations.remove(key);
                         }
                      }
                      return entry;
                  }
               });
               activations.put(key, activation);
               executeActivation = true;
            }
            else
               executeActivation = false;
         }
         if (executeActivation)
            activation.run();
         try {
            entry = activation.get();
         }
         catch (InterruptedException e)
         {
            throw new EJBException(e);
         }
         catch (ExecutionException e)
         {
            if (e.getCause() instanceof RuntimeException)
               throw (RuntimeException) e.getCause();
            throw (EJBException) new EJBException().initCause(e.getCause());
         }
      }
     
      // Now we know entry isn't null
      if (markInUse)
      {
         if (entry.isRemoved())
         {
            throw new NoSuchEJBException("Could not find stateful bean: " + key +
                                         " (bean was marked as removed");
         }     
     
         entry.setInUse(true);
         entry.lastUsed = System.currentTimeMillis();
View Full Code Here

      // object from the key. Instead, use the get() method
      // which will even activate any sessions which have been
      // passivated (see https://jira.jboss.org/jira/browse/EJBTHREE-2030)
      StatefulBeanContext ctx = this.get(key);
      if(ctx == null)
         throw new NoSuchEJBException("Could not find Stateful bean: " + key);
      if (!ctx.isRemoved())
         container.destroy(ctx);
     
      ++removeCount;
     
View Full Code Here

        Assert.assertFalse(ClusteredCacheBean.preDestroy);
        Assert.assertFalse(ClusteredCacheBean.prePassivate);
        sfsb1.increment();
        Assert.assertTrue(ClusteredCacheBean.prePassivate);
        Thread.sleep(1500);
        NoSuchEJBException exception = null;
        try {
            sfsb1.increment();
        } catch (NoSuchEJBException e) {
            exception = e;
        }
View Full Code Here

        Assert.assertFalse(ClusteredBean.preDestroy);
        Assert.assertFalse(ClusteredBean.prePassivate);
        sfsb1.increment();
        Assert.assertTrue(ClusteredBean.prePassivate);
        Thread.sleep(1500);
        NoSuchEJBException exception = null;
        try {
            sfsb1.increment();
        } catch (NoSuchEJBException e) {
            exception = e;
        }
View Full Code Here

        NestedBean.preDestroy = false;
        NestedBean sfsb1 = lookup(iniCtx, NestedBean.class);
        Assert.assertFalse(NestedBean.preDestroy);
        sfsb1.increment();
        Thread.sleep(1500);
        NoSuchEJBException exception = null;
        try {
            sfsb1.increment();
        } catch (NoSuchEJBException e) {
            exception = e;
        }
View Full Code Here

    }

    @Override
    public void ejbLoad() throws EJBException, RemoteException {
        if(!DataStore.DATA.containsKey(entityContext.getPrimaryKey())) {
            throw new NoSuchEJBException("no EJB with id" + entityContext.getPrimaryKey());
        }
        this.myField = DataStore.DATA.get(entityContext.getPrimaryKey());
    }
View Full Code Here

TOP

Related Classes of javax.ejb.NoSuchEJBException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.