[jboss-user] [JBoss Seam] - Re: How to use Seam Identity?
tonylmai
do-not-reply at jboss.com
Tue Feb 27 21:21:30 EST 2007
I am using Seam-managed PC. But it's throwing me the above error. Here is a snippet of stacktrace:
| 18:07:03,015 INFO [Lifecycle] starting up: org.jboss.seam.security.identity
| 18:07:03,562 INFO [Pages] reading pages.xml
| 18:07:03,625 ERROR [SeamLoginModule] Error invoking login method
| javax.faces.el.EvaluationException: org.jboss.seam.RequiredException: In attribute requires value for component: authenticator.entityManager
| at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
| ....
| Caused by: org.jboss.seam.RequiredException: In attribute requires value for component: authenticator.entityManager
| at org.jboss.seam.Component.getInstanceToInject(Component.java:1920)
| .....
|
I followed the example and coded the Authenticator as followed:
| package com.judots.webclient.session;
|
| import * (skipped)
|
| @Name("authenticator")
| public class Authenticator {
| @In
| EntityManager entityManager;
|
| public boolean authenticate() {
| String usrName = Identity.instance().getUsername();
| System.out.println("Verify login for " + usrName);
|
| User dbUsr = null;
| try {
| dbUsr = (User) entityManager
| .createQuery(
| "from login_user where loginId = :username and password = :password")
| .setParameter("username", Identity.instance().getUsername())
| .setParameter("password", Identity.instance().getPassword())
| .getSingleResult();
|
| assert (dbUsr != null) : "No result from db. Should have thrown NoResultException";
|
| Seam.invalidateSession();
| // String err = Messages.getString(ELNames.APP_BUNDLE_ELNAME,
| // "login.invalidIdPwd.msg", new Object[] {});
| // FacesMessages.instance().add(err);
| return false;
| }
| } catch (NoResultException ex) {
| System.out.println("User " + usrName + " not found.");
|
| Seam.invalidateSession();
| // String err = Messages.getString(ELNames.APP_BUNDLE_ELNAME,
| // "login.invalidIdPwd.msg", new Object[] {});
| // FacesMessages.instance().add(err);
| return false;
| }
|
| return true;
| }
| }
|
I am not sure if I understand what it means by 'In attribute requires value for component'. Can you help?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4023423#4023423
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4023423
More information about the jboss-user
mailing list