0 Replies Latest reply on Aug 24, 2007 7:49 AM by Michael Freitag

    Seam, ICEFaces Beginning

    Michael Freitag Newbie

      Hello,

      yesterday i started with icefaces and generates me a template projects with icefaces seam generator. With the gernerated project i do not have problems.

      Now i want to implement a entity Tuser, look so:

      import org.jboss.seam.annotations.Name;
      import javax.persistence.*;
      import java.io.Serializable;
      
      @Entity
      @Name("tuser")
      public class Tuser implements Serializable {
      
       private long id;
       private String username;
       private String userpassword;
      
       @Id @GeneratedValue
       public long getId() { return id; }
       public void setId(long id) { this.id = id; }
      
       public String getUsername() { return username; }
       public void setUsername(String username) {
       this.username = username;
       }
      
      }
      


      and my Authenticator.java file is:

      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.security.Identity;
      import javax.persistence.*;
      
      
      
      @Name("authenticator")
      public class Authenticator
      {
       @Logger Log log;
      
       @In Identity identity;
      
       @PersistenceContext
       EntityManager em;
      
       public boolean authenticate()
       {
       log.info("authenticating #0", identity.getUsername());
       //trying to authenticate
      
       try {
      
       TUser user = (TUser) em.createQuery("from tuser where username=:username"
       + " and password=:password")
       .setParameter("username", identity.getUsername())
       .setParameter("userpassword", identity.getPassword())
       .getSingleResult();
      
       identity.addRole("admin");
       return true;
      
       } catch (NoResultException ex) {
      
       log.info("kein Benutzer gefunden.");
       return false;
      
       }
      
       //return true;
       }
      }
      


      Now, if i deploy i get some errors, that i don't understand - because its my first time with seam/icefaces.

      the first error i got is myfaces...listener - startup failed and then i "mbeans waiting for other mbeans".
      MyError is:

      12:20:11,824 INFO [StartupServletContextListener] Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
      12:20:11,824 ERROR [StandardContext] Error listenerStart

      Thanks for advice,
      Michael