You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vinoth Raja <rb...@gmail.com> on 2015/02/10 17:57:44 UTC

Given password did not match password used to create the PooledConnection when there is no change in password

Hi,

Environment used:
  - Tomcat 7.0.57
  - Windows
  - Java 1.7
  - MS SQL 2008.

Issue:"Given password did not match password used to create the
PooledConnection"
          There is no change in the password from the day application went
live.But it happens when there is more request.

Background on the logic :
        We have five different business application deployed on tomcat.
There is different DB instance for each business.
        5 primary DB instances and 5 secondary DB instances.
        I have configured total 10 datasource in tomcat context.xml.
        username/password it passed in getConnection(username,password ) to
get the connection object.
        I have posted the query in stackoverflow and the recommendation was
to update the library.Not sure whether to update the higher version library.


Datasource and Application Logic:

I have configured 10 datasources like the below

<Resource auth="Container"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
factory="org.apache.tomcat.dbcp.dbcp.cpdsadapter.DriverAdapterCPDS"
name="jdbc/CDBCPDS"
type="org.apache.tomcat.dbcp.dbcp.cpdsadapter.DriverAdapterCPDS"
url="jdbc:sqlserver://10.200.100.8:1433;DatabaseName=SNECDB"/>
        <Resource auth="Container"
dataSourceName="java:/comp/env/jdbc/CDBCPDS"
defaultMaxActive="20" defaultMaxIdle="5" defaultMaxWait="10000"
factory="org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSourceFactory"
logAbandoned="true" name="jdbc/CDB" removeAbandoned="true"
removeAbandonedTimeout="300" testOnBorrow="true" testWhileIdle="true"
  timeBetweenEvictionRunsMillis="60000"
type="org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSource"
validationQuery="select 1"/>

Here is the java application which retrieves the connection object.

try {

dataSourceName = "jdbc/".concat(GetConfigurationDetails
.get("cmm.datasource.db2." + dnis));
userName = GetConfigurationDetails.get("cmm.username.db2");
password = GetConfigurationDetails.get("cmm.password.db2");
 if (objLogger.isDebugEnabled())
objLogger.debug("[" + ucid + "] dataSourceName: "
+ dataSourceName);

objDataSource = (DataSource) envContext.lookup(dataSourceName);
try {
connection = objDataSource.getConnection(userName, password);
} catch (SQLException e) {
objLogger.error("[" + ucid + "]"
+ "SQLException in connection manager: "
+ e.getMessage());
}

} catch (NamingException e) {
objLogger.info("[" + ucid + "]"
+ "NamingException in connection manager: "
+ e.getMessage());
e.printStackTrace();
}

Background on findings:

     - There was patch to fix "when changes his/her password, the entire
connection pool must be restarted for DBCP to recognize the new password".
It is not the case  with me as there is no change in the password.
    - Stack Overflow recommendation to update the library. Not sure whether
to use the library from tomcat 7.0.59
    - I have modified the Resource to have username/password details and
this issue doesn't happen.
      <Resource name="jdbc/SHPDB" auth="Container"
              type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
              url="jdbc:sqlserver://10.200.100.8:1433;DatabaseName=SHPDB"
              username="user" password="Password" defaultMaxActive="20"
defaultMaxIdle="5" defaultMaxWait="10000"

removeAbandonedTimeout="300" testOnBorrow="false" removeAbandoned="true"
logAbandoned="true"/>

Please advice whether there is any limit on the datasources to be
configured when we set the credentials from the application.There is no
issue when I have the credentials as part of the Resource. Please advice
whether the fix is already provided or it should be handled in different
way.

Thanks
Vinoth

Re: Given password did not match password used to create the PooledConnection when there is no change in password

Posted by Vinoth Raja <rb...@gmail.com>.
Hi Chris,

Yes. I could test with "tomcat-dbcp" library. There is issue in calling
getConnection with correct password.
"I store encrypted password and decrypt the password before calling
getConnection."encrypted password was used to create connection when there
is more requests"
variable "password" was declared as global variable in ConnectionManager
class.Hence the encrypted value is updated before calling getConnection
when there is more request"

Thanks for the advice!

Thanks
Vinoth

On Mon, Feb 16, 2015 at 12:27 AM, Vinoth Raja <rb...@gmail.com> wrote:

> Hi,
>
> I have downloaded tomcat source but couldn't find this dbcp package under
> "org.apache.tomcat".
>
> I have figured out when it happens.
>
> I have a class "ConnectionManager" which is called to get the connection
> object.
>
> It is singleton class and I call the below method to get the object
> public static ConnectionManager getInstance() {
>
> if (objConnectionManager == null)
> objConnectionManager = new ConnectionManager();
>
> return objConnectionManager;
> }
>
>
> Here is the method which is called to get the connection object and return
> it
>
> // This is original method to get DataSource.
> public Connection getDataSource(String dnis) {
>
> Connection connection = null;
> if (!initialized)
> createContext();
> try {
> .....
>                       objDataSource = (DataSource)
> envContext.lookup(dataSourceName);
> try {
> connection = objDataSource.getConnection(userName, password);
> } catch (SQLException e) {
> objLogger.error("[" + ucid + "]"
> + "SQLException in connection manager: "
> + e.getMessage());
> }
>
> } catch (NamingException e) {
> objLogger.info("[" + ucid + "]"
> + "NamingException in connection manager: "
> + e.getMessage());
> e.printStackTrace();
> }
> return connection;
> }
>
> This issue happens when this class is accessed through singleton object.
> It doesn't happen when do one of the following:
> 1) make the method as synchronized.
> or
> 2) remove singleton and initialize an object for every request for
> ConnectionManager.
>
> I could reproduce it by keeping two datasource and sending simultaneous
> request to both the datasource using singleton ConnectionManager.
>
> Please advice what could be the reason.
> I have verified the SQL log when this incident happens it throws Login
> failed for user "". Reason: "Password didn't match that for login provided".
>
> Please advice whether singleton object can't be used when using multiple
> datasources.
>
> Thanks
> Vinoth
>
> On Thu, Feb 12, 2015 at 12:09 AM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Vinoth,
>>
>> On 2/10/15 10:03 PM, Vinoth Raja wrote:
>> > Thanks for the quick response.
>> >
>> > Please find the stack trace. This happens when there is more
>> > requests. I could reproduce it by loading more concurrent request
>> > All datasources called with same username/password. 4 datasources
>> > are called at a time by 4 different application.
>>
>> This is a little confusing:
>>
>> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
>> > ionFilterChain.java:208) at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
>>
>> I
>> >
>> think something has been cut-off, here.
>>
>> > at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
>> >
>> >
>> at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
>> > at
>> > com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:116)
>> >
>> >
>> at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
>> > at
>> > com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
>> >
>> >
>> at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
>> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
>> > javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> >
>> >
>> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> > at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
>> >
>> >
>> at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
>> > at com.avaya.sce.runtime.Data.handleRequest(Data.java:153) at
>> > com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
>> >
>> >
>> at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
>> > at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182) at
>> > javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
>> > javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> >
>> >
>> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> > at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>> >
>> >
>> at
>> >
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
>> >
>> >
>> at
>> >
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
>> >
>> >
>> at
>> >
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
>> >
>> >
>> at
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
>> > at
>> >
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>> >
>> >
>> at
>> >
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
>> >
>> >
>> at
>> >
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
>> >
>> >
>> at
>> >
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
>> >
>> >
>> at
>> >
>> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
>> >
>> >
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>> > Source) at
>> >
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>> >
>> >
>> at java.lang.Thread.run(Unknown Source)
>> > java.sql.SQLException: Given password did not match password used
>> > to create the PooledConnection. at
>> >
>> org.apache.tomcat.dbcp.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:723)
>> >
>> >
>> at
>> >
>> com.avaya.aps.sca.selfservice.dm.ConnectionManager.getDataSource(ConnectionManager.java:101)
>> >
>> >
>> at
>> >
>> com.avaya.aps.sca.selfservice.InteractionFlowServiceDaoImpl.getTransitionMapDetail(InteractionFlowServiceDaoImpl.java:241)
>>
>> What
>> >
>> code is being called, here in DBCP? You are calling the
>> getConnection method that accepts a username and password. Are you
>> sure you are not changing the password?
>>
>> The code in that area looks like this:
>>
>>  if (!(null == password ? null == info.getPassword()
>> 717     : password.equals(info.getPassword()))) { // Password on
>> PooledConnectionAndInfo does not match
>> 718     try { // See if password has changed by attempting connection
>> 719     testCPDS(username, password);
>> 720     } catch (SQLException ex) {
>> 721     // Password has not changed, so refuse client, but return
>> connection to the pool
>> 722     closeDueToException(info);
>> 723     throw new SQLException("Given password did not match password
>> used"
>> 724     + " to create the PooledConnection.");
>> 725     } catch (javax.naming.NamingException ne) {
>> 726     throw (SQLException) new SQLException(
>> 727     "NamingException encountered connecting to
>> database").initCause(ne);
>> 728     }
>> 729
>>
>> It's possible that a SQLException is occurring that does not represent
>> a password problem, but it's being interpreted as such.
>>
>> I checked, and DBCP 2.0 does the same thing: it swallows the
>> SQLException so you'll never know what really happened.
>>
>> It's possible that, in testCPDS, you are running across this:
>>
>> 819     if (ds instanceof ConnectionPoolDataSource) {
>> 820     cpds = (ConnectionPoolDataSource) ds;
>> 821     } else {
>> 822     throw new SQLException("Illegal configuration: "
>> 823     + "DataSource " + dataSourceName
>> 824     + " (" + ds.getClass().getName() + ")"
>> 825     + " doesn't implement javax.sql.ConnectionPoolDataSource");
>> 826     }
>>
>> Can you put a breakpoint in testCBDS and see what happens to these
>> connections?
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1
>> Comment: GPGTools - http://gpgtools.org
>>
>> iQIcBAEBCAAGBQJU237WAAoJEBzwKT+lPKRYkLwP/AkNISPIG6FDjkzZN2Pp7R/y
>> zcbyOQLVjiVXvK/hsGdv6Brf/KPTMBaljE7NQ7y/l26BSz5FM2jPkh7iqa91TMB7
>> SjZ0vWXDqDGp1VpNz8EAP63hajsbVzHS4RuFCGHQFDpAFUfPqx/eRkEQm+fMMHj0
>> 8wmEicD4XvrCNvNITSkUW02bkG4Ii14ggJWz4Fix7e6aVq2FivEsDXUao5ma27IX
>> QuYxseBFKHqQ8hrTbB74wvB4IIFpveEZmS2vNIL4rKVbXclbmseuwtj8nTyEqNSa
>> 1rzcYwhg1jndUbCcZS7POQq+vGcs6mJNplyleR7aSotR1G7ApZ3hMCN68TIuWYzq
>> Vg7/5xUg1oMaGxuxiXPUMwKLT7KfA1ATTIhk8rSPATMEEGc8l8a+azHtLuf9ebqv
>> fXTU0bdYWL+D0tkDi7Pg9hA47Jm2wK3j0yMgsyv31wIRLLYkHwVwoo/ZiYcWOH/y
>> 3H6fXuGB1obX75KR/dAdUL2BrVb7yxBBrILf3sjRIk2gtNk2KikE06gtCU178oct
>> 5Q7XMmhbxmiRYlo+M1h8gWKcGwE40dH9jrqD3I8mvCipIXSZTbI3Tn1m0xOdn8RT
>> DhDpEFc7L1BoCjjnElC5W9ukFFtpsRgDVN12AsCAoPldbbYH4IDvuQPPGgdL1GnQ
>> gphexbRn5miaGnJbpMa1
>> =AyHt
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: Given password did not match password used to create the PooledConnection when there is no change in password

Posted by Vinoth Raja <rb...@gmail.com>.
Hi,

I have downloaded tomcat source but couldn't find this dbcp package under
"org.apache.tomcat".

I have figured out when it happens.

I have a class "ConnectionManager" which is called to get the connection
object.

It is singleton class and I call the below method to get the object
public static ConnectionManager getInstance() {

if (objConnectionManager == null)
objConnectionManager = new ConnectionManager();

return objConnectionManager;
}


Here is the method which is called to get the connection object and return
it

// This is original method to get DataSource.
public Connection getDataSource(String dnis) {

Connection connection = null;
if (!initialized)
createContext();
try {
.....
                      objDataSource = (DataSource)
envContext.lookup(dataSourceName);
try {
connection = objDataSource.getConnection(userName, password);
} catch (SQLException e) {
objLogger.error("[" + ucid + "]"
+ "SQLException in connection manager: "
+ e.getMessage());
}

} catch (NamingException e) {
objLogger.info("[" + ucid + "]"
+ "NamingException in connection manager: "
+ e.getMessage());
e.printStackTrace();
}
return connection;
}

This issue happens when this class is accessed through singleton object.
It doesn't happen when do one of the following:
1) make the method as synchronized.
or
2) remove singleton and initialize an object for every request for
ConnectionManager.

I could reproduce it by keeping two datasource and sending simultaneous
request to both the datasource using singleton ConnectionManager.

Please advice what could be the reason.
I have verified the SQL log when this incident happens it throws Login
failed for user "". Reason: "Password didn't match that for login provided".

Please advice whether singleton object can't be used when using multiple
datasources.

Thanks
Vinoth

On Thu, Feb 12, 2015 at 12:09 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Vinoth,
>
> On 2/10/15 10:03 PM, Vinoth Raja wrote:
> > Thanks for the quick response.
> >
> > Please find the stack trace. This happens when there is more
> > requests. I could reproduce it by loading more concurrent request
> > All datasources called with same username/password. 4 datasources
> > are called at a time by 4 different application.
>
> This is a little confusing:
>
> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> > ionFilterChain.java:208) at
> >
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
>
> I
> >
> think something has been cut-off, here.
>
> > at
> >
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
> >
> >
> at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
> > at
> > com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:116)
> >
> >
> at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
> > at
> > com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
> >
> >
> at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> >
> >
> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
> >
> >
> at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
> > at com.avaya.sce.runtime.Data.handleRequest(Data.java:153) at
> > com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
> >
> >
> at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
> > at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182) at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> >
> >
> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> >
> >
> at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> >
> >
> at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
> >
> >
> at
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
> >
> >
> at
> >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
> >
> >
> at
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
> >
> >
> at
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
> >
> >
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
> > at
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
> >
> >
> at
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
> >
> >
> at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
> >
> >
> at
> >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
> >
> >
> at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
> >
> >
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> > Source) at
> >
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >
> >
> at java.lang.Thread.run(Unknown Source)
> > java.sql.SQLException: Given password did not match password used
> > to create the PooledConnection. at
> >
> org.apache.tomcat.dbcp.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:723)
> >
> >
> at
> >
> com.avaya.aps.sca.selfservice.dm.ConnectionManager.getDataSource(ConnectionManager.java:101)
> >
> >
> at
> >
> com.avaya.aps.sca.selfservice.InteractionFlowServiceDaoImpl.getTransitionMapDetail(InteractionFlowServiceDaoImpl.java:241)
>
> What
> >
> code is being called, here in DBCP? You are calling the
> getConnection method that accepts a username and password. Are you
> sure you are not changing the password?
>
> The code in that area looks like this:
>
>  if (!(null == password ? null == info.getPassword()
> 717     : password.equals(info.getPassword()))) { // Password on
> PooledConnectionAndInfo does not match
> 718     try { // See if password has changed by attempting connection
> 719     testCPDS(username, password);
> 720     } catch (SQLException ex) {
> 721     // Password has not changed, so refuse client, but return
> connection to the pool
> 722     closeDueToException(info);
> 723     throw new SQLException("Given password did not match password used"
> 724     + " to create the PooledConnection.");
> 725     } catch (javax.naming.NamingException ne) {
> 726     throw (SQLException) new SQLException(
> 727     "NamingException encountered connecting to
> database").initCause(ne);
> 728     }
> 729
>
> It's possible that a SQLException is occurring that does not represent
> a password problem, but it's being interpreted as such.
>
> I checked, and DBCP 2.0 does the same thing: it swallows the
> SQLException so you'll never know what really happened.
>
> It's possible that, in testCPDS, you are running across this:
>
> 819     if (ds instanceof ConnectionPoolDataSource) {
> 820     cpds = (ConnectionPoolDataSource) ds;
> 821     } else {
> 822     throw new SQLException("Illegal configuration: "
> 823     + "DataSource " + dataSourceName
> 824     + " (" + ds.getClass().getName() + ")"
> 825     + " doesn't implement javax.sql.ConnectionPoolDataSource");
> 826     }
>
> Can you put a breakpoint in testCBDS and see what happens to these
> connections?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJU237WAAoJEBzwKT+lPKRYkLwP/AkNISPIG6FDjkzZN2Pp7R/y
> zcbyOQLVjiVXvK/hsGdv6Brf/KPTMBaljE7NQ7y/l26BSz5FM2jPkh7iqa91TMB7
> SjZ0vWXDqDGp1VpNz8EAP63hajsbVzHS4RuFCGHQFDpAFUfPqx/eRkEQm+fMMHj0
> 8wmEicD4XvrCNvNITSkUW02bkG4Ii14ggJWz4Fix7e6aVq2FivEsDXUao5ma27IX
> QuYxseBFKHqQ8hrTbB74wvB4IIFpveEZmS2vNIL4rKVbXclbmseuwtj8nTyEqNSa
> 1rzcYwhg1jndUbCcZS7POQq+vGcs6mJNplyleR7aSotR1G7ApZ3hMCN68TIuWYzq
> Vg7/5xUg1oMaGxuxiXPUMwKLT7KfA1ATTIhk8rSPATMEEGc8l8a+azHtLuf9ebqv
> fXTU0bdYWL+D0tkDi7Pg9hA47Jm2wK3j0yMgsyv31wIRLLYkHwVwoo/ZiYcWOH/y
> 3H6fXuGB1obX75KR/dAdUL2BrVb7yxBBrILf3sjRIk2gtNk2KikE06gtCU178oct
> 5Q7XMmhbxmiRYlo+M1h8gWKcGwE40dH9jrqD3I8mvCipIXSZTbI3Tn1m0xOdn8RT
> DhDpEFc7L1BoCjjnElC5W9ukFFtpsRgDVN12AsCAoPldbbYH4IDvuQPPGgdL1GnQ
> gphexbRn5miaGnJbpMa1
> =AyHt
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Given password did not match password used to create the PooledConnection when there is no change in password

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Vinoth,

On 2/10/15 10:03 PM, Vinoth Raja wrote:
> Thanks for the quick response.
> 
> Please find the stack trace. This happens when there is more
> requests. I could reproduce it by loading more concurrent request 
> All datasources called with same username/password. 4 datasources
> are called at a time by 4 different application.

This is a little confusing:

> INFO: Stopping ProtocolHandler ["ajp-bio-8009"] 
> ionFilterChain.java:208) at 
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)

I
> 
think something has been cut-off, here.

> at 
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
>
> 
at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
>
> 
at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
>
> 
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
> at
> com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:116)
>
> 
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
> at
> com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
>
> 
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>
> 
at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>
> 
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>
> 
at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>
> 
at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
>
> 
at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
>
> 
at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
>
> 
at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
>
> 
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
> at com.avaya.sce.runtime.Data.handleRequest(Data.java:153) at
> com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
>
> 
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
> at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>
> 
at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>
> 
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>
> 
at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>
> 
at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>
> 
at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>
> 
at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
>
> 
at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
>
> 
at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
>
> 
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
> at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>
> 
at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
>
> 
at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
>
> 
at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
>
> 
at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
>
> 
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source) at 
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>
> 
at java.lang.Thread.run(Unknown Source)
> java.sql.SQLException: Given password did not match password used
> to create the PooledConnection. at 
> org.apache.tomcat.dbcp.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:723)
>
> 
at
> com.avaya.aps.sca.selfservice.dm.ConnectionManager.getDataSource(ConnectionManager.java:101)
>
> 
at
> com.avaya.aps.sca.selfservice.InteractionFlowServiceDaoImpl.getTransitionMapDetail(InteractionFlowServiceDaoImpl.java:241)

What
> 
code is being called, here in DBCP? You are calling the
getConnection method that accepts a username and password. Are you
sure you are not changing the password?

The code in that area looks like this:

 if (!(null == password ? null == info.getPassword()
717 	: password.equals(info.getPassword()))) { // Password on
PooledConnectionAndInfo does not match
718 	try { // See if password has changed by attempting connection
719 	testCPDS(username, password);
720 	} catch (SQLException ex) {
721 	// Password has not changed, so refuse client, but return
connection to the pool
722 	closeDueToException(info);
723 	throw new SQLException("Given password did not match password used"
724 	+ " to create the PooledConnection.");
725 	} catch (javax.naming.NamingException ne) {
726 	throw (SQLException) new SQLException(
727 	"NamingException encountered connecting to database").initCause(ne);
728 	}
729 	

It's possible that a SQLException is occurring that does not represent
a password problem, but it's being interpreted as such.

I checked, and DBCP 2.0 does the same thing: it swallows the
SQLException so you'll never know what really happened.

It's possible that, in testCPDS, you are running across this:

819 	if (ds instanceof ConnectionPoolDataSource) {
820 	cpds = (ConnectionPoolDataSource) ds;
821 	} else {
822 	throw new SQLException("Illegal configuration: "
823 	+ "DataSource " + dataSourceName
824 	+ " (" + ds.getClass().getName() + ")"
825 	+ " doesn't implement javax.sql.ConnectionPoolDataSource");
826 	}

Can you put a breakpoint in testCBDS and see what happens to these
connections?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU237WAAoJEBzwKT+lPKRYkLwP/AkNISPIG6FDjkzZN2Pp7R/y
zcbyOQLVjiVXvK/hsGdv6Brf/KPTMBaljE7NQ7y/l26BSz5FM2jPkh7iqa91TMB7
SjZ0vWXDqDGp1VpNz8EAP63hajsbVzHS4RuFCGHQFDpAFUfPqx/eRkEQm+fMMHj0
8wmEicD4XvrCNvNITSkUW02bkG4Ii14ggJWz4Fix7e6aVq2FivEsDXUao5ma27IX
QuYxseBFKHqQ8hrTbB74wvB4IIFpveEZmS2vNIL4rKVbXclbmseuwtj8nTyEqNSa
1rzcYwhg1jndUbCcZS7POQq+vGcs6mJNplyleR7aSotR1G7ApZ3hMCN68TIuWYzq
Vg7/5xUg1oMaGxuxiXPUMwKLT7KfA1ATTIhk8rSPATMEEGc8l8a+azHtLuf9ebqv
fXTU0bdYWL+D0tkDi7Pg9hA47Jm2wK3j0yMgsyv31wIRLLYkHwVwoo/ZiYcWOH/y
3H6fXuGB1obX75KR/dAdUL2BrVb7yxBBrILf3sjRIk2gtNk2KikE06gtCU178oct
5Q7XMmhbxmiRYlo+M1h8gWKcGwE40dH9jrqD3I8mvCipIXSZTbI3Tn1m0xOdn8RT
DhDpEFc7L1BoCjjnElC5W9ukFFtpsRgDVN12AsCAoPldbbYH4IDvuQPPGgdL1GnQ
gphexbRn5miaGnJbpMa1
=AyHt
-----END PGP SIGNATURE-----

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


Re: Given password did not match password used to create the PooledConnection when there is no change in password

Posted by Vinoth Raja <rb...@gmail.com>.
Hi Chris,

Thanks for the quick response.

Please find the stack trace. This happens when there is more requests.
I could reproduce it by loading more concurrent request
All datasources called with same username/password. 4 datasources are
called at a time by 4 different application.

INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
ionFilterChain.java:208)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
at com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:116)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
at com.avaya.sce.runtime.Data.handleRequest(Data.java:153)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
java.sql.SQLException: Given password did not match password used to create
the PooledConnection.
at
org.apache.tomcat.dbcp.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:723)
at
com.avaya.aps.sca.selfservice.dm.ConnectionManager.getDataSource(ConnectionManager.java:101)
at
com.avaya.aps.sca.selfservice.InteractionFlowServiceDaoImpl.getTransitionMapDetail(InteractionFlowServiceDaoImpl.java:241)
at
com.avaya.aps.sca.selfservice.businesservice.impl.InteractionFlowServiceImpl.getTransitionMapDetail(InteractionFlowServiceImpl.java:154)
at flow.GetDialogState.servletImplementation(GetDialogState.java:81)
at com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:99)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
at com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:116)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
at com.avaya.sce.runtime.Data.handleRequest(Data.java:153)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
java.sql.SQLException: Given password did not match password used to create
the PooledConnection.
at
org.apache.tomcat.dbcp.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:723)
at
com.avaya.aps.sca.selfservice.dm.ConnectionManager.getDataSource(ConnectionManager.java:101)
at
com.avaya.aps.sca.selfservice.InteractionFlowServiceDaoImpl.getDnisContext(InteractionFlowServiceDaoImpl.java:61)
at
com.avaya.aps.sca.selfservice.businesservice.impl.InteractionFlowServiceImpl.getDnisContext(InteractionFlowServiceImpl.java:55)
at flow.GetDnisContext.servletImplementation(GetDnisContext.java:65)
at com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:99)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.avaya.sce.runtime.SCEServlet.forward(SCEServlet.java:1356)
at com.avaya.sce.runtime.Data.handleRequest(Data.java:153)
at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
at com.avaya.sce.runtime.SCEServlet.requestHandler(SCEServlet.java:285)
at com.avaya.sce.runtime.SCEServlet.doGet(SCEServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)



Thanks
Vinoth

On Wed, Feb 11, 2015 at 3:36 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Vinoth,
>
> On 2/10/15 11:57 AM, Vinoth Raja wrote:
> > Environment used: - Tomcat 7.0.57 - Windows - Java 1.7 - MS SQL
> > 2008.
> >
> > Issue:"Given password did not match password used to create the
> > PooledConnection"
>
> Stack trace?
>
> - -chris
>
> > There is no change in the password from the day application went
> > live.But it happens when there is more request.
> >
> > Background on the logic : We have five different business
> > application deployed on tomcat. There is different DB instance for
> > each business. 5 primary DB instances and 5 secondary DB
> > instances. I have configured total 10 datasource in tomcat
> > context.xml. username/password it passed in
> > getConnection(username,password ) to get the connection object. I
> > have posted the query in stackoverflow and the recommendation was
> > to update the library.Not sure whether to update the higher version
> > library.
> >
> >
> > Datasource and Application Logic:
> >
> > I have configured 10 datasources like the below
> >
> > <Resource auth="Container"
> > driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > factory="org.apache.tomcat.dbcp.dbcp.cpdsadapter.DriverAdapterCPDS"
> >
> >
> name="jdbc/CDBCPDS"
> > type="org.apache.tomcat.dbcp.dbcp.cpdsadapter.DriverAdapterCPDS"
> > url="jdbc:sqlserver://10.200.100.8:1433;DatabaseName=SNECDB"/>
> > <Resource auth="Container"
> > dataSourceName="java:/comp/env/jdbc/CDBCPDS" defaultMaxActive="20"
> > defaultMaxIdle="5" defaultMaxWait="10000"
> >
> factory="org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSourceFactory"
> >
> >
> logAbandoned="true" name="jdbc/CDB" removeAbandoned="true"
> > removeAbandonedTimeout="300" testOnBorrow="true"
> > testWhileIdle="true" timeBetweenEvictionRunsMillis="60000"
> > type="org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSource"
> >
> >
> validationQuery="select 1"/>
> >
> > Here is the java application which retrieves the connection
> > object.
> >
> > try {
> >
> > dataSourceName = "jdbc/".concat(GetConfigurationDetails
> > .get("cmm.datasource.db2." + dnis)); userName =
> > GetConfigurationDetails.get("cmm.username.db2"); password =
> > GetConfigurationDetails.get("cmm.password.db2"); if
> > (objLogger.isDebugEnabled()) objLogger.debug("[" + ucid + "]
> > dataSourceName: " + dataSourceName);
> >
> > objDataSource = (DataSource) envContext.lookup(dataSourceName); try
> > { connection = objDataSource.getConnection(userName, password); }
> > catch (SQLException e) { objLogger.error("[" + ucid + "]" +
> > "SQLException in connection manager: " + e.getMessage()); }
> >
> > } catch (NamingException e) { objLogger.info("[" + ucid + "]" +
> > "NamingException in connection manager: " + e.getMessage());
> > e.printStackTrace(); }
> >
> > Background on findings:
> >
> > - There was patch to fix "when changes his/her password, the
> > entire connection pool must be restarted for DBCP to recognize the
> > new password". It is not the case  with me as there is no change in
> > the password. - Stack Overflow recommendation to update the
> > library. Not sure whether to use the library from tomcat 7.0.59 - I
> > have modified the Resource to have username/password details and
> > this issue doesn't happen. <Resource name="jdbc/SHPDB"
> > auth="Container" type="javax.sql.DataSource"
> > driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > url="jdbc:sqlserver://10.200.100.8:1433;DatabaseName=SHPDB"
> > username="user" password="Password" defaultMaxActive="20"
> > defaultMaxIdle="5" defaultMaxWait="10000"
> >
> > removeAbandonedTimeout="300" testOnBorrow="false"
> > removeAbandoned="true" logAbandoned="true"/>
> >
> > Please advice whether there is any limit on the datasources to be
> > configured when we set the credentials from the application.There
> > is no issue when I have the credentials as part of the Resource.
> > Please advice whether the fix is already provided or it should be
> > handled in different way.
> >
> > Thanks Vinoth
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJU2l2hAAoJEBzwKT+lPKRYca0P/RuQ2HqxkoQLZ9sU7PJrqWIS
> jV0WOLSpHq+IWx+HnEYWZcUaZs2nB/MfCP1L3a3vSq+uc+6zmThG/jV2yIH62VAb
> uiXprzepMPIm8nB3W6md/wWRBtej/GaYTlC2oMxRODpWT9EDhberWAH4hC724zpC
> NGHCtEv722l80zZj8FnWT9WKZGs0LPgvzI+Mo2bmU8Q4QEJPZ2RbuPiutWk51Nub
> kKlIwn1DIQK0Bi7HsjRpgyt4LbeSgYQyaS+q3sOKGjV3ZjnQX9JaeGbNvW3RtXl+
> 09l73Qkf3uhOUP+zmGSbCBYJ2HSz3x5nKicJxWbmODuhxWk7ZUrtGkKCIxd+Wdxe
> 8oM8aoN4iU7TnZNxg62GQtQs25sokTml2jFbjxiaSPP2ViiuX1F/nstGGm5KjGJm
> XkhrOfwj+mEXvXNWXQCHpn8okvA8kx4lJKcyQhOTrE642AMIkLqiNn17RG078o/u
> N8G/a5KCnlmZYOurqOoi/ndCEbRXR+l3nB1jeszu2kP/MGUyMSIejEyEtsBHHKvW
> J3uApMK63O5dQW9F6uvvG+9RAgH3cFKBv1bXUPTjjpCnD0JFmgWsdm9rMC3Woyj0
> b4H+UhD9DHqWSHqJIfe61K3K7NhcTYepER7fKwyyW2WO42MUE1VEwPiKBqM0SK7M
> Y69T4DBGcRbmrHkZcraf
> =nxph
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Given password did not match password used to create the PooledConnection when there is no change in password

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Vinoth,

On 2/10/15 11:57 AM, Vinoth Raja wrote:
> Environment used: - Tomcat 7.0.57 - Windows - Java 1.7 - MS SQL
> 2008.
> 
> Issue:"Given password did not match password used to create the 
> PooledConnection"

Stack trace?

- -chris

> There is no change in the password from the day application went 
> live.But it happens when there is more request.
> 
> Background on the logic : We have five different business
> application deployed on tomcat. There is different DB instance for
> each business. 5 primary DB instances and 5 secondary DB
> instances. I have configured total 10 datasource in tomcat
> context.xml. username/password it passed in
> getConnection(username,password ) to get the connection object. I
> have posted the query in stackoverflow and the recommendation was 
> to update the library.Not sure whether to update the higher version
> library.
> 
> 
> Datasource and Application Logic:
> 
> I have configured 10 datasources like the below
> 
> <Resource auth="Container" 
> driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> factory="org.apache.tomcat.dbcp.dbcp.cpdsadapter.DriverAdapterCPDS"
>
> 
name="jdbc/CDBCPDS"
> type="org.apache.tomcat.dbcp.dbcp.cpdsadapter.DriverAdapterCPDS" 
> url="jdbc:sqlserver://10.200.100.8:1433;DatabaseName=SNECDB"/> 
> <Resource auth="Container" 
> dataSourceName="java:/comp/env/jdbc/CDBCPDS" defaultMaxActive="20"
> defaultMaxIdle="5" defaultMaxWait="10000" 
> factory="org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSourceFactory"
>
> 
logAbandoned="true" name="jdbc/CDB" removeAbandoned="true"
> removeAbandonedTimeout="300" testOnBorrow="true"
> testWhileIdle="true" timeBetweenEvictionRunsMillis="60000" 
> type="org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSource"
>
> 
validationQuery="select 1"/>
> 
> Here is the java application which retrieves the connection
> object.
> 
> try {
> 
> dataSourceName = "jdbc/".concat(GetConfigurationDetails 
> .get("cmm.datasource.db2." + dnis)); userName =
> GetConfigurationDetails.get("cmm.username.db2"); password =
> GetConfigurationDetails.get("cmm.password.db2"); if
> (objLogger.isDebugEnabled()) objLogger.debug("[" + ucid + "]
> dataSourceName: " + dataSourceName);
> 
> objDataSource = (DataSource) envContext.lookup(dataSourceName); try
> { connection = objDataSource.getConnection(userName, password); }
> catch (SQLException e) { objLogger.error("[" + ucid + "]" +
> "SQLException in connection manager: " + e.getMessage()); }
> 
> } catch (NamingException e) { objLogger.info("[" + ucid + "]" +
> "NamingException in connection manager: " + e.getMessage()); 
> e.printStackTrace(); }
> 
> Background on findings:
> 
> - There was patch to fix "when changes his/her password, the
> entire connection pool must be restarted for DBCP to recognize the
> new password". It is not the case  with me as there is no change in
> the password. - Stack Overflow recommendation to update the
> library. Not sure whether to use the library from tomcat 7.0.59 - I
> have modified the Resource to have username/password details and 
> this issue doesn't happen. <Resource name="jdbc/SHPDB"
> auth="Container" type="javax.sql.DataSource" 
> driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> url="jdbc:sqlserver://10.200.100.8:1433;DatabaseName=SHPDB" 
> username="user" password="Password" defaultMaxActive="20" 
> defaultMaxIdle="5" defaultMaxWait="10000"
> 
> removeAbandonedTimeout="300" testOnBorrow="false"
> removeAbandoned="true" logAbandoned="true"/>
> 
> Please advice whether there is any limit on the datasources to be 
> configured when we set the credentials from the application.There
> is no issue when I have the credentials as part of the Resource.
> Please advice whether the fix is already provided or it should be
> handled in different way.
> 
> Thanks Vinoth
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU2l2hAAoJEBzwKT+lPKRYca0P/RuQ2HqxkoQLZ9sU7PJrqWIS
jV0WOLSpHq+IWx+HnEYWZcUaZs2nB/MfCP1L3a3vSq+uc+6zmThG/jV2yIH62VAb
uiXprzepMPIm8nB3W6md/wWRBtej/GaYTlC2oMxRODpWT9EDhberWAH4hC724zpC
NGHCtEv722l80zZj8FnWT9WKZGs0LPgvzI+Mo2bmU8Q4QEJPZ2RbuPiutWk51Nub
kKlIwn1DIQK0Bi7HsjRpgyt4LbeSgYQyaS+q3sOKGjV3ZjnQX9JaeGbNvW3RtXl+
09l73Qkf3uhOUP+zmGSbCBYJ2HSz3x5nKicJxWbmODuhxWk7ZUrtGkKCIxd+Wdxe
8oM8aoN4iU7TnZNxg62GQtQs25sokTml2jFbjxiaSPP2ViiuX1F/nstGGm5KjGJm
XkhrOfwj+mEXvXNWXQCHpn8okvA8kx4lJKcyQhOTrE642AMIkLqiNn17RG078o/u
N8G/a5KCnlmZYOurqOoi/ndCEbRXR+l3nB1jeszu2kP/MGUyMSIejEyEtsBHHKvW
J3uApMK63O5dQW9F6uvvG+9RAgH3cFKBv1bXUPTjjpCnD0JFmgWsdm9rMC3Woyj0
b4H+UhD9DHqWSHqJIfe61K3K7NhcTYepER7fKwyyW2WO42MUE1VEwPiKBqM0SK7M
Y69T4DBGcRbmrHkZcraf
=nxph
-----END PGP SIGNATURE-----

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