Hello:
I'm deploying a web application into Payara Server 4.1.1.162 (build 116)
When I instance a bean by using BeanManager , for example,
beanManager.getReference(bean, bean.getBeanClass(), beanManager.createCreationalContext(bean))
all works fine
This bean has got an @Inject annotation and this is resolved correctly and the dependence is injected.
But this injected bean has bean a method annotated with @SimpleAsync
@SimpleAsync
public void dispatch(ServiceCallInfo serviceCallInfo){
logger.info("Process service call:{}",serviceCallInfo.getIdServ());
}
, a custom annotation to intercept the call
@SimpleAsync
@Interceptor
public class SimpleAsyncInterceptor implements Serializable{
@AroundInvoke
public Object callAsync(final InvocationContext ctx) throws Exception {
return ctx.proceed();
}
}
In this case, I'm getting a NPE
java.lang.NullPointerException: null
at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:114) ~[weld-integration.jar:na]
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46) ~[weld-osgi-bundle-glassfish4.jar:2.3.2.Final]
at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72) ~[na:na]
at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121) ~[na:na]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159) ~[weld-osgi-bundle-glassfish4.jar:2.3.2.Final]
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70) ~[na:na]
at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101) ~[weld-osgi-bundle-glassfish4.jar:2.3.2.Final]
If I don't use BeanManager to instance a bean ( I mean, I use @Inject annotation ), the interceptor works fine
May I need to use BeanManager in another way ?
Thanks and regards