Index: AbstractInstancePool.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstancePool.java,v retrieving revision 1.34 diff -u -r1.34 AbstractInstancePool.java --- AbstractInstancePool.java 10 Sep 2003 14:43:55 -0000 1.34 +++ AbstractInstancePool.java 19 Mar 2005 20:03:19 -0000 @@ -8,7 +8,6 @@ import java.rmi.RemoteException; import java.util.LinkedList; -import java.util.Iterator; import javax.ejb.EJBException; import org.jboss.ejb.Container; @@ -145,13 +144,19 @@ { return create(container.createBeanClassInstance()); } - catch (InstantiationException e) + catch (Exception e) { - throw new EJBException("Could not instantiate bean", e); - } - catch (IllegalAccessException e) - { - throw new EJBException("Could not instantiate bean", e); + // If we obtained a pool semaphore we need to release it. + if ( strictMaxSize != null ) + { + strictMaxSize.release(); + } + + if ( e instanceof InstantiationException || e instanceof IllegalAccessException ) + { + throw new EJBException("Could not instantiate bean", e); + } + throw e; } }