public <T> void aroundInject(InjectionContext<T> injectionContext) {
try {
ServiceLocator serviceLocator = Globals.getDefaultHabitat();
ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);
JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();
ManagedBeanDescriptor mbDesc = null;
JndiNameEnvironment injectionEnv = (JndiNameEnvironment) bundleContext;
AnnotatedType annotatedType = injectionContext.getAnnotatedType();
Class targetClass = annotatedType.getJavaClass();
String targetClassName = targetClass.getName();
Object target = injectionContext.getTarget();
if( componentEnv == null ) {
//throw new IllegalStateException("No valid EE environment for injection of " + targetClassName);
System.err.println("No valid EE environment for injection of " + targetClassName);
injectionContext.proceed();
return;
}
// Perform EE-style injection on the target. Skip PostConstruct since
// in this case 299 impl is responsible for calling it.
if( componentEnv instanceof EjbDescriptor ) {
EjbDescriptor ejbDesc = (EjbDescriptor) componentEnv;
if( containerServices.isEjbManagedObject(ejbDesc, targetClass)) {
injectionEnv = componentEnv;
} else {
if( bundleContext instanceof EjbBundleDescriptor ) {