Patrick Garner [
https://community.jboss.org/people/pgarner] created the discussion
"Unable to catch EJBException"
To view the discussion, visit:
https://community.jboss.org/message/753872#753872
--------------------------------------------------------------
I'm just doing a simple lookup on a JPA entity (User) via a SLSB (UserService) as
follows: try { result =
userService.findByEmail(email); } catch(Throwable throwable)
{ logger.warn("User ''{0}'' attempt to login failed due
to: " + throwable.getMessage()); } When an incorrect email is entered I get
a stack trace: 14:11:53,005 ERROR [org.jboss.ejb3.invocation] (http--127.0.0.1-8443-5)
JBAS014134: EJB Invocation failed on component UserService for method public
com.patrac.model.authenticate.User
com.patrac.service.UserService.findByEmail(java.lang.String) throws
java.lang.IllegalStateException,javax.persistence.PersistenceException:
javax.ejb.EJBException: javax.persistence.NoResultException: No entity found for query
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
[jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at
org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
[jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at
org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:333)
[jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at
org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:192)
[jboss-as-ejb3-7.1.1.Final.jar:7.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.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
[jboss-as-ejb3-7.1.1.Final.jar:7.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.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
[jboss-as-ejb3-7.1.1.Final.jar:7.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.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[jboss-as-ee-7.1.1.Final.jar:7.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.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.1.1.Final.jar:7.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.ViewService$View.invoke(ViewService.java:165)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at
org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
[jboss-as-ee-7.1.1.Final.jar:7.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.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at
com.patrac.service.UserService$$$view8.findByEmail(Unknown Source) [Patrac-ejb.jar:]
at com.patrac.controller.authenticate.LoginChecker.lookupUser(LoginChecker.java:83)
[classes:] ... Followed by the log message: 14:11:53,128 WARNING
[com.patrac.controller.authenticate.LoginController] (http--127.0.0.1-8443-5) User
mailto:'bad@email.com 'bad(a)email.com' attempt to login failed due to:
javax.persistence.NoResultException: No entity found for query The logger logs the error
message, so I know the exception is being caught. Nevertheless I'm getting a stack
trace. Why is that?
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/753872#753872]
Start a new discussion in Beginner's Corner at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]