Skip to main content

Always using DerbyPool

4 replies [Last post]
weberjn
Offline
Joined: 2003-11-11
Points: 0

I wanted to create a DB2 Connection Pool and a datasource with v4 final.

Unfortunately my servlet did not use the DB2 pool but the Derby pool (see first exception).
Entry in domain.xml pointed correctly to DB2, but still Derby was taken:

OK, I hacked the Derby pool with the DB2 properties. I got a strange error No password credential found
but the solution from
http://amanica.blogspot.de/2009/02/no-passwordcredential-found.html
(restart the server) helped and my servlet worked with DB2.

Googling the Exception below gives several hits, so this seems to be a quite old bug...

Can anybody confirm/reproduce the bug?

Update: linking jdbc/__default to the db2 pool fixes the problem, too. So it seems Glassfish always uses the default pool.

RAR5038:Unexpected exception while creating resource for pool DerbyPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused.]]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
akutovoy
Offline
Joined: 2004-04-27
Points: 0

I am having the same problem with GF 4.
My Oracle datasource can only be injected if it is configured under jdbc/__default JNDI name. Using any other name results in returning whatever datasource is under jdbc/__default (by default, of course, DerbyPool)

I wonder if anybody out there uses GlassFish for anything
real??? I thought people would start screaming all over the net.

Or am I missing something? Please help!

fwelland
Offline
Joined: 2006-03-13
Points: 0

We have a production app running on GF 3.1.1....And I am currently porting to 4.0x...

But aside from that -- I just had a similar problem: I had a JDBC resource "Member" that was properly tied to a pool going to a SQLServer db. Whenever I did an "@Resource(lookup = "Memeber") I would get a 'connection refused' on port 1527 -- which traces back to "DerbyPool"....

After much fuss I had a coworker look at my code and he saw that typo: "Memeber". I would have preferred if GF40x would have given a name not found rather than routing me to a jdbc/__default.

Doubt this is your problem, but you may just want to double check....

akutovoy
Offline
Joined: 2004-04-27
Points: 0

You helped me fix the problem!
Well, it was not a typo in my case (the exact same code was working - also in production - in GF 3.1.2.2).
I was injecting the datasource using
@Resource(name="jdbc/myDs").
After reading your post, I changed it to
@Resource(lookup="jdbc/myDs").
and magic happened!
Thanks!

fwelland
Offline
Joined: 2006-03-13
Points: 0

Doh!

That is funny -- because I too had trouble with

@Resource(name="jdbc/myDs") vs @Resource(lookup="jdbc/myDs") and the change to 'lookup' is when I introduced the typo!!

I ran into this issue when I first started running our code in GF4.0x.

After a bit of struggling with this; I surmised that maybe 'name' was "wrong" all along and that the "name" syntax worked if you had a DD that was mapping the name to a JNDI lookup string. And this just happened to work out on GF versions less than 4.