4 Replies Latest reply on Jan 25, 2012 4:22 PM by Michał Wasiluk

    seam-security, NoResultException while logging with username that doesn't exists.

    Richard Barabe Newbie

      I use seam-security 3.1.0.Beta2 with JPAIdentityStore configured as in IDM management console example.  Seed data are the same as in the example.  When I try to log in with a username that does not exists in the database, I get the following exception :




      ERROR: Login failed
      java.lang.RuntimeException: javax.persistence.NoResultException: No entity found for query
           at org.jboss.seam.security.IdentityImpl.authenticate(IdentityImpl.java:245)
           at org.jboss.seam.security.IdentityImpl.login(IdentityImpl.java:164)
           at org.jboss.seam.security.org$jboss$weld$bean-WEB-INF$lib$seam-security-3$1$0$Beta2-ManagedBean-class_org$jboss$seam$security$IdentityImpl_$$_WeldClientProxy.login(org$jboss$weld$bean-WEB-INF$lib$seam-security-3$1$0$Beta2-ManagedBean-class_org$jboss$seam$security$IdentityImpl_$$_WeldClientProxy.java)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
           at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
           at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
           at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56)
           at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
           at javax.faces.component.UICommand.broadcast(UICommand.java:315)
           at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
           at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
           at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
           at org.jboss.seam.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:62)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
           at org.jboss.seam.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
           at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
           at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
           at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
           at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
           at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
           at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
           at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
           at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
           at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
           at java.lang.Thread.run(Thread.java:662)
      Caused by: javax.persistence.NoResultException: No entity found for query
           at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:280)
           at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getSingleResult(CriteriaQueryCompiler.java:264)
           at org.jboss.seam.security.management.picketlink.JpaIdentityStore.lookupIdentity(JpaIdentityStore.java:1026)
           at org.jboss.seam.security.management.picketlink.JpaIdentityStore.validateCredential(JpaIdentityStore.java:1616)
           at org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository.validateCredential(WrapperIdentityStoreRepository.java:303)
           at org.picketlink.idm.impl.api.session.managers.AttributesManagerImpl.validateCredentials(AttributesManagerImpl.java:607)
           at org.jboss.seam.security.management.IdmAuthenticator.authenticate(IdmAuthenticator.java:44)
           at org.jboss.seam.security.management.org$jboss$weld$bean-WEB-INF$lib$seam-security-3$1$0$Beta2-ManagedBean-class_org$jboss$seam$security$management$IdmAuthenticator_$$_WeldClientProxy.authenticate(org$jboss$weld$bean-WEB-INF$lib$seam-security-3$1$0$Beta2-ManagedBean-class_org$jboss$seam$security$management$IdmAuthenticator_$$_WeldClientProxy.java)
           at org.jboss.seam.security.IdentityImpl.authenticate(IdentityImpl.java:225)
           ... 53 more



      Can someone else confirm the same problem ?  If yes, is this an issue ?  Maybe it shoult throw an AuthenticationException instead ... ?