DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44162>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44162

           Summary: Problem getting GlobalNamingResources DataSource DBCP
                    from Custom JAAS
           Product: Tomcat 6
           Version: 6.0.14
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Keywords: ErrorMessage
          Severity: critical
          Priority: P2
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I am trying to implement a custom JAAS login module for tomcat 6.0.14 that is
working now over 5.5.25.

This configuration works perfectly on tomcat 5.5.25 but not over 6.0.14.

I think the problem is with accesing JNDI objects out of context without
ResourceLink element. I need to access this way from LoginModule implementation.

The configuration is the following:

server.xml:

  <Server port="9085" shutdown="SHUTDOWN">
  ....
        <GlobalNamingResources>
            <Resource name="jdbc/dataSource_usuarios_aplicaciones_Local" 
                      auth="Container"
                      type="javax.sql.DataSource"
                      driverClassName="com.mysql.jdbc.Driver" 
                   factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" 
                      maxActive="20" maxIdle="10" maxWait="30000" 
                      minEvictableIdleTimeMillis="30000" 
                      username="----" 
                      password="----" 
                      testOnBorrow="true" 
                      testWhileIdle="true" 
                      timeBetweenEvictionRunsMillis="10000" 
url="jdbc:mysql://localhost:3306/usuarios_aplicaciones?autoReconnectForPools=true&amp;connectTimeout=30000"
                      validationQuery="SELECT 1" />
          </GlobalNamingResources>
        ....
        ....
        <Engine name="Catalina" defaultHost="localhost">
                ...
                <Realm className="org.apache.catalina.realm.JAASRealm" 
                             
resourceName="jdbc/dataSource_usuarios_aplicaciones_Local"
                             appName="UsuariosAplicaciones" 
                            
userClassNames="org.sescam.chua.AutenticacionTomcatChua.UsuarioChuaLDAP"
                            
roleClassNames="org.sescam.chua.AutenticacionTomcatChua.GrupoChuaPrincipal"/>
                ...
        </Engine>
  ....
  </Server>

The class that implements 'LoginModule' interface has the following code in
initialize method:

  DataSource dataSourceSQL = null;
  try {
    Context ctx = new InitialContext();
    Context envContext = (Context) ctx.lookup("java:comp/env");
    dataSourceSQL = (DataSource) 
          envContext.lookup("jdbc/dataSource_usuarios_aplicaciones_Local");
    LoginModuloChua.entidadesDAO = new EntidadesDAO(dataSourceSQL);
  } catch (NamingException ex) {
    LoginModuloChua.entidadesDAO = null;
    log_ERROR("Se ha producido una NamingException con " +
              "nombreJndiDBCP: '" + this.nombreJndiDBCP + "' en " +
              "'initialize' -> iniciando 'entidadesDAO': " +
              ex.getMessage());
    ex.printStackTrace();
  }

And always throws the following exception:

  javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to