protected InjectionManager getInjectionManager(Container container) { // This is a bit brittle since we are relying on the internal knowledge of // what org.jboss.ejb3.deployers.EJBsDeployer uses as a name to attach the EJB metadata // component to the deployment unit. However, we don't have an alternate way to get hold // of the name. So for now, let's just use this String ejbComponentName = JBossEnterpriseBeanMetaData.class.getName() + "." + container.getEjbName(); // get the component DU for the EJB of this container from the parent (non-component) DU org.jboss.deployers.structure.spi.DeploymentUnit componentDU = this.jbossUnit.getComponent(ejbComponentName); if (componentDU == null) { // without the component DU, there's no way we can get hold of the correct InjectionManager. // That effectively makes the container unusable. Hence throw this exception throw new RuntimeException("Component Deployment Unit for bean: " + container.getEjbName() + " not found in unit: " + this.jbossUnit); } // get the InjectionManager return componentDU.getAttachment(InjectionManager.class); }
public UserTransactionPropertyInjector(BeanProperty property, InjectionContainer container) { super(property); if (container instanceof EJBContainer) { TransactionManagementType type = TxUtil.getTransactionManagementType(((EJBContainer) container).getAdvisor()); if (type != TransactionManagementType.BEAN) throw new IllegalStateException("Container " + ((Container) container).getEjbName() + ": it is illegal to inject UserTransaction into a CMT bean"); } }
return container.getEjbName(); return beanContext.getContainer().getEjbName();
return container.getEjbName(); return beanContext.getContainer().getEjbName();
protected Barrier getSwitchBoardBarrier(Container container) { if (this.isSharedENC(this.jbossUnit)) { return this.jbossUnit.getAttachment(Barrier.class); } // This is a bit brittle since we are relying on the internal knowledge of // what org.jboss.ejb3.deployers.EJBsDeployer uses as a name to attach the EJB metadata // component to the deployment unit. However, we don't have an alternate way to get hold // of the name. So for now, let's just use this String ejbComponentName = JBossEnterpriseBeanMetaData.class.getName() + "." + container.getEjbName(); // get the component DU for the EJB of this container from the parent (non-component) DU org.jboss.deployers.structure.spi.DeploymentUnit componentDU = this.jbossUnit.getComponent(ejbComponentName); if (componentDU == null) { // without the component DU, there's no way we can get hold of the switchboard Barrier. // That effectively makes the container unusable. Hence throw this exception throw new RuntimeException("Component Deployment Unit for bean: " + container.getEjbName() + " not found in unit: " + this.jbossUnit); } return componentDU.getAttachment(Barrier.class); }
String ejbName = con.getEjbName();
localContainers.put(container.getEjbName(), container); "Error creating ejb container " + con.getEjbName() + ": " + t.getMessage(), t);
String message = "Exception while processing container metadata for EJB: " + con.getEjbName() + " in unit: " + this.getDeploymentUnit().getShortName();
String message = "Exception while registering EJB container for EJB: " + con.getEjbName() + " in unit: " + this.getDeploymentUnit().getShortName();
throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName() + " and there are no valid business interfaces"); throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName() + " with more than one default interface " + businessInterfaces);
throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName() + " and there are no valid business interfaces"); throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName() + " with more than one default interface " + businessInterfacesImplementedByBeanClass); + remoteInterface.toString() + "\" for EJB \"" + container.getEjbName() + "\" per EJB3 Spec 4.6.6, Bullet 5.4 [" + ErrorCodes.ERROR_CODE_EJBTHREE751 + "]");
if(endpoints != null) String ejbKey = "ejb/" + jbossUnit.getRelativePath() + "#" + container.getEjbName(); cdmd = endpoints.get(ejbKey); throw new RuntimeException("No SwitchBoard Barrier found for bean: " + container.getEjbName() + " in unit: " + this.jbossUnit + " (or its component deployment unit)"); throw new RuntimeException("No InjectionManager found for bean: " + container.getEjbName() + " in unit: " + this.jbossUnit + " (or its component deployment unit)");
protected void deployElement(Ejb3HandlerFactory factory, ClassFile cf, InitialContext ctx) throws Exception { Ejb3Handler handler = factory.createHandler(cf); handler.setCtxProperties(unit.getJndiProperties()); if (handler.isEjb() || handler.isJBossBeanType()) { List<Container> containers = handler.getContainers(cf, this); for (Container con : containers) { // EJBContainer has finished with all metadata initialization from XML files and such. // this is really a hook to do some processing after XML has been set up and before // and processing of dependencies and such. try { ((EJBContainer) con).instantiated(); this.ejbContainers.put(con.getObjectName(), con); Ejb3Registry.register(con); } catch (Throwable t) { throw new DeploymentException( "Error creating ejb container " + con.getEjbName() + ": " + t.getMessage(), t); } } } }