Glassfish hangs when it can’t connect to datasources

I am running glassfish v2.1.1 on linux. I have some datasources set up to connect to mysql and other databases. There are times where I would like to run glassfish without connecting to these databases, as some of them are only available to me at work. If I try to do so, glassfish will hang and will never start up at all. Is there a good way to get glassfish to give up connecting to the datasources and continue loading anyway? BTW, when glassfish hangs this way, I have created further problems by trying to start it again when the last start was unsuccessful.

Answer

There are a couple of ways I can think of to do this. One is to switch to cluster profile (assuming you’re on the developer profile), then create a standalone instance that does not have the datasources associated with it. Datasources have a Target tab in the admin page and you can pick which server instances each datasource is associated with. You’ll need to run asadmin start-node-agent from the command line to start the second instance. This second instance can have different ports (typically 38081, 38181, 33700, etc.)

I haven’t done it, but another way is to create a second domain configured the way you need. It would also use different ports. Something like this: http://lysra.blogspot.com/2008/09/initialize-second-domain-in-glassfish.html

Attribution
Source : Link , Question Author : Community , Answer Author : Jim

Leave a Comment