Hello,
Question regarding Tomcat 5.5.7 and the JNDI Datasource:
It seems like either the web documentation for Tomcat 5.5 or the
implementation is incorrect regarding the use of JNDI Datasources.
In this page:
<http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html>
the "Resource" element configuring the DataSource is put inside the "Context"
element.
However, I have tried to set up a DataSourceRealm that is configured
using said "Resource"
00>Exception performing authentication
01> **** javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context
02> **** at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
03> **** at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
04> **** at
org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:406)
05> **** at
org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:277)
06> **** at
org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
07> **** at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
08> **** at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
09> **** at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
10> **** at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
11> **** at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
12> **** at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:306)
13> **** at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
14> **** at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:745)
15> **** at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
16> **** at
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:868)
17> **** at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
18> **** at java.lang.Thread.run(Thread.java:595)
Out of luck? Bugs related to other Tomcat versions helped out:
<http://issues.apache.org/bugzilla/show_bug.cgi?id=24723>
<http://issues.apache.org/bugzilla/show_bug.cgi?id=24836>
I put the "Resource" element inside the "GlobalNamingResources" element,
described here:
<http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/globalresources.html>
...and it worked!
Maybe the documentation should tell people to set up the "Resources" in the
"GlobalNamingResources"? Probably not though -- there might be some other
reason why
it didn't work. I tried "useNaming=true" for the "Context" according to
<http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html> but
no go :-((
Additionally:
The 'factory' attribute of the 'Resource' element is mentioned nowhere... o_O
which is **BAD** because w/o the factory value the Realm Authentication seems to
reduce to 'Access All Areas' - you don't get no error in the catalina log
either.
<Resource name="jdbc/lousydatabase"
auth="Container"
type="javax.sql.DataSource"
HERE ----> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"
validationQuery="SELECT 1"
loginTimeout="10"
username="waateenbordel"
password="tudjeu!!"
testOnBorrow="true"
url="jdbc:mysql://127.0.0.1/lousy?autoReconnect=true&connectTimeout=5000&socketTimeout=30000&useUsageAdvisor=true"
/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]