Skip to content

ctx.methodParams null cause NullPointerException #8

@andreatera

Description

@andreatera

In our EJB example we added the Interceptors annotation as follow:

@Stateless
@Interceptors({ OpenTracingInterceptor.class})
public class PartyServiceImpl implements PartyService {

and then among the code we have the following method:

@Override
public Optional<Person> getOriginalPersonOfCurrentUser() {
	Optional<PersonEntity> entity = partyRepo.getOriginalPersonOfCurrentUser();
	return abstractionOrEmpty(entity);
}

and during the execution of the code we get this exception:

A system exception occurred during an invocation on EJB PartyServiceImpl, method: public java.util.Optional ch.ergon.taifun.commonentities.party.impl.PartyServiceImpl.getPersonOfCurrentUser()
....
Caused by: java.lang.NullPointerException
	at io.opentracing.contrib.ejb.OpenTracingInterceptor.wrap(OpenTracingInterceptor.java:34)
	at sun.reflect.GeneratedMethodAccessor370.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:895)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:835)
	at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
	at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
	at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
	at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:895)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:835)
	at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
	at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

Debugging the issue the error occurred when it tries to getParameters() on the following code part:

for(int i = 0; i < ctx.getParameters().length; ++i) {
  Object parameter = ctx.getParameters()[i];
  if (parameter instanceof SpanContext) {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions