Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 2D2C3DBE8C1 for ; Thu, 26 Jan 2012 01:40:08 -0400 (AST) Received: from elasmtp-banded.atl.sa.earthlink.net ([209.86.89.70]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RqI3y-0008JK-9Q for pgsql-jdbc@postgresql.org; Thu, 26 Jan 2012 05:40:08 +0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=mindspring.com; b=T12Ok8rHKp9bylfMXgqXH/vAw9ecBHSSuTqR4PbDVb9hlie6tpN49DjT99o6KQXN; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [71.246.42.79] (helo=[10.0.0.100]) by elasmtp-banded.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1RqI3R-0007S7-OR; Thu, 26 Jan 2012 00:39:27 -0500 Message-ID: <4F20E785.8070907@mindspring.com> Date: Wed, 25 Jan 2012 21:41:25 -0800 From: Petra Systems User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.13) Gecko/20101209 Thunderbird/3.1.7 MIME-Version: 1.0 To: Dave Cramer CC: pgsql-jdbc@postgresql.org Subject: Re: JDBC Driver in Glassfish 3.1.1 References: <4F1E4572.9030801@mindspring.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------090208080802060401020105" X-ELNK-Trace: d4a33e166a8dfa109c7f779228e2f6aeda0071232e20db4dbdc61e528839c9eef0889182a48bb4da350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.246.42.79 X-Pg-Spam-Score: -2.0 (--) X-Archive-Number: 201201/103 X-Sequence-Number: 22643 This is a multi-part message in MIME format. --------------090208080802060401020105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi: Below is the environment and a definition of the problem and other details. If this is not the proper location to post please advise. 1) Application Server is Glassfish 2.1.1 (problem was also observed with 3.1.1) running on a Solaris 10 x86 (AMD) with a ZFS file system. 2) Database Server is Solaris 10 x86 (AMD) running postgres 8.2 with a UFS file system. 3) The ear file consists of an Applet, a war file and an ejb jar. All have been built with Netbeans 7.1 using JDK 1.6. The application run environment is listed by Netbeans as EE 6. There is something strange in that the EE environment for the war file is listed by Netbeans as J2EE 1.4. 4) This application has been running for years with the postgres database on the same server as Glassfish. 5) When the database is remote the jndi lookup works but the ds.connection(userid,password) fails. The connection pool is setup with an XADatasource and ping is successful. Also, Netbeans can connect to the remote database and so can pgAdmin. 6) The exception thrown is not an SQLException and I added some more catch statements to try to unwind the exceptions. See code and stack trace attached. 7) The application is using EJB 2.1 technology with Bean Managed Persistence which currently is our preferred approach. The inability to make the connection occurs in both servlets and entity beans. The jndi lookup works but the ds.connect does not. Any help would be appreciated. Regards, Rich Rutkowski Petra Systems 1-888-513-3026 petrasys@mindspring.com rich@salepointdata.com On 01/24/12 04:04, Dave Cramer wrote: > There should be no reason it would not work. > > Dave Cramer > > dave.cramer(at)credativ(dot)ca > http://www.credativ.ca > > > > On Tue, Jan 24, 2012 at 12:45 AM, Petra Systems wrote: >> Hi: >> Before I spend your valuable time describing a recent problem I would >> like to know if postgresql-8.2-512.jdbc4.jar or postgresql-9.0-801.jdbc3.jar >> work with Glassfish 2.1.1 when the postgres data base (8.2) is remote with >> respect to the Glassfish 2.1.1 Application Server. >> >> Regards, >> >> -- >> Rich Rutkowski >> Petra Systems >> 1-888-513-3026 >> petrasys@mindspring.com >> rich@salepointdata.com >> >> >> -- >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-jdbc --------------090208080802060401020105 Content-Type: text/plain; name="code_stacktrace.txt." Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="code_stacktrace.txt." Code where the problem occurs. try // START OF JTA TRANSACTION { Object o=3Dnew InitialContext().lookup("UserTransaction"); ut=3D(UserTransaction) PortableRemoteObject.narrow(o,UserTran= saction.class); // ut =3D sessioncontext.getUserTransaction(); Debug.print("Value of ut is: " +ut); ut.begin(); =20 try { loginidcon =3D ds.getConnection("rich", "password"); } catch(SQLException sqlex) { Throwable se =3D new ServletException("database error"); se.initCause(sqlex); System.err.println("SQLException in LoginPwdServlet. ");= System.err.println(sqlex.getMessage()); =20 } catch(UndeclaredThrowableException ex) { System.err.println("This is the exception"); System.err.println(ex.getMessage()); Throwable unex =3D ex.getCause(); unex.printStackTrace(); System.err.println("And the target excepiton is ..."); System.err.println(((java.lang.reflect.InvocationTargetEx= ception)unex).getTargetException()); System.err.println(unex.getMessage()); } try { ps =3D loginidcon.prepareStatement("Select USERNAME,PASSW= ORD " +=20 "from PASSWORDID where USERID =3D ?",ResultSet.TYPE_S= CROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ps.setString(1, user); results =3D ps.executeQuery();=20 if (!results.next()) { // A matching USERNAME is not found in database Authentication =3D new Integer(0); System.err.println("User " + user + " not found."); } else { // Only returns the first match. =20 PassWord =3D results.getString("PASSWORD"); String CheckPass =3D PassWord.trim(); if (CheckPass.equals(Pass)) Authentication =3D new Integer(1); // passwords = mathch else { Authentication =3D new Integer(0); // wrong pass= word System.err.println("Password doesn't match for " = + user); } =20 } =20 } catch(SQLException sqlex) { System.err.println("SQLException in LoginPwdServlet. ");= System.err.println(sqlex.getMessage()); =20 } Debug.print("Value of ut is: " +ut); ut.commit(); // COMMIT THE JTA TRANSACTION } catch (Exception ext) // USER TRANSACTION CATCH { Debug.print("Exception in JTA Transaction in LoginPwdServlet"= +ext.getMessage()); ext.printStackTrace(); { try { Debug.print("Value of ut is: " +ut); if (ut !=3D null) ut.rollback(); } catch (SystemException syex) { Debug.print("Rollback Exception: " +syex.getMessage()); throw new EJBException ("Rollback failed: " + syex.getMessage()); } throw new EJBException("Transaction failed: " + ext.getMessag= e()); } } Glassfish Logfile with the stacktrace that I think has the most info. Timestamp =09 Jan 25, 2012 20:33:46.200 Log Level =09 WARNING Logger =09 javax.enterprise.system.stream.err Name-Value Pairs =09 _ThreadID=3D18;_ThreadName=3DhttpSSLWorkerThread-35084-0;_RequestID=3Dbdb= fd51a-0fdd-4c57-9eb9-d6b0bb14e46b; Record Number =09 1596 Message ID =09 java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAc= cessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl= =2Einvoke(NativeMethodAccessorImpl.java Complete Message =09 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc= cessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) a= t org.postgresql.xa.PGXAConnection$ConnectionHandler.invoke(PGXAConnectio= n.java:146) at $Proxy118.getClientInfo(Unknown Source) at com.sun.gjc.spi= =2Ejdbc40.ConnectionHolder40.getClientInfo(ConnectionHolder40.java:353) a= t com.sun.gjc.spi.jdbc40.ConnectionHolder40.init(ConnectionHolder40.java:= 81) at com.sun.gjc.spi.jdbc40.ConnectionHolder40.(ConnectionHolder4= 0.java:72) at com.sun.gjc.spi.jdbc40.Jdbc40ObjectsFactory.getConnection(J= dbc40ObjectsFactory.java:51) at com.sun.gjc.spi.ManagedConnection.getConn= ection(ManagedConnection.java:329) at com.sun.enterprise.resource.Connect= orAllocator.fillInResourceObjects(ConnectorAllocator.java:155) at com.sun= =2Eenterprise.resource.AbstractResourcePool.getResource(AbstractResourceP= ool.java:517) at com.sun.enterprise.resource.PoolManagerImpl.getResourceF= romPool(PoolManagerImpl.java:248) at com.sun.enterprise.resource.PoolMana= gerImpl.getResource(PoolManagerImpl.java:176) at com.sun.enterprise.conne= ctors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.j= ava:337) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateC= onnection(ConnectionManagerImpl.java:235) at com.sun.enterprise.connector= s.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165= ) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnecti= on(ConnectionManagerImpl.java:158) at com.sun.gjc.spi.base.DataSource.get= Connection(DataSource.java:130) at LoginPwdServlet.doPost(LoginPwdServlet= =2Ejava:172) at javax.servlet.http.HttpServlet.service(HttpServlet.java:7= 54) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at or= g.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationF= ilterChain.java:427) at org.apache.catalina.core.StandardWrapperValve.inv= oke(StandardWrapperValve.java:315) at org.apache.catalina.core.StandardCo= ntextValve.invokeInternal(StandardContextValve.java:287) at org.apache.ca= talina.core.StandardContextValve.invoke(StandardContextValve.java:218) at= org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java= :648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipel= ine.java:593) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.ja= va:94) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(= PESessionLockingStandardPipeline.java:98) at org.apache.catalina.core.Sta= ndardHostValve.invoke(StandardHostValve.java:222) at org.apache.catalina.= core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.c= atalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.= apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) a= t org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093) = at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv= e.java:166) at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke= (StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.= invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBa= se.invoke(ContainerBase.java:1093) at org.apache.coyote.tomcat5.CoyoteAda= pter.service(CoyoteAdapter.java:291) at com.sun.enterprise.web.connector.= grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)= at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProce= ss(DefaultProcessorTask.java:597) at com.sun.enterprise.web.connector.gri= zzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872) at com.s= un.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(= DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.Def= aultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.c= onnector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.= sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUni= ficationPipeline.java:382) at com.sun.enterprise.web.connector.grizzly.Ta= skBase.run(TaskBase.java:264) at com.sun.enterprise.web.connector.grizzly= =2Essl.SSLWorkerThread.run(SSLWorkerThread.java:106) Caused by: java.lang= =2EAbstractMethodError: org.postgresql.jdbc3.Jdbc3Connection.getClientInf= o()Ljava/util/Properties; at sun.reflect.NativeMethodAccessorImpl.invoke0= (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMeth= odAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invok= e(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invok= e(Method.java:597) at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnec= tion$ConnectionHandler.invoke(AbstractJdbc23PooledConnection.java:352) at= $Proxy118.getClientInfo(Unknown Source) ... 51 more --------------090208080802060401020105--