Some good news. I’ve commented out the @Interceptors line in each session bean and now they can be called just fine! I’ll dig a bit deeper into why the interceptor is failing.
Producing a sample is going to be hard. If I do, will you require it to be a working maven project (please no)? What’s the minimum you’re looking for? > On 24 May 2017, at 8:08 PM, Romain Manni-Bucau <[email protected]> wrote: > > Le 24 mai 2017 14:05, "JumpStart" <[email protected]> a > écrit : > > The deployment is a collapsed EAR. > > If it’s a scanning issue, it wasn’t one before the upgrade. > > I’ve not needed @Interceptor before. The javadoc says it’s not needed “This > annotation is optional if the Interceptors <http://docs.oracle.com/ > javaee/6/api/javax/interceptor/Interceptors.html> annotation ... used to > associate the interceptor with the target class.” (http://docs.oracle.com/ > javaee/6/api/javax/interceptor/Interceptor.html <http://docs.oracle.com/ > javaee/6/api/javax/interceptor/Interceptor.html>). I’ve just tried it > anyway and the result is the same. > > Surely the key to this problem has to be in the following message? > > WARN [LogStreamAsync.Thread] (Log4jLogStream.java:59) - Injection data not > found in JNDI context: jndiName='comp/env/com.goxpro. > xpro.business.domain.base.BaseService/context', target=com.goxpro.xpro. > business.domain.base.BaseService/context > > > > Well this message is a consequence so yes but it doesnt help much :(. C1n > you push a sample on github using 7.x or 4.7 reproducing the issue? > > >> On 24 May 2017, at 6:57 PM, Romain Manni-Bucau <[email protected]> > wrote: >> >> How is the deployment/packaging? Can it be a scanning issue? You dont add >> @Interceptor on the interceptor? >> >> >> Le 24 mai 2017 11:28, "JumpStart" <[email protected]> a >> écrit : >> >>> I’m upgrading from 4.5.2 to 7.0.3. Since the upgrade, I have an >>> interceptor that fails and consequently session beans can’t be invoked. I >>> found the same error when I tried to upgrade to 4.6.0.2. Was there a JNDI >>> change between 4.5.2 and 4.6.0.2? >>> >>> >>> WARN [LogStreamAsync.Thread] (Log4jLogStream.java:59) - Injection data >>> not found in JNDI context: jndiName='comp/env/com.goxpro. >>> xpro.business.domain.base.BaseService/context', target=com.goxpro.xpro. >>> business.domain.base.BaseService/context >>> WARN [LogStreamAsync.Thread] (Log4jLogStream.java:59) - Injection data >>> not found in JNDI context: jndiName='comp/env/com.goxpro. >>> xpro.business.domain.base.UsernameCacheRefresher/context', >>> target=com.goxpro.xpro.business.domain.base. > UsernameCacheRefresher/context >>> WARN [LogStreamAsync.Thread] (Log4jLogStream.java:59) - Injection data >>> not found in JNDI context: jndiName='comp/env/com.goxpro. >>> xpro.business.domain.base.UsernameCacheRefresher/context', >>> target=com.goxpro.xpro.business.domain.base. > UsernameCacheRefresher/context >>> WARN [LogStreamAsync.Thread] (Log4jLogStream.java:59) - Injection data >>> not found in JNDI context: jndiName='comp/env/com.goxpro. >>> xpro.business.domain.base.UsernameCacheRefresher/context', >>> target=com.goxpro.xpro.business.domain.base. > UsernameCacheRefresher/context >>> ERROR [LogStreamAsync.Thread] (Log4jLogStream.java:51) - >>> EjbTransactionUtil.handleSystemException: null >>> java.lang.NullPointerException >>> at com.goxpro.xpro.business.domain.base.UsernameCacheRefresher. >>> refreshUsernameCache(UsernameCacheRefresher.java:38) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>> NativeMethodAccessorImpl.java:62) >>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>> DelegatingMethodAccessorImpl.java:43) >>> at java.lang.reflect.Method.invoke(Method.java:497) >>> at org.apache.openejb.core.interceptor. >>> ReflectionInvocationContext$Invocation.invoke( > ReflectionInvocationContext. >>> java:205) >>> at org.apache.openejb.core.interceptor. >>> ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) >>> at org.apache.openejb.monitoring.StatsInterceptor.record( >>> StatsInterceptor.java:181) >>> at org.apache.openejb.monitoring.StatsInterceptor.invoke( >>> StatsInterceptor.java:100) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>> NativeMethodAccessorImpl.java:62) >>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>> DelegatingMethodAccessorImpl.java:43) >>> at java.lang.reflect.Method.invoke(Method.java:497) >>> at org.apache.openejb.core.interceptor. >>> ReflectionInvocationContext$Invocation.invoke( > ReflectionInvocationContext. >>> java:205) >>> at org.apache.openejb.core.interceptor. >>> ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) >>> at org.apache.openejb.core.interceptor.InterceptorStack. >>> invoke(InterceptorStack.java:85) >>> at org.apache.openejb.core.stateless.StatelessContainer._ >>> invoke(StatelessContainer.java:252) >>> at org.apache.openejb.core.stateless.StatelessContainer. >>> invoke(StatelessContainer.java:212) >>> at org.apache.openejb.core.ivm.EjbObjectProxyHandler. >>> synchronizedBusinessMethod(EjbObjectProxyHandler.java:265) >>> at org.apache.openejb.core.ivm.EjbObjectProxyHandler. >>> businessMethod(EjbObjectProxyHandler.java:260) >>> at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke( >>> EjbObjectProxyHandler.java:89) >>> at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke( >>> BaseEjbProxyHandler.java:347) >>> at com.sun.proxy.$Proxy206.passivateEligibleClients(Unknown >>> Source) >>> at com.goxpro.xpro.web.daemons.InactiveClientsManagerTask.doNext( >>> InactiveClientsManagerTask.java:65) >>> at com.goxpro.xpro.web.daemons.AbstractTaskRunner.run( >>> AbstractTaskRunner.java:124) >>> at java.util.TimerThread.mainLoop(Timer.java:555) >>> at java.util.TimerThread.run(Timer.java:505) >>> >>> >>> The NPE line is indicated in this source... >>> >>> >>> public class UsernameCacheRefresher { >>> >>> @Resource >>> private javax.ejb.SessionContext context; >>> >>> private static final Logger logger = LoggerFactory.getLogger( >>> BaseService.class); >>> >>> @AroundInvoke >>> public Object refreshUsernameCache(InvocationContext ic) throws >>> Exception { >>> >>> Principal callerPrincipal = context.getCallerPrincipal(); >>> <<< Line 38. NPE happens here. >>> >>> if (callerPrincipal != null) { >>> UsernameCache.setThreadUsername( >>> callerPrincipal.getName()); >>> } >>> else { >>> // Is this even possible? Isn't there a default >>> principal of guest (OpenEJB) or anonymous (JBoss)? >>> logger.error("WATCH OUT - UsernameCacheRefresher >>> found callerPrincipal is null!!!!!!!!!!!!!"); >>> UsernameCache.setThreadUsername(null); >>> } >>> >>> return ic.proceed(); >>> } >>> >>> } >>> >>> >>> Here’s an example of how it gets used… >>> >>> >>> @Stateless >>> @Local(IEmailManagerServiceLocal.class) >>> @Remote(IEmailManagerServiceRemote.class) >>> @Interceptors({ UsernameCacheRefresher.class }) >>> public class EmailManagerService extends BaseService implements >>> IEmailManagerServiceLocal, IEmailManagerServiceRemote { >>> … >>> } >>> >>> >>> Thanks in advance, >>> >>> Geoff
