commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [DBCP] BasicDataSource.locked on one machine and not another
Date Fri, 14 Jan 2011 19:59:34 GMT




On Jan 14, 2011, at 1:56 PM, Mark Shifman <mark.shifman@yale.edu> wrote:

> I have a odd problem. the following code runs fine on one machine running
> java version "1.6.0_18"
> Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
> Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)
> 
> but hangs for several minutes/then runs on another computer running
> java version "1.6.0_20"
> Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
> 
>    public static void main(String[] args) throws SQLException {
>        BasicDataSource ds = new BasicDataSource();
>        ds.setDriverClassName("oracle.jdbc.OracleDriver");
>        ds.setUsername(theUserName);
>        ds.setPassword(thePassWord);
>        ds.setUrl(theUrl);
>        ds.setInitialSize(2);
>        ds.setValidationQuery("SELECT 1 from dual");
>        ds.setTestOnBorrow(true);
>        Connection conn=ds.getConnection();
>        //do something with connection
>        System.err.println("done get conn");
>    }
>    
> When I do a thread dump(below) I see that the BasicDataSource is locked.
> I am using commons-pool-1.5.5.jar with commons-dbcp-1.4 and ojdbc6.jar on the two linux
boxes.
> What could be causing such behavior and how can I fix it.
> 
> "main" prio=10 tid=0x00000000407ba000 nid=0x6134 runnable [0x0000000040674000]
>   java.lang.Thread.State: RUNNABLE
>        at java.net.PlainSocketImpl.initProto(Native Method)
>        at java.net.PlainSocketImpl.<clinit>(PlainSocketImpl.java:84)
>        at java.net.Socket.setImpl(Socket.java:443)
>        at java.net.Socket.<init>(Socket.java:364)
>        at java.net.Socket.<init>(Socket.java:189)
>        at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:127)
>        at oracle.net.nt.ConnOption.connect(ConnOption.java:126)
>        at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:306)
>        at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:421)
>        at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:630)
>        at oracle.net.ns.NSProtocol.connect(NSProtocol.java:206)
>        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:966)
>        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)
>        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
>        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
>        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
>        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
>        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
>        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
>        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
>        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
>        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>        - locked <0x00002aaadcfc8168> (a org.apache.commons.dbcp.BasicDataSource)
>        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>        at org.ycmi.ypedBilling.YpedBilling.main(YpedBilling.java:46)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
> 
See
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6483406

Also obviously verify that there are no network issues.

Phil
> -- 
> Mark Shifman
> Yale Center for Medical Informatics
> Phone (203)737-5219
> mark.shifman@yale.edu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message