X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 73D8111F65E2 for ; Sun, 9 Apr 2006 05:51:14 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 required=5 tests=[none] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id OLz87UdLawE5 for ; Sun, 9 Apr 2006 05:51:07 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-1.hut.fi (smtp-1.hut.fi [130.233.228.91]) by postgresql.org (Postfix) with ESMTP id EF8EA11F655E for ; Sun, 9 Apr 2006 05:51:08 -0300 (ADT) Received: from localhost (katosiko.hut.fi [130.233.228.115]) by smtp-1.hut.fi (8.13.6/8.12.10) with ESMTP id k398p73e001063; Sun, 9 Apr 2006 11:51:07 +0300 Received: from smtp-1.hut.fi ([130.233.228.91]) by localhost (katosiko.hut.fi [130.233.228.115]) (amavisd-new, port 10024) with LMTP id 18924-19-5; Sun, 9 Apr 2006 11:51:06 +0300 (EEST) Received: from kosh.hut.fi (kosh.hut.fi [130.233.228.10]) by smtp-1.hut.fi (8.13.6/8.12.10) with ESMTP id k398oPw2000917; Sun, 9 Apr 2006 11:50:25 +0300 Date: Sun, 9 Apr 2006 11:50:24 +0300 (EEST) From: Heikki Linnakangas To: markds75 cc: pgsql-jdbc@postgresql.org Subject: Re: PostgreSQL (XADataSource) as Tomcat Resource In-Reply-To: <1144263998.675528.212920@t31g2000cwb.googlegroups.com> Message-ID: References: <1144263998.675528.212920@t31g2000cwb.googlegroups.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-TKK-Virus-Scanned: by amavisd-new-2.1.2-hutcc at katosiko.hut.fi X-Archive-Number: 200604/72 X-Sequence-Number: 15006 On Wed, 5 Apr 2006, markds75 wrote: > How can I get Postgres to be deployed in Tomcat's JNDI as an > XADataSource? > > I'm running my web app in Tomcat, and I'm moving towards distributed > transactions for my two data sources (JDO and JCR). I've got the Jencks > library providing JTA support (based on Geronimo's TransactionManager) > within Tomcat. Currently, I have Postgres configured as a local web-app > Resource as follows: > > auth="Container" > type="javax.sql.DataSource" > url="jdbc:postgresql://127.0.0.1:5432/my_db" > driverClassName="org.postgresql.Driver" > username="----------------" > password="----------------" > maxWait="3000" > maxIdle="100" > maxActive="10" /> > > The web-app is able to start up without errors in this case and things > function as expected. However, I've been told that I should be using an > XADataSource if I want JDO to participate in distributed transactions > (specifically, I'm trying to get 2 phase commit). When I change the > type to "javax.sql.XADataSource", the web-app fails to start because > Tomcat cannot create the JNDI entry. I'm running under Java 1.5, so to > my knowledge XADataSource is included. > > Any pointers would be appreciated. I don't know how to do it, but you certainly shouldn't have the driver class name (org.postgresql.Driver) there. That's only used for non-XA connections. You should somehow tell it that the class implementing XADataSource is org.postgresql.xa.PGXADataSource. I don't know anything about Jencks, but it seems that it uses the TranQL connector module from Geronimo to glue in XADataSource implementations. Unfortunately, there's no TranQL connector for PostgreSQL. Fortunately, it shouldn't be too hard to write one, using the existing connectors as an example. However, I would suggest using another app server / JTA implementation. I had success with JOnAS, which includes JOTM as it's JTA implementation. JBoss should work too. - Heikki