2 Replies Latest reply on May 8, 2009 12:57 AM by Marcelo Magno

    Problems setting debug=false in components.xml

    Marcelo Magno Newbie

      Hi,


      I am going to deploy an app into production and I need to setup debug=false in components.xml


        <core:init debug="false" jndi-pattern="@jndiPattern@"/>


        (note: I also set <param-name>facelets.DEVELOPMENT</param-name> to false) 


      When doing this, I cannot login to the app anymore, bacause seam throws an exeption telling me that


      javax.el.PropertyNotFoundException: Target Unreachable, identifier 'authenticator' resolved to null


      I tried to get another exception but I had no sucess.


      Setting debug to true the app works normaly.


      Searching the foruns, some pointed that:


      1) In this post http://www.seamframework.org/Community/SettingDebugfalseInComponentsxmlPreventsInitializationOfStartupBeanDuringServerStartup#comment64652
      is told that jboss-seam-debug.jar must be in the WEB-INF/lib -> it is
      2) In this post http://www.seamframework.org/Community/CouldNotInstantiateAuthenticator talked about jndi-pattern, tried jndiPattern appName/\#{ejbName}/local (appName with the correct value), but no go.


      Could anybody help moving on? I am stuck on that.


      authenticator code that works with debug=true?



      package br.com.ad.app;
      
      import javax.persistence.EntityManager;
      import javax.persistence.NoResultException;
      
      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.Credentials;
      import org.jboss.seam.security.Identity;
      
      import br.com.ad.app.model.SystemUser;
      import br.com.ad.app.model.SystemUserRoleType;
      
      @Name("authenticator")
      public class Authenticator {
        @In EntityManager entityManager;
        @In Credentials credentials;
        @In Identity identity;
        @Logger Log log;
        
        public boolean authenticate() {
          try { 
              log.info("Tentativa de autenticacao");
            SystemUser user = (SystemUser) entityManager.createQuery(
               "from SystemUser where login = :username and passwd = :password")
               .setParameter("username", credentials.getUsername())
               .setParameter("password", credentials.getPassword())
               .getSingleResult();
            
            if (user.getSystemUserRoleType() != null) {
             //  for (SystemUserRoleType mr : user.getSystemUserRoleType())
                      SystemUserRoleType mr = user.getSystemUserRoleType();
                  identity.addRole(mr.getMnemonic());
         //   }
            }
            return true;
          }
          catch (NoResultException ex) {
            return false;
          }
        }
      }
      



      Thanks in advance.


      Best Regards,
      Marcelo Magno