tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25805] New: - DataSourceRealm cannot find the JNDI DataSource
Date Mon, 29 Dec 2003 19:52:53 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25805>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25805

DataSourceRealm cannot find the JNDI DataSource

           Summary: DataSourceRealm cannot find the JNDI DataSource
           Product: Tomcat 5
           Version: 5.0.16
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: akhayyat@ccse.kfupm.edu.sa


Hi there,

I am trying to use DataSourceRealm for my application to authenticate users 
according to a mysql database as instructed in the HOW-TOs, but it does not 
seem to work although the DataSource Resource alone can be accessed and data 
queried.
When using the DataSourceRealm I get the following in the application log:
Exception performing authenticati
on
javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:197)
        at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:4
51)
        at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceReal
m.java:299)
        at org.apache.catalina.authenticator.FormAuthenticator.authenticate(Form
Authenticator.java:274)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:493)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:149)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:195)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:164)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:149)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:156)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:21
1)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:805)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:696)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:605)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:677)


I am defining all my application context, i.e. the datasource and the 
DataSourceRealm in a context xml file rather than server.xml, althouth I tried 
both initially.

Here is my application context xml related configuration:

<Context ...>
  <Logger../>
  <Realm className="org.apache.catalina.realm.DataSourceRealm"
         dataSourceName="java:comp/env/jdbc/datasourcename" 
               <!-- I tried also "jdbc/datasourcename" only, still no luck -->
         .../>

  <Resource auth="Container" name=jdbc/datasourcename"
    type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/datasourcename">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:port/dbname?autoReconnect=true</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>username</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>password</value>
    </parameter>
  </ResourceParams>

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


Mime
View raw message