dev@glassfish.java.net

Re: error creating jdbc connection pool

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Tue, 09 Nov 2010 14:10:57 +0530

Please find my responses in-line.

On Tue, 2010-11-09 at 00:13 -0800, Bill Shannon wrote:
> I'm not sure what I'm supposed to do now. Does this mean that
> I can never create a connection pool in b24?
> Actually, it seems like the connection pool was created anyway,
> despite the errors. But if I try to ping the connection pool,
> it fails with the "Unable to open file /_cpds_0" error. What
> does that mean?
I am just cc-ed to an issue :
https://glassfish.dev.java.net/issues/show_bug.cgi?id=14358
which shows the same exception.

This seems to be due to the fact that empty properties of datasource
(eg: TraceDirectory in the properties tab)
are persisted in domain.xml and when they are applied to the datasource
at runtime,
they fail with the above exception.
When the pool is created after removing empty properties, it works fine.

IIRC, in GlassFish v2.x, empty properties were not persisted in
domain.xml by admin console.
I shall investigate this.
>
> Also, its not clear to me how I know whether to choose a
> DataSource, XADataSource, or ConnectionPoolDataSource. Since I'm
> creating a connection pool, wouldn't I always want the latter?
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]

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
>