[JBoss Seam] - java.lang.RuntimeException: Could not create Component: auth
by grdzeli_kaci
hi all,
i got this error :
| 23:18:43,533 ERROR [[/MagticomBilling]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
| java.lang.RuntimeException: Could not create Component: authenticator
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:833)
| at org.jboss.seam.init.Initialization.addComponents(Initialization.java:715)
| at org.jboss.seam.init.Initialization.init(Initialization.java:478)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
|
could anybody help me what happened ?
my component.xml looks like :
| <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>
|
and AuthenticatorAction class
| @Stateless
| @Name("authenticator")
| public class AuthenticatorAction implements Authenticator{
|
| @PersistenceContext
| EntityManager em;
|
| @Out(scope=SESSION,required=false)
| private Users user;
|
|
| @In Identity identity;
|
| @In Actor actor;
|
| public boolean authenticate() {
| try{
| String userName = identity.getUsername();
| String userpasswd = identity.getPassword();
|
| List<Users> list = (List<Users>)em.createNamedQuery("Users.findByUserName").setParameter("userName",userName).getResultList();
| if (list==null || (list!=null && list.size()!=1)) {
| return false;
| } else {
| user = list.get(0);
| byte [] dbpasword = user.getUserPwd();
|
|
| MessageDigest md5 = MessageDigest.getInstance("MD5");
| md5.reset();
| md5.update(userpasswd.getBytes());
| byte[] usrpwd = md5.digest();
|
| boolean result = MessageDigest.isEqual(usrpwd, dbpasword);
|
| if (!result) {
| return false;
| }
| }
| return true;
| } catch(Exception e) {
| e.printStackTrace();
| return false;
| }
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029214#4029214
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029214
19Â years, 1Â month
[JBoss Seam] - Re: Extended Persistence Context without EntityManager
by dan.j.allen
Okay, I'm the ass. Sorry for wasting your time. Chapter 8.3 describes this very clearly with the Seam-managed SessionFactory and FlushMode feature of Hibernate. I also didn't read close enough (or slow enough) to realize that the session-factory-jndi-name attribute is actually the name of the session factory in the hibernate.cfg.xml file. Intuition wanted to mess with my head.
For those of you just joining us, turn your attention to this quote from the reference manual:
anonymous wrote : Seam lets you specify FlushModeType.MANUAL when beginning a conversation. ...changes will not be flushed to the database until we explicitly force the flush to occur.
and this code
components.xml
<core:hibernate-session-factory name="hibernateSessionFactory"/>
| <core:managed-hibernate-session name="hibernateSession" auto-create="true" session-factory-jndi-name="WhateverYouLike"/>
hibernate.cfg.xml
<session-factory name="WhateverYouLike">
| <!-- props -->
| </session-factory>
So what this is saying is that Seam can manage your hibernate sessions by using a Seam-managed Hibernate SessionFactory. If you inject that Session into a conversation-scoped Seam component, you now have a session-per-conversation for free! Using FlushMode.MANUAL you can even choose to delay the flushing of the session to the database across many different transactions.
Now, the challenge is for me to get this working in my little sandbox.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029207#4029207
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029207
19Â years, 1Â month