Décidément, je vais devenir dingue avec Hibernate !

Encore une fois, je précise que je découvre un nouveau monde avec Seam et tout ce qui tourne avec.

En attendant d'autres informations pour résoudre ce problème, je passe à autre chose...

Dans Identifier.java, j'ai, entre autres, ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    @Out(value="Nom", required=false, scope = ScopeType.SESSION)
    private String nom;
 
    @Out(value="Prenom", required=false, scope = ScopeType.SESSION)
    private String prenom;
 
    @Out(value="MotPasse", required=false, scope = ScopeType.CONVERSATION)
    private String motPasse;
 
    public boolean identifier() 
    {
        try
        {
            log.info("identification.identifier() "
                    + "Tentative d'identification avec les paramètres suivants : "
                    + "#{identification.nom}, #{identification.prenom}, #{identification.dateNaissance}");
 
            // Recherche de l'étudiant
            Query query = entityManager.createQuery(
                    "from ThEtudiantEtu e " +
                    "where e.prsNom = :nom " +
                        "and e.prsPrenom = :prenom " +
                        "and e.etuDateNaissance = :dateNaissance ");
            query.setParameter("nom", this.getNom());
            query.setParameter("prenom", this.getPrenom());
            query.setParameter("dateNaissance", this.getDateNaissance());
 
            ThEtudiantEtu etudiant = (ThEtudiantEtu) query.getSingleResult();
 
            // Génération de son mot de passe
            log.info("identification.identifier() : affectation du mot de passe");
            this.setMotPasse(etudiant.generatePassword(this.getPrenom(), this.getNom()));
            setAdmis(true);
 
            setPageSuivante("/login.xhtml");
            return true;
        }
Jusque là, ça fonctionne. La redirection se fait bien, les propriétés en @Out sont bien exportées et je peux les afficher sur la page de login.

Mais c'est bien beau de générer un mot de passe, encore faut-il l'injecter dans la BDD ! Alors j'ai modifié la génération du mot de passe de cette façon :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
            // Génération de son mot de passe
            log.info("identification.identifier() : affectation du mot de passe");
            this.setMotPasse(etudiant.generatePassword(this.getPrenom(), this.getNom()));
            log.info("identification.identifier() : enregistrement du mot de passe #{identification.motPasse}");
            etudiant.setUtiMotPasse(this.getMotPasse());
            entityManager.flush();
            log.info("identification.identifier() : mot de passe enregistré");
Miracle ! Ça fonctionne du premier coup ! Le mot de passe s'enregistre bien dans la table pour l'utilisateur qui vient de s'authentifier.
Mais la redirection vers la page de login plante, apparemment parce qu'il ne trouve plus le user !
15:23:22,228 INFO [Identification] identification.identifier() : affectation du mot de passe
15:23:22,228 INFO [Identification] identification.identifier() : enregistrement du mot de passe T091210T
Hibernate:
update
stamas.th_utilisateur_uti
set
uti_id_type_utilisateur=?,
uti_login=?,
uti_mot_passe=?
where
uti_id_personne=?
15:23:22,248 INFO [Identification] identification.identifier() : mot de passe enregistré
15:23:22,249 DEBUG [Component] trying to inject with hierarchical context search: entityManager
15:23:22,249 DEBUG [Component] trying to inject with hierarchical context search: statusMessages
15:23:22,249 DEBUG [Component] trying to inject with hierarchical context search: identity
15:23:22,250 DEBUG [Component] trying to inject with hierarchical context search: credentials
15:23:22,259 DEBUG [Component] trying to inject with hierarchical context search: facesMessages
15:23:22,261 DEBUG [Component] trying to inject with hierarchical context search: entityManager
15:23:22,261 DEBUG [Component] trying to inject with hierarchical context search: statusMessages
15:23:22,262 DEBUG [Component] trying to inject with hierarchical context search: identity
15:23:22,262 DEBUG [Component] trying to inject with hierarchical context search: credentials
15:23:22,273 DEBUG [Component] trying to inject with hierarchical context search: facesMessages
15:23:22,279 DEBUG [Navigator] redirecting to: /login.xhtml
15:23:22,280 DEBUG [FacesManager] redirecting to: /stamas/login.seam?cid=3
15:23:22,280 DEBUG [SeamPhaseListener] committing transaction after phase: INVOKE_APPLICATION 5
15:23:22,280 DEBUG [EntityTransaction] committing JPA resource-local transaction
15:23:22,282 DEBUG [Manager] Storing conversation state: 3
15:23:22,282 DEBUG [FacesLifecycle] After render response, destroying contexts
15:23:22,282 DEBUG [Contexts] destroying business process context
15:23:22,282 DEBUG [Contexts] flushing server-side conversation context
15:23:22,283 DEBUG [Contexts] flushing session context
15:23:22,283 DEBUG [Contexts] destroying event context
15:23:22,283 DEBUG [Contexts] destroying: com.sun.faces.util.RequestStateManager
15:23:22,283 DEBUG [Contexts] destroying: org.jboss.seam.core.manager
15:23:22,283 DEBUG [Contexts] destroying: org.jboss.seam.faces.validation
15:23:22,283 DEBUG [Contexts] destroying: org.jboss.seam.transaction.synchronizations
15:23:22,283 DEBUG [Contexts] destroying: org.jboss.seam.web.requestContextPath
15:23:22,283 DEBUG [Contexts] destroying: com.exade.vcp.Filter.ResponseWrapper
15:23:22,283 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationPropagation
15:23:22,284 DEBUG [Contexts] destroying: org.jboss.seam.faces.dateConverter
15:23:22,284 DEBUG [Contexts] destroying: com.exade.vcp.Filter.done
15:23:22,284 DEBUG [Contexts] destroying: identification
15:23:22,284 DEBUG [Contexts] destroying: org.jboss.seam.transaction.transaction
15:23:22,284 DEBUG [Contexts] destroying: org.jboss.seam.web.servletContexts
15:23:22,284 DEBUG [Contexts] destroying: org.jboss.seam.core.events
15:23:22,284 DEBUG [Contexts] destroying: org.jboss.seam.web.requestServletPath
15:23:22,284 DEBUG [Contexts] destroying: ajaxContext
15:23:22,284 DEBUG [FacesLifecycle] <<< End JSF request for /stamas/identification.seam
15:23:22,297 DEBUG [FacesLifecycle] >>> Begin JSF request for /stamas/login.seam
15:23:22,298 DEBUG [Manager] Restoring conversation with id: 3
15:23:22,298 DEBUG [SeamPhaseListener] beginning transaction prior to phase: RENDER_RESPONSE 6
15:23:22,299 DEBUG [EntityTransaction] beginning JPA resource-local transaction
15:23:22,345 DEBUG [Component] trying to inject with hierarchical context search: identity
15:23:22,346 DEBUG [Component] trying to inject with hierarchical context search: credentials
15:23:22,346 DEBUG [Component] trying to inject with hierarchical context search: entityManager
15:23:22,346 DEBUG [EntityTransaction] registering synchronization: ManagedPersistenceContext(java:/entityManager)
15:23:22,347 DEBUG [Component] trying to inject from specified context: MotPasse, scope: EVENT
15:23:22,402 DEBUG [Component] trying to inject with hierarchical context search: identity
15:23:22,402 DEBUG [Component] trying to inject with hierarchical context search: credentials
15:23:22,403 DEBUG [Component] trying to inject with hierarchical context search: entityManager
15:23:22,403 DEBUG [Component] trying to inject from specified context: MotPasse, scope: EVENT
15:23:22,410 DEBUG [Component] trying to inject with hierarchical context search: identity
15:23:22,410 DEBUG [Component] trying to inject with hierarchical context search: credentials
15:23:22,411 DEBUG [Component] trying to inject with hierarchical context search: entityManager
15:23:22,411 DEBUG [Component] trying to inject from specified context: MotPasse, scope: EVENT
15:23:22,411 DEBUG [SeamPhaseListener] committing transaction after phase: RENDER_RESPONSE 6
15:23:22,411 DEBUG [EntityTransaction] committing JPA resource-local transaction
15:23:22,412 DEBUG [Manager] Discarding conversation state: 3
15:23:22,412 DEBUG [FacesLifecycle] After render response, destroying contexts
15:23:22,412 DEBUG [Contexts] destroying business process context
15:23:22,412 DEBUG [Contexts] destroying conversation context
15:23:22,412 DEBUG [Contexts] destroying: org.jboss.seam.persistence.persistenceContexts
15:23:22,413 DEBUG [Contexts] destroying: org.jboss.seam.core.conversation
15:23:22,413 DEBUG [Contexts] destroying: MotPasse
15:23:22,413 DEBUG [Contexts] destroying: org.jboss.seam.international.statusMessages
15:23:22,413 DEBUG [Contexts] destroying: entityManager
15:23:22,413 DEBUG [ManagedPersistenceContext] destroying seam managed persistence context for persistence unit: java:/entityManager
15:23:22,413 DEBUG [Contexts] flushing server-side conversation context
15:23:22,413 DEBUG [Contexts] flushing session context
15:23:22,414 DEBUG [Contexts] destroying event context
15:23:22,414 DEBUG [Contexts] destroying: com.sun.faces.util.RequestStateManager
15:23:22,414 DEBUG [Contexts] destroying: org.jboss.seam.core.manager
15:23:22,414 DEBUG [Contexts] destroying: facelets.ContentType
15:23:22,414 DEBUG [Contexts] destroying: org.jboss.seam.transaction.synchronizations
15:23:22,414 DEBUG [Contexts] destroying: org.jboss.seam.web.requestContextPath
15:23:22,414 DEBUG [Contexts] destroying: com.exade.vcp.Filter.ResponseWrapper
15:23:22,414 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationPropagation
15:23:22,414 DEBUG [Contexts] destroying: facelets.Encoding
15:23:22,414 DEBUG [Contexts] destroying: authenticator
15:23:22,414 DEBUG [Contexts] destroying: com.exade.vcp.Filter.done
15:23:22,414 DEBUG [Contexts] destroying: org.jboss.seam.transaction.transaction
15:23:22,415 DEBUG [Contexts] destroying: org.jboss.seam.web.servletContexts
15:23:22,415 DEBUG [Contexts] destroying: org.jboss.seam.core.events
15:23:22,415 DEBUG [Contexts] destroying: org.jboss.seam.web.requestServletPath
15:23:22,415 DEBUG [Contexts] destroying: ajaxContext
15:23:22,415 DEBUG [FacesLifecycle] <<< End JSF request for /stamas/login.seam
15:23:22,415 DEBUG [ExceptionFilter] handling uncaught exception
javax.servlet.ServletException: @Out attribute requires non-null value: authenticator.user
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
...
Caused by: org.jboss.seam.RequiredException: @Out attribute requires non-null value: authenticator.user
at org.jboss.seam.Component.outjectAttribute(Component.java:1764)
...
15:23:22,416 DEBUG [ExceptionFilter] exception root cause
org.jboss.seam.RequiredException: @Out attribute requires non-null value: authenticator.user
at org.jboss.seam.Component.outjectAttribute(Component.java:1764)
Quelqu'un peut m'expliquer ce qui se passe ?