You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "David Tonhofer, m-plify S.A." <d....@m-plify.com> on 2005/03/10 12:21:29 UTC
Tomcat 5.5.7. server.xml doc may be buggy...is it bugzilla time?
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat 5.5.7. server.xml doc may be buggy...is it bugzilla time?
Posted by "David Tonhofer, m-plify S.A." <d....@m-plify.com>.
> Ah, cool, so you did not read the docs for the datasource realm, then ...
WRONG!
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/realm-howto.html#DataSourceRealm
> -> localDataSource
Easy when you know it, then. Tested ok. One problem down.
>> 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.
>
> You indeed should not be specifying the factory, and it works fine.
Damn...you are right, too. Well, I tested this twice and I was sure that there was
a problem. Ah, well.
A look at the source reveals the default factory is indeed
"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" but you can specify it
through the system property "javax.sql.DataSource.Factory" or through the
"factory" attribute. Which is nice.
> Please stop whining.
Should I take this as an offense? I don't whine. I either discuss bugs or use
harsh language.
But thanks anyway.
-- David Tonhofer
M-PLIFY S.A.
Resp. Informatique
47, av. de la Liberté
L-1931 Luxembourg
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat 5.5.7. server.xml doc may be buggy...is it bugzilla time?
Posted by Remy Maucherat <re...@gmail.com>.
On Thu, 10 Mar 2005 12:21:29 +0100, David Tonhofer, m-plify S.A.
<d....@m-plify.com> wrote:
> 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)
Ah, cool, so you did not read the docs for the datasource realm, then ...
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/realm-howto.html#DataSourceRealm
-> localDataSource
> 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!
Makes sense.
> 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.
You indeed should not be specifying the factory, and it works fine.
Please stop whining.
--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org