Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 11CC7B5DD08 for ; Wed, 10 Aug 2011 15:04:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 79973-01-9 for ; Wed, 10 Aug 2011 18:04:46 +0000 (UTC) X-Greylist: delayed 00:15:46.278176 by SQLgrey-1.7.6 Received: from cpanelsmarthost1.zen.co.uk (cpanelsmarthost1.zen.co.uk [82.71.204.225]) by mail.postgresql.org (Postfix) with ESMTP id 93AB9B5DF73 for ; Wed, 10 Aug 2011 14:59:50 -0300 (ADT) Received: from [88.98.24.71] (helo=shcp03.hosting.zen.net.uk) by cpanelsmarthost1.zen.co.uk with esmtp (Exim 4.69) (envelope-from ) id 1QrCp0-0008Tg-7u for pgsql-jdbc@postgresql.org; Wed, 10 Aug 2011 17:44:02 +0000 Received: from [212.135.39.5] (helo=[62.185.32.161]) by shcp03.hosting.zen.net.uk with esmtpa (Exim 4.69) (envelope-from ) id 1QrCou-0001LR-FQ for pgsql-jdbc@postgresql.org; Wed, 10 Aug 2011 18:43:56 +0100 Message-ID: <4E42C3A9.80409@ahastie.net> Date: Wed, 10 Aug 2011 18:45:13 +0100 From: Andrew Hastie User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Cannot create PoolableConnectionFactory (The connection attempt failed.) References: <34e79221191a14cc34765d519243eeab@mail.softperience.eu> <004836884de8429682df2eac29aa0548@mail.softperience.eu> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - shcp03.hosting.zen.net.uk X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - ahastie.net X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201108/35 X-Sequence-Number: 22067 Hi, I think your problem is how you are declaring your "resource". The class "org.postgresql.Driver" does notimplement the "javax.sql.DataSource" interface. If you're using the DataSource interface (I'm guessing in an Application Server connection pool declaration) then you need to specify the driverClassName as follows:- Non-pooled connection = org.postgresql.ds.PGSimpleDataSource Pooled connection = org.postgresql.ds.PGPoolingDataSource XA Connection = org.postgresql.xa.PGXADataSource At least this is how I'm defining my connections to Postgres using a Glassfish V3 App Server. Andrew On 10/08/11 18:37, Dave Cramer wrote: > Looking at your stack trace it looks like the ultimate culprit is > "invalid argument" but your connection string looks OK. Can you try a > simple java connection without tomcat? > > Dave Cramer > > dave.cramer(at)credativ(dot)ca > http://www.credativ.ca > > > > > On Wed, Aug 10, 2011 at 12:48 PM, Alex Nordlund > wrote: >> Hi, >> >> Same result with 127.0.0.1 >> >> 2011-08-10 13:14:30,615 main ERROR >> [org.hibernate.util.JDBCExceptionReporter] Cannot create >> PoolableConnectionFactory (The connection attempt failed.) >> 2011-08-10 13:14:30,618 main WARN [org.hibernate.cfg.SettingsFactory] >> Could not obtain connection metadata >> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create >> PoolableConnectionFactory (The connection attempt failed.) >> [snip 60 lines] >> Caused by: org.postgresql.util.PSQLException: The connection attempt failed. >> >> With risk for looping (my eyes are tired and do not easily spot where >> the log ends) I have the full log here. >> http://dpaste.org/6O5d/ >> >> >> --- >> //Alex >> >> >> >> On Wed, Aug 10, 2011 at 5:31 PM, Radosław Smogura >> wrote: >>> So it's harder topic, >>> - try to replace localhost with 127.0.0.1 >>> I don't know why You don't have (didn't send) PostgreSQL exception, try to >>> connect to server with simple servlet, using old fashioned JNDI, check >>> hibernate configuration. >>> >>> It's hard to see if You have passed wrong JNDI name, you have no driver in >>> classpath, or it's PostgreSQL exception. Send full backtrace of error. >>> >>> Regards >>> >>> On Wed, 10 Aug 2011 17:19:13 +0100, Alex Nordlund wrote: >>>> Hi Radoslaw, >>>> >>>> Thank you for your reply. >>>> >>>> I can confirm that with psql --host=127.0.0.1 it works, however it >>>> still does not work with jdbc. >>>> --- >>>> //Alex >>>> >>>> >>>> >>>> On Wed, Aug 10, 2011 at 5:13 PM, Radosław Smogura >>>> wrote: >>>>> Hi, >>>>> >>>>> Check your "access file" pga_hba.conf if it allows TCP/IP connections. By >>>>> default psql connects on Unix socket >>>>> try to connect using >>>>> psql --host=127.0.0.0.1 --port=5432 -U crowd crowdiddb >>>>> >>>>> I this fail You probably didn't exposed TCP/IP access (or You have >>>>> localhost >>>>> firewall?). >>>>> >>>>> Regards, >>>>> Radosław Smogura >>>>> >>>>> On Wed, 10 Aug 2011 13:53:59 +0100, Alex Nordlund wrote: >>>>>> Hi, >>>>>> >>>>>> I get the following errors: >>>>>> >>>>>> INFO: Deploying configuration descriptor openidserver.xml >>>>>> 2011-08-10 13:14:30,600 main WARN >>>>>> [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: >>>>>> null >>>>>> 2011-08-10 13:14:30,615 main ERROR >>>>>> [org.hibernate.util.JDBCExceptionReporter] Cannot create >>>>>> PoolableConnectionFactory (The connection attempt failed.) >>>>>> 2011-08-10 13:14:30,618 main WARN [org.hibernate.cfg.SettingsFactory] >>>>>> Could not obtain connection metadata >>>>>> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create >>>>>> PoolableConnectionFactory (The connection attempt failed. >>>>>> >>>>>> And my Resource looks like this: >>>>>> >>>>>> >>>>> type="javax.sql.DataSource" >>>>>> username="crowd" >>>>>> password="hiddenfortheml" >>>>>> driverClassName="org.postgresql.Driver" >>>>>> url="jdbc:postgresql://localhost:5432/crowdiddb" >>>>>> /> >>>>>> >>>>>> >>>>>> Am I doing something wrong? >>>>>> >>>>>> My username is crowd, it's set to only use MD5 auth, the DB is >>>>>> crowdiddb and I can access it using psql. >>>>>> >>>>>> --- >>>>>> //Alex >>>>> >>> >> -- >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-jdbc >>