dev@glassfish.java.net

Re: error creating jdbc connection pool

From: Lance Andersen - Oracle <Lance.Andersen_at_oracle.com>
Date: Tue, 9 Nov 2010 11:41:39 -0500

Hi Jagadish,
On Nov 9, 2010, at 11:36 AM, Jagadish Prasath Ramu wrote:

> Hi Lance,
>>
>>
>> Jagadish, it might help to explain how GF utilizes Connection Pooling
>> and how the various DataSource types play into that.
>> From the end user (application's usage) perspective, there will be no
> difference.
> GlassFish will transparently pool all type of datasources.

>
>>
>>> Not all database driver vendors may support all 3 variants.
>>>> And if the database supports XA, wouldn't I want that variant?
>>>> How do I choose?
>>> If one is sure that the application will be involved in Local
>>> Transaction, DS or CPDS can be chosen.
>>>>
>>>> Finally, what's the difference between "JavaDB" and "JavaDB-30"?
>>>> How do I know which one to choose?
>>> JavaDB-30 represents the JDBC 3.0 implementation of datasource from
>>> derby.
>>> [org.apache.derby.jdbc.ClientDataSource]
>>> JavaDB represents the latest (JDBC 4.0) implementation of
>>> datasource.
>>> [org.apache.derby.jdbc.ClientDataSource40]
>>>
>>
>>
>>
>>
>> We should not need both. if we are talking about GF 3.x. Per the
>> Derby Networkserver docs:
>>
>>
>> -------------------
>> The Network Server supports the Derby Network Client
>> driver DataSource classesorg.apache.derby.jdbc.ClientDataSource andorg.apache.derby.jdbc.ClientConnectionPoolDataSource on all supported Java SE platforms.
>>
>> If your client runs on the Java SE 6 platform, and if you want to
>> use DataSource methods specific to the JDBC 4 API, use
>> the DataSource classes
>> named org.apache.derby.jdbc.ClientDataSource40 andorg.apache.derby.jdbc.ClientConnectionPoolDataSource40.
>>
>> If your client is running on the Java SE 6 platform, all connection
>> objects returned from the DataSource will be JDBC 4 connection
>> objects, whether or not you are using a DataSource whose name ends in
>> "40".
>>
>> -------------------------
>
> Thanks, I was not aware of this.
> I shall remove "JavaDB-30" from the list as it is redundant.

I actually just decided to test this and unfortunately, the Apache docs are not correct, you need to use the ClientDataSource40 to get JDBC 4.0 features and I am discussing this with the Derby team so that we get the docs correct and clearer.

So we should only provide the JDBC 4.0 support, not the JDBC 3.0 support for GF V3 for Derby.


>
> Thanks,
> -Jagadish
>>
>>
>> Regards,
>> Lance
>>>
>>> Thanks,
>>> -Jagadish
>>>>
>>>>
>>>> Jagadish Prasath Ramu wrote on 11/07/2010 09:56 PM:
>>>>>
>>>>> Ping seems to be enabled by default even though it was not
>>>>> actually set.
>>>>> Probably, due to the following issue which is fixed now.
>>>>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=14320
>>>>>
>>>>> w.r.t ping failure, this seems to be because, each property in
>>>>> the
>>>>> "properties" tab is set individually by REST (instead of a batch
>>>>> update
>>>>> using hk2 transaction) resulting in configuration change event
>>>>> which
>>>>> in-turn results in pool recreation for each addition of
>>>>> property. With
>>>>> ping=true, before databaseName property is set, following
>>>>> exception is
>>>>> seen.
>>>>> "Connection could not be allocated because: Required Derby
>>>>> DataSource
>>>>> property
>>>>> databaseName not set"
>>>>>
>>>>> I did not see the following exception in my installation (OS :
>>>>> Suse) of NB 7.0 M2 with GF b24.
>>>>> "Exception
>>>>> while visiting com/sun/gjc/spi/ManagedConnectionFactory.class of
>>>>> size 30141"
>>>>> Jerome/Hong might know about this.
>>>>>
>>>>> Thanks,
>>>>> -Jagadish
>>>>>
>>>>>
>>>>>
>>>>> On Sun, 2010-11-07 at 18:08 -0800, Bill Shannon wrote:
>>>>>> I tried to create a new JDBC connection pool using the admin
>>>>>> console.
>>>>>> I'm new to this, so I don't really know what I'm doing. I got
>>>>>> this error:
>>>>>>
>>>>>> Ping Connection Pool for WinePool is Failed. Ping failed
>>>>>> Exception -
>>>>>> Connection could not be allocated because: Unable to open
>>>>>> file /_cpds_0 : null
>>>>>> Please check the server.log for more details.
>>>>>>
>>>>>> "is Failed"? Maybe "has failed" would be better?
>>>>>>
>>>>>> "file /_cpds_0" : null"?
>>>>>>
>>>>>> What does this mean?
>>>>>>
>>>>>> I created a connection to this database in NetBeans, which
>>>>>> lists it as:
>>>>>>
>>>>>> jdbc:derby://nissan:1527/wine [shannon on SHANNON]
>>>>>>
>>>>>> In the admin console I have these properties set:
>>>>>> User = shannon
>>>>>> DatabaseName = wine
>>>>>> Password =<the password for shannon>
>>>>>> ServerName = nissan
>>>>>>
>>>>>> Everything else is the default.
>>>>>>
>>>>>> The server.log file says:
>>>>>>
>>>>>> [#|2010-11-07T17:53:59.268-0800|SEVERE|glassfish3.1|
>>>>>> javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=14;_ThreadName=Thread-1;|Exception
>>>>>> while visiting com/sun/gjc/spi/ManagedConnectionFactory.class
>>>>>> of size 30141
>>>>>> java.lang.ArrayIndexOutOfBoundsException: 88
>>>>>> at java.util.ArrayList.add(ArrayList.java:352)
>>>>>> at
>>>>>> org.glassfish.hk2.classmodel.reflect.impl.TypeImpl.addMethod(TypeImpl.java:82)
>>>>>> at
>>>>>> org.glassfish.hk2.classmodel.reflect.impl.ModelClassVisitor.visitMethod(ModelClassVisitor.java:206)
>>>>>> at org.objectweb.asm.ClassReader.accept(Unknown
>>>>>> Source)
>>>>>> at org.objectweb.asm.ClassReader.accept(Unknown
>>>>>> Source)
>>>>>> at org.glassfish.hk2.classmodel.reflect.Parser
>>>>>> $4.on(Parser.java:214)
>>>>>> at
>>>>>> org.glassfish.hk2.classmodel.reflect.util.JarArchive.onSelectedEntries(JarArchive.java:120)
>>>>>> at
>>>>>> org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:96)
>>>>>> at
>>>>>> org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.onSelectedEntries(DirectoryArchive.java:82)
>>>>>> at
>>>>>> org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:198)
>>>>>> at org.glassfish.hk2.classmodel.reflect.Parser.access
>>>>>> $000(Parser.java:59)
>>>>>> at org.glassfish.hk2.classmodel.reflect.Parser
>>>>>> $2.call(Parser.java:161)
>>>>>> at org.glassfish.hk2.classmodel.reflect.Parser
>>>>>> $2.call(Parser.java:154)
>>>>>> at java.util.concurrent.FutureTask
>>>>>> $Sync.innerRun(FutureTask.java:303)
>>>>>> at
>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>>>>> at
>>>>>> java.util.concurrent.ThreadPoolExecutor
>>>>>> $Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>> at
>>>>>> java.util.concurrent.ThreadPoolExecutor
>>>>>> $Worker.run(ThreadPoolExecutor.java:908)
>>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>> |#]
>>>>>>
>>>>>> [#|2010-11-07T17:54:00.283-0800|INFO|glassfish3.1|
>>>>>> org.hibernate.validator.engine.resolver.DefaultTraversableResolver|_ThreadID=14;_ThreadName=Thread-1;|Instantiated
>>>>>> an instance of
>>>>>> org.hibernate.validator.engine.resolver.JPATraversableResolver.|#]
>>>>>>
>>>>>> [#|2010-11-07T17:54:00.550-0800|WARNING|glassfish3.1|
>>>>>> javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service|_ThreadID=14;_ThreadName=Thread-1;|RAR8054:
>>>>>> Exception while creating an unpooled [test] connection for
>>>>>> pool [ WinePool ],
>>>>>> Connection could not be allocated because: Required Derby
>>>>>> DataSource property
>>>>>> databaseName not set.|#]
>>>>>>
>>>>>> [#|2010-11-07T17:54:00.885-0800|WARNING|glassfish3.1|
>>>>>> javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service|_ThreadID=14;_ThreadName=Thread-1;|RAR8054:
>>>>>> Exception while creating an unpooled [test] connection for
>>>>>> pool [ WinePool ],
>>>>>> Connection could not be allocated because: Unable to open
>>>>>> file /_cpds_0 : null|#]
>>>>>>
>>>>>> [#|2010-11-07T17:54:00.887-0800|SEVERE|glassfish3.1|
>>>>>> com.sun.jersey.spi.container.ContainerResponse|
>>>>>> _ThreadID=14;_ThreadName=Thread-1;|The
>>>>>> RuntimeException could not be mapped to a response,
>>>>>> re-throwing to the HTTP
>>>>>> container
>>>>>> org.glassfish.admin.rest.CliFailureException: Ping Connection
>>>>>> Pool for WinePool
>>>>>> is Failed. Ping failed Exception - Connection could not be
>>>>>> allocated because:
>>>>>> Unable to open file /_cpds_0 : null Please check the
>>>>>> server.log for more details.
>>>>>> at
>>>>>> org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.java:83)
>>>>>> at
>>>>>> sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
>>>>>> at
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>
>>>>>> What did I do wrong?
>>>>>>
>>>>>> This is from b24 bundled with NetBeans 7.0 M2.
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>> For additional commands, e-mail:
>>>>>> dev-help_at_glassfish.dev.java.net
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>>
>>
>>
>>
>> Oracle
>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>> Oracle Java Engineering
>> 1 Network Drive
>> Burlington, MA 01803
>> Lance.Andersen_at_oracle.com
>>
>> Green Oracle
>> Oracle is committed to developing
>> practices and products that help
>> protect the environment
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>




Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen_at_oracle.com

        Oracle is committed to developing practices and products that help protect the environment