tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: JDBCRealm conection timeout failure on getPassword
Date Sun, 07 Oct 2012 20:35:32 GMT
On 07/10/2012 19:40, Aladin Dajani wrote:
> Thank you all for your help.  I now have DataSourceRealm based
> authentication up and running with my connection pool.
> 
> One thing I want to mention is that I was unable to make teh scenarios
> described in the wiki work until I duplicated the Resource definition in
> both server.xml and in context.xml. 

That is unlikely to be accurate unless you are using the datasource for
something else.  The GlobalResources definition will be the one working.

The tomcat/conf/context.xml definition will only be valid for Realms
created inside the Context; and will create a separate pool for each
application deployed.


p


I tried several combinations as
> described in the wiki and outside and this is the one that worked, for now
> this is what matters to me.
> 
> Thanks....
> 
> 
> 
> On Sun, Oct 7, 2012 at 11:33 AM, Mark Eggers <its_toasted@yahoo.com> wrote:
> 
>> On 10/7/2012 8:22 AM, Pid * wrote:
>>
>>> On 7 Oct 2012, at 15:26, Aladin Dajani <aladin.dajani@gmail.com> wrote:
>>>
>>>  OK So I tried to use DataSourceRealm.  Seems simple enough. but I get the
>>>> following exception:
>>>>
>>>> Oct 7, 2012 9:54:51 AM org.apache.catalina.realm.**DataSourceRealm open
>>>> SEVERE: Exception performing authentication
>>>> javax.naming.**NameNotFoundException: Name jdbc is not bound in this
>>>> Context
>>>>
>>>> Here is my configuration.  context.xml is unchanged from previous setup
>>>> (works well for pooled database access within the app)
>>>>
>>>> {catalina-base}\conf\context.**xml:
>>>>     <Resource
>>>> name="jdbc/MyAppDB"
>>>> auth="Container"
>>>> driverClassName="com.mysql.**jdbc.Driver"
>>>> logAbandoned="true"
>>>> maxActive="100"
>>>> maxIdle="30"
>>>> maxWait="10000"
>>>> password="password"
>>>> username="user"
>>>> removeAbandoned="true"
>>>> removeAbandonedTimeout="60"
>>>> type="javax.sql.DataSource"
>>>> url="jdbc:mysql://localhost:**3306/databasename"
>>>> />
>>>>
>>>> Server.xml replaces the JDBCRealm with the DataSourceRealm as below
>>>>
>>>> {catalina-base}\conf\server.**xml:
>>>>       <Realm className="org.apache.**catalina.realm.LockOutRealm">
>>>> <Realm className="org.apache.**catalina.realm.**DataSourceRealm"
>>>> dataSourceName="jdbc/MyAppDB"
>>>> userTable="users"
>>>> userNameCol="username"
>>>> userCredCol="password"
>>>> userRoleTable="roles"
>>>> roleNameCol="rolename"
>>>>         digest="MD5"
>>>> />
>>>>       </Realm>
>>>>
>>>> Have I missed a configuration somewhere ?
>>>>
>>>
>>> Yes, define the Resource in GlobalResources in server.xml.
>>>
>>>
>>> p
>>>
>>
>> Here's the Wiki document on the various combinations:
>>
>> http://wiki.apache.org/tomcat/**TomcatDataSourceRealms<http://wiki.apache.org/tomcat/TomcatDataSourceRealms>
>>
>> /mde/
>>
>>
>>>> Thanks.
>>>> On Sun, Oct 7, 2012 at 9:36 AM, Felix Schumacher <
>>>> felix.schumacher@**internetallee.de <felix.schumacher@internetallee.de>>
>>>> wrote:
>>>>
>>>>
>>>>>
>>>>> Aladin Dajani <aladin.dajani@gmail.com> schrieb:
>>>>>
>>>>>  Hello List,
>>>>>>
>>>>>> My application is configured for JDBCRealm authentication uses a
MySQL
>>>>>> database.
>>>>>> For my own use inside the application, I have setup a connection
pool
>>>>>> to
>>>>>> access the database,  However, the configuration of JDBCRealm in
>>>>>> server.xml
>>>>>> uses astand-alone connection.  Since MySQL times-out connections
after
>>>>>> 8
>>>>>> hours, I get the following error in tomcat logs as I try to log-in
>>>>>> after
>>>>>> the connection times out:
>>>>>>
>>>>>> Oct 7, 2012 8:36:51 AM org.apache.catalina.realm.**JDBCRealm
>>>>>> getPassword
>>>>>> SEVERE: Exception performing authentication
>>>>>> com.mysql.jdbc.exceptions.**jdbc4.**MySQLNonTransientConnectionExc**
>>>>>> eption:
>>>>>> No
>>>>>> operations allowed after connection closed.Connection was implicitly
>>>>>> closed
>>>>>> by the driver.
>>>>>>
>>>>>> Users do not notice this error (I presume tomcat's JDBCRealm will
>>>>>> create a
>>>>>> new connection), but it US disconcerting to have all these exceptions
>>>>>> in
>>>>>> tomcat logs, especially that when the server goes into production
mode,
>>>>>> I
>>>>>> fear this will have adverse effects.
>>>>>>
>>>>>> Is it possible to have JDBDRealm use the same connection pool which
my
>>>>>> application uses (which is setup in tomcat's context.xml so it should
>>>>>> be accessible to all applications in tomcat).
>>>>>>
>>>>>
>>>>> Have a look at DatasourceRealm.
>>>>>
>>>>> Regards
>>>>> Felix
>>>>>
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<users-unsubscribe@tomcat.apache.org>
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 


-- 

[key:62590808]


Mime
View raw message