[
https://issues.jboss.org/browse/AS7-3227?page=com.atlassian.jira.plugin.s...
]
Philipp Berger edited comment on AS7-3227 at 1/10/12 3:58 AM:
--------------------------------------------------------------
Absolutely. I have changed the sample project to throw an IllegalArgumentException when
securityContext.getUserPrincipal()returns null:
{code}
Principal userPrincipal = securityContext.getUserPrincipal();
if (userPrincipal == null) {
throw new IllegalArgumentException("userPrincipal is null");
}
return "Hello " + userPrincipal.getName()+"!";
{code}
Here is the Stack Trace I got:
{code}
09:49:06,453 ERROR [org.jboss.ejb3.invocation] (http--127.0.0.1-8080-1) JBAS014134: EJB
Invocation failed on component UserPrincipalRESTServiceImpl for method public abstract
java.lang.String ch.dvbern.samples.rest.UserPrincipalRESTService.helloUser():
javax.ejb.EJBException: java.lang.IllegalArgumentException: userPrincipal is null
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:57)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at ch.dvbern.samples.rest.UserPrincipalRESTService$$$view2.helloUser(Unknown Source)
[classes:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
ch.dvbern.samples.rest.UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.helloUser(UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.java)
[weld-core-1.1.4.Final.jar:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
[resteasy-jaxrs-2.3.0.GA.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
[jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
[jbossweb-7.0.7.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
[jbossweb-7.0.7.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.IllegalArgumentException: userPrincipal is null
at
ch.dvbern.samples.rest.UserPrincipalRESTServiceImpl.helloUser(UserPrincipalRESTServiceImpl.java:19)
[classes:]
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at
org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:122)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:130)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
... 60 more
09:49:06,467 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/app].[ch.dvbern.samples.rest.JaxRsActivator]]
(http--127.0.0.1-8080-1) Servlet.service() for servlet
ch.dvbern.samples.rest.JaxRsActivator threw exception:
org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException:
userPrincipal is null
at
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
[resteasy-jaxrs-2.3.0.GA.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
[jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
[jbossweb-7.0.7.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
[jbossweb-7.0.7.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.IllegalArgumentException: userPrincipal is null
at
ch.dvbern.samples.rest.UserPrincipalRESTServiceImpl.helloUser(UserPrincipalRESTServiceImpl.java:19)
[classes:]
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at
org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:122)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:130)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:57)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at ch.dvbern.samples.rest.UserPrincipalRESTService$$$view2.helloUser(Unknown Source)
[classes:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
ch.dvbern.samples.rest.UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.helloUser(UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.java)
[weld-core-1.1.4.Final.jar:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
[resteasy-jaxrs-2.3.0.GA.jar:]
... 23 more
{code}
It took around 106000 invocations to trigger the exception:
{code}
[...]
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106531
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106532
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106533
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106534
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106535
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106536
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106537
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106538
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106539
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106540
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106541
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106542
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106543
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106544
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106545
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106546
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 185.465 sec <<<
FAILURE!
Results :
Tests in error:
doTest(UserPrincipalRESTServiceIT): Error status 500 Internal Server Error returned
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
{code}
was (Author: pberger):
Absolutely. I have changed the sample project to throw an IllegalArgumentException
when securityContext.getUserPrincipal()returns null:
{code}
Principal userPrincipal = securityContext.getUserPrincipal();
if (userPrincipal == null) {
throw new IllegalArgumentException("userPrincipal is null");
}
return "Hello " + userPrincipal.getName()+"!";
{code}
Here is the Stack Trace I got:
{code}
09:49:06,453 ERROR [org.jboss.ejb3.invocation] (http--127.0.0.1-8080-1) JBAS014134: EJB
Invocation failed on component UserPrincipalRESTServiceImpl for method public abstract
java.lang.String ch.dvbern.samples.rest.UserPrincipalRESTService.helloUser():
javax.ejb.EJBException: java.lang.IllegalArgumentException: userPrincipal is null
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:57)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at ch.dvbern.samples.rest.UserPrincipalRESTService$$$view2.helloUser(Unknown Source)
[classes:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
ch.dvbern.samples.rest.UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.helloUser(UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.java)
[weld-core-1.1.4.Final.jar:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
[resteasy-jaxrs-2.3.0.GA.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
[jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
[jbossweb-7.0.7.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
[jbossweb-7.0.7.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.IllegalArgumentException: userPrincipal is null
at
ch.dvbern.samples.rest.UserPrincipalRESTServiceImpl.helloUser(UserPrincipalRESTServiceImpl.java:19)
[classes:]
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at
org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:122)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:130)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
... 60 more
09:49:06,467 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/app].[ch.dvbern.samples.rest.JaxRsActivator]]
(http--127.0.0.1-8080-1) Servlet.service() for servlet
ch.dvbern.samples.rest.JaxRsActivator threw exception:
org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException:
userPrincipal is null
at
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
[resteasy-jaxrs-2.3.0.GA.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489)
[jbossweb-7.0.7.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
[jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
[jbossweb-7.0.7.Final.jar:]
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
[jbossweb-7.0.7.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
[jbossweb-7.0.7.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.IllegalArgumentException: userPrincipal is null
at
ch.dvbern.samples.rest.UserPrincipalRESTServiceImpl.helloUser(UserPrincipalRESTServiceImpl.java:19)
[classes:]
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at
org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:122)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:130)
[jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:57)
[jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at
org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
[jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
at ch.dvbern.samples.rest.UserPrincipalRESTService$$$view2.helloUser(Unknown Source)
[classes:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at
ch.dvbern.samples.rest.UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.helloUser(UserPrincipalRESTService$-277902241$Proxy$_$$_Weld$Proxy$.java)
[weld-core-1.1.4.Final.jar:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
[resteasy-jaxrs-2.3.0.GA.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
[resteasy-jaxrs-2.3.0.GA.jar:]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
[resteasy-jaxrs-2.3.0.GA.jar:]
... 23 more
{code}
It took around 106000 invocations to trigger the exceptions:
{code}
[...]
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106531
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106532
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106533
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106534
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106535
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106536
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106537
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106538
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106539
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106540
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106541
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106542
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106543
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106544
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106545
Tue Jan 10 09:49:06 CET 2012 successfull calls: 106546
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 185.465 sec <<<
FAILURE!
Results :
Tests in error:
doTest(UserPrincipalRESTServiceIT): Error status 500 Internal Server Error returned
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
{code}
When a Stateless Session Bean is used as a REST-Resource, calling
getUserPrincipal() on an injected SecurityContext sometimes returns null
------------------------------------------------------------------------------------------------------------------------------------------
Key: AS7-3227
URL:
https://issues.jboss.org/browse/AS7-3227
Project: Application Server 7
Issue Type: Bug
Components: EJB, REST
Affects Versions: 7.0.2.Final, 7.1.0.CR1b
Environment: Ubuntu Linux 11.04 64-bit, jdks 1.7.0_02 and 1.6.0_26
Reporter: Philipp Berger
Assignee: jaikiran pai
Considered the following stateless session bean which is propagated as a
REST-Webservice:
{code:title=UserPrincipalRESTService.java|borderStyle=solid}
@Path("/test")
public interface UserPrincipalRESTService {
@GET
@Produces(MediaType.TEXT_PLAIN)
String helloUser();
}
{code}
{code:title=UserPrincipalRESTServiceImpl.java|borderStyle=solid}
@Stateless
@Local
public class UserPrincipalRESTServiceImpl implements UserPrincipalRESTService {
@Context
private SecurityContext securityContext;
public String helloUser() {
final String userName = securityContext.getUserPrincipal().getName();
return "Hello " + userName+"!";
}
}
{code}
After a certain (sometimes very large) amount of GET Requests on the Resource, the
injected SecurityContext's user principal suddenly is null and a NPE is thrown. Once
this happened, every second call to the resource will throw a NPE until the application
server is restarted.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira