{"action":"created","issue":{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/324","labels_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/324/comments","events_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/324/events","html_url":"https://github.com/brettwooldridge/HikariCP/issues/324","id":84513473,"number":324,"title":"Tomcat + JNDI strange behaviour","user":{"login":"jollyblade","id":814364,"avatar_url":"https://avatars.githubusercontent.com/u/814364?v=3","gravatar_id":"","url":"https://api.github.com/users/jollyblade","html_url":"https://github.com/jollyblade","followers_url":"https://api.github.com/users/jollyblade/followers","following_url":"https://api.github.com/users/jollyblade/following{/other_user}","gists_url":"https://api.github.com/users/jollyblade/gists{/gist_id}","starred_url":"https://api.github.com/users/jollyblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jollyblade/subscriptions","organizations_url":"https://api.github.com/users/jollyblade/orgs","repos_url":"https://api.github.com/users/jollyblade/repos","events_url":"https://api.github.com/users/jollyblade/events{/privacy}","received_events_url":"https://api.github.com/users/jollyblade/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-03T11:42:33Z","updated_at":"2015-06-04T15:55:01Z","closed_at":null,"body":"Hi, \r\n\r\nI have a strange problem that we could not solve until now, so we had to remove hikari from the configuration. (Using the latest hikari version).\r\n\r\nWe have two jndi datasources in the tomcat server.xml, as follows (I changed the usernames and passwords and all specific data):\r\n\r\n    <Resource name=\"jdbc/firstDataSource\" \r\n\t\t\tauth=\"Container\" \r\n\t\t\tfactory=\"com.zaxxer.hikari.HikariJNDIFactory\" \r\n\t\t\ttype=\"javax.sql.DataSource\"  \r\n\t\t\tdataSourceClassName=\"com.mysql.jdbc.jdbc2.optional.MysqlDataSource\"         \t\t  \r\n\t\t\tdriverClass=\"com.mysql.jdbc.Driver\"\r\n\t\t\tjdbcUrl=\"jdbc:mysql://localhost:3306/schema?autoReconnect=true\" \r\n\t\t\tminimumIdle=\"5\" maximumPoolSize=\"50\" connectionTimeout=\"300000\"\r\n\t\t\tmaxLifetime=\"1800000\" connectionTestQuery=\"SELECT 1 FROM DUAL\" \r\n\t\t\tdataSource.user=\"user1\" dataSource.password=\"pwd1\" />\r\n\r\n\t<Resource name=\"jdbc/secondDataSource\" \r\n\t\t\t  auth=\"Container\"\r\n\t\t\t  factory=\"com.zaxxer.hikari.HikariJNDIFactory\"\r\n\t\t\t  type=\"javax.sql.DataSource\"\r\n\t\t\t  dataSourceClassName=\"com.mysql.jdbc.jdbc2.optional.MysqlDataSource\"         \t\t  \r\n\t\t\t  driverClass=\"com.mysql.jdbc.Driver\"\r\n\t\t\t  jdbcUrl=\"jdbc:mysql://url2:3306/schema?autoReconnect=true\" \r\n\t\t\t  dataSource.user=\"user2\" \r\n\t\t\t  dataSource.password=\"pwd2\" \r\n\t\t\t  minimumIdle=\"5\" \r\n\t\t\t  maximumPoolSize=\"50\" \r\n\t\t\t  connectionTimeout=\"300000\" \r\n\t\t\t  maxLifetime=\"1800000\" \r\n\t\t\t  connectionTestQuery=\"SELECT 1 FROM DUAL\" />\r\n\r\nFirst, it did never work without the dataSourceClassName and driverClass properties, I had to add both. We had all the necessary libs under the tomcat lib. \r\n\r\nTo the real thing: it seems that the second connection pool definition overwrites the username/password for the first too. So it tries to connect to the first db using the username and password from the second definition, so I get the following error: \r\n\r\naccess denied for user1@localhost using password YES. \r\n\r\nIf i remove either one of the pool definitions, it works just nice. If I change the username/password to the same, then the other pool won't work, with the same error. \r\n\r\nSo this is really strange. \r\n\r\nDid anyone face the same issue?\r\n\r\nTried with:\r\n- HikariCP-2.2.5\r\n- HikariCP-2.3.8\r\n- javassist-3.18.1-GA\r\n- slf4j-api-1.7.10\r\n\r\nthanks, \r\nMarton\r\n"},"comment":{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/comments/108944739","html_url":"https://github.com/brettwooldridge/HikariCP/issues/324#issuecomment-108944739","issue_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/324","id":108944739,"user":{"login":"brettwooldridge","id":1538661,"avatar_url":"https://avatars.githubusercontent.com/u/1538661?v=3","gravatar_id":"","url":"https://api.github.com/users/brettwooldridge","html_url":"https://github.com/brettwooldridge","followers_url":"https://api.github.com/users/brettwooldridge/followers","following_url":"https://api.github.com/users/brettwooldridge/following{/other_user}","gists_url":"https://api.github.com/users/brettwooldridge/gists{/gist_id}","starred_url":"https://api.github.com/users/brettwooldridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettwooldridge/subscriptions","organizations_url":"https://api.github.com/users/brettwooldridge/orgs","repos_url":"https://api.github.com/users/brettwooldridge/repos","events_url":"https://api.github.com/users/brettwooldridge/events{/privacy}","received_events_url":"https://api.github.com/users/brettwooldridge/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T15:55:01Z","updated_at":"2015-06-04T15:55:01Z","body":"Regarding the issue of needing both ``dataSourceClassName`` and ``driverClass`` ... I'm not even sure\r\nhow the pool can start, because ``driverClass`` is not a valid property (``driverClassName`` would\r\nbe the correct property name).  HikariCP should throw an exception\r\n([from this method](https://github.com/brettwooldridge/HikariCP/blob/2.3.x/hikaricp-common/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java#L120)) during startup.\r\n\r\nAnyway, when using ``driverSourceClassName``, the ``jdbcUrl`` property is ignored.  What is happening is that both ``driverClass`` and ``dataSourceClassName`` are being ignored.  HikariCP is resolving the driver using the Java ``DriverManager`` based on the jdbcUrl alone."}}