tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mariano" <mlo...@sescam.org>
Subject Problem getting GlobalNamingResources DataSource DBCP from Custom JAAS
Date Wed, 02 Jan 2008 09:54:16 GMT
Hi all, I have a custom JAAS implemented in Tomcat 5.5.25. This custom JAAS
works fine and i am trying to implement the same custom JAAS in Tomcat
6.0.14 but i have a problem and after deep searching in mailing lists and
web I haven't found anything.

The configuration is the following:

server.xml:

	<GlobalNamingResources>
	    <Resource name="jdbc/dataSource_usuarios_aplicaciones_Local"
	              auth="Container"
	              type="javax.sql.DataSource"
	              description="BBDD MySQL 5.0 donde se almacenan los grupos de
usuarios."
	              driverClassName="com.mysql.jdbc.Driver"
	              factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
	              maxActive="20" maxIdle="10" maxWait="30000"
	              minEvictableIdleTimeMillis="30000"
	              username="dbcplodi"
	              password="infor123"
	              testOnBorrow="true"
	              testWhileIdle="true"
	              timeBetweenEvictionRunsMillis="10000"
	              url="jdbc:mysql://localhost:3306/usuarios_aplicaciones?autoRe
connectForPools=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.Usuar
ioChuaLDAP"
		             roleClassNames="org.sescam.chua.AutenticacionTomcatChua.Grupo
ChuaPrincipal"/>
		...
	</Engine>

All libraries are placed in %TOMCAT_HOME%/lib folder.

I deleted the custom JAAS just to try if DBCP is well initialized with this
URL in navigator: http://localhost:9080/manager/resources and the DBCP is
correctly configured.

The tomcat server started with JVM
property: -Djava.security.auth.login.config=C:\.......\jaas.config

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

Please any idea ?.

Best regards and thank you very much,

Mariano López



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message