tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angel Cervera Claudio <an...@acervera.com>
Subject DataSourceRealm can not find JNDI name in context
Date Thu, 09 Sep 2004 14:11:01 GMT
Error with realm using DataSource:
Problem is that DataSourceRealm can not find JNDI name in context.
There are a bug in tomcat 4.1, but this was resolved.
I'm using tomcat 5.0.28.
My xml in Catalina/localhost content:
<?xml version='1.0' encoding='utf-8'?> 
<Context displayName="Gestion de cunetas." docBase="/home/angel/workspace/yeguadas/tmp/web"
path="/yeguadas" useNaming="false">
  <Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/YeguadasDB"
roleNameCol="NOMBRE" userCredCol="PASSWORD" userNameCol="NOMBRELOGIN" userRoleTable="USUARIO_PERFILES"
userTable="USUARIO"/>

  <Resource auth="Container" name="jdbc/YeguadasDB" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/YeguadasDB">
    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/yeguadas?autoReconnect=true</value>
    </parameter>
    <parameter>
      <name>validationQuery</name>
      <value>select count(*) from usuario;</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>30</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>org.gjt.mm.mysql.Driver</value>
    </parameter>
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>ijdshkhds</value>
    </parameter>
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>fdfdferfr</value>
    </parameter>
  </ResourceParams>
</Context>

My web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="javax/servlet/resources/web-app_2_4.xsd"
    version="2.4">

  <display-name>Gestion de cunetas.</display-name>
  
  <resource-ref>
      <description>Yeguadas DB Connection</description>
      <res-ref-name>jdbc/YeguadasDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>


  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.action</url-pattern>
  </servlet-mapping>
  
  
  <!-- Para el displaytag. -->
  
  	<filter>
		<filter-name>ResponseOverrideFilter</filter-name> 
		<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class> 
	</filter>
	 
	<filter-mapping>
		<filter-name>ResponseOverrideFilter</filter-name> 
		<url-pattern>*.action</url-pattern>
	</filter-mapping>
	<filter-mapping> 
		<filter-name>ResponseOverrideFilter</filter-name> 
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping>


  <!-- The Usual Welcome File List -->
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
    <!-- SECURITY CONSTRAINT -->
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Toda</web-resource-name>
      <url-pattern>/*</url-pattern>
      <http-method>GET</http-method>
      <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>usuario</role-name>
    </auth-constraint>
    <!--
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    -->
  </security-constraint>

  <!-- LOGIN AUTHENTICATION -->
  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config>

  <!-- SECURITY ROLES -->
  <security-role>
    <role-name>usuario</role-name>
  </security-role>


	<!-- Struts Tag Library Descriptors -->
	<taglib>
		<taglib-uri>/tags/struts-bean</taglib-uri>
		<taglib-location>/WEB-INF/lib/struts-bean.tld</taglib-location>
	</taglib>
	
	<taglib>
		<taglib-uri>/tags/struts-html</taglib-uri>
		<taglib-location>/WEB-INF/lib/struts-html.tld</taglib-location>
	</taglib>
	
	<taglib>
		<taglib-uri>/tags/struts-logic</taglib-uri>
		<taglib-location>/WEB-INF/lib/struts-logic.tld</taglib-location>
	</taglib>
	
	<taglib>
		<taglib-uri>/tags/struts-nested</taglib-uri>
		<taglib-location>/WEB-INF/lib/struts-nested.tld</taglib-location>
	</taglib>
	
	<taglib>
		<taglib-uri>/tags/struts-tiles</taglib-uri>
		<taglib-location>/WEB-INF/lib/struts-tiles.tld</taglib-location>
	</taglib>
	
	<!-- JSTL Tag Library Descriptors -->
	<taglib>
		<taglib-uri>/tags/jstl/core</taglib-uri>
		<taglib-location>/WEB-INF/lib/c.tld</taglib-location>
	</taglib>
	<taglib>
		<taglib-uri>/tags/jstl/fmt</taglib-uri>
		<taglib-location>/WEB-INF/lib/fmt.tld</taglib-location>
	</taglib>

	
  
  
    <!-- DisplayTags tags. -->
	<taglib>
		<taglib-uri>/tags/displaytag</taglib-uri>
		<taglib-location>/WEB-INF/lib/displaytag-12.tld</taglib-location>
	</taglib>
	

  

</web-app>


This is the exception when user try login: 
2004-09-09 15:43:46 DataSourceRealm[/yeguadas]: Excepci├│n realizando autenticaci├│n
javax.naming.NameNotFoundException: El nombre jdbc no este asociado a este contexto
        at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:437)
        at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:277)
        at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:129)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
        at java.lang.Thread.run(Thread.java:534)




________________________________________________________________________
Angel Cervera Claudio
Telf. +34 670819234
Mail: angel@acervera.com
Web: http://www.acervera.com
Msn Messenger: angelcervera@hispavista.com
Yahoo Messenger: angelcervera
AOL Messenger: angelcervera


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message