// get the bean interface type
String beanInterface = this.getBeanInterfaceType(unit.getClassLoader(), ejbLocalRef);
// create a EJB reference
EJBReference ejbReference = new EJBReference(unit, ejbLocalRef.getLink(), beanInterface, ejbLocalRef.getMappedName(), ejbLocalRef.getLookupName());
// resolve
EJBBinderResolutionResult result = this.ejbBinderResolver.resolveEJBBinder(unit, ejbReference);
// throw an error, if we couldn't resolve the reference
if (result == null)
{
throw new RuntimeException("Could not resolve ejb-local-ref reference: " + ejbReference + " for environment entry: " + ejbLocalRef.getName() + " in unit " + unit);
}
// The EJBBinder might not be available (for example, EJB2.x Entity beans). In such
// cases, just create a LinkRefResource for the resolved jndi name
if (result.getEJBBinderName() == null)
{
return new LinkRefResource(result.getJNDIName(), null, true);
}
// get the invocation dependencies
Collection<?> invocationDependencies = this.getInvocationDependencies(result);
// return the resource
return new EJBRefResource(result.getJNDIName(), result.getEJBBinderName(), invocationDependencies);
}