Skip to main content

Glassfish Enhanced JMS Cluster Configuration

7 replies [Last post]
Joined: 2013-01-23
Points: 0


I try to configure JMS Availibility but I have many problems with MQ Broker...

* My Installation :
I have just install Glassfish Open Source Edition v3.1.2.2 build 5
I select :
JMS Service Type : Local
JMS Cluster Type : Enhanced (HA)
Database Vendor : oracle
Database URL :
Database User : user
Database Auth : password
Database Password : password

and i add following properties :

Then I Started the domain, and created a cluster "LongClusterName" and created one instance "instanceName"

* My problems :

1) when I start the instance the Broker Failed to start. The first error is that my clusterId is too long so the db table creation failed.
It's seems that by default the clusterId is "LongClusterName_MQ"
I try to change it (by overriding imq.cluster.clusterid properties, imq.brokerid .... no way !)

So, I delete my cluster and create a new one with a shorter name, but if someone know how to configure this name i'm glad to know !

2) Now, when I start my instance (in my new cluster with short name), tables are correctly created in my Database, but my instance failed again to start because the connection to JMS Service Failed

Here is a part of my log file :

ADDRESSLIST in setJmsServiceProvider: mq://localhost:27676/

JMS Service Connection URL is : mq://localhost:27676/

MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is LOCAL, connection mode is TCP

=> [C4003]: Error occurred on connection creation [localhost:27676]. - cause: Connection refused: connect

I see some post which explain that you should not use localhost as address. But where can I changed it ?
I try to put host IP ( to default_JMS_host but it change nothing
I try to add an entry in my host file to map localhost to nothing change to...

Is someone know where should i configure it ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-10-12
Points: 0

The use of localhost should not be a problem in this case since your client (the resource adapter) is on the same machine as the MQ broker.

The first thing to check is whether the MQ broker had started correctly, and whether it was listening on mq://localhost:27676/. Have you looked at the broker (not server) log? This is in the imq directory under your domain directory.

Joined: 2013-01-23
Points: 0

Thanks for replying.

I found my problem. You right, the fact is that my MQ Broker failed to initialize.
One more time, the name of my cluster (which is used by glassfish to set imq.cluster.clusterid) was too long. The check for table name length was good, but the schema generation still failed because... one index name was too long.

So with a cluster named "X", all works fine !

I can't believe that it's the only way to make a glassfish cluster works with a enhanced JMS Avalailibity configuration...

so, my first question is still open !

Joined: 2011-12-18
Points: 0

If you are using HA cluster, then there is limitation on clusterId,




Cluster identifier

Must be a unique alphanumeric string of no more than nâ€"13 characters, where n is the maximum table name length allowed by the database. No two running clusters may have the same cluster identifier.

This string is appended to the names of all database tables in the cluster’s shared persistent store.

Note - For brokers belonging to a high-availability cluster, this property is used in database table names in place of imq.brokerid (see Table 17-1).

You can refer to Oracle GlassFish Server Message Queue 4.5 Administration Guide ( for more details.

Hope this answers your question.

Joined: 2013-01-23
Points: 0

Yep, I read this doc, but it's not right, because there are 4 long index name :
MQCONSTATE41C[clusterId]IDX1 -> 17 char + clusterId Length
MQCONSTATE41C[clusterId]IDX2 -> 17 char + clusterId Length
MQTMLRJMSBG41C[clusterId]IDX1 -> 18 char + clusterId Length
MQTMLRJMSBG41C[clusterId]IDX2 -> 18 char + clusterId Length

so with a cluster name with 14 characters (ex : CLUSTERNAME14C),
glassfish generate a clusterId of length 17 (ie : CLUSTERNAME14C_MQ)

The length check pass (17+13 = 30 which is the max length for Oracle db) for tablenames but not for Index, because the longer index become :

so (for Oracle DB, i don't know if this is the case for other Database) the rule is :
ClusterId length must be : (Max length table/index) - 18

Joined: 2007-09-10
Points: 0

You are right. The longest cluster id name should be max-db-table-name-len - 18. The MQ documentation and broker error log message is incorrect - filed bug Thanks

Joined: 2013-01-23
Points: 0

You're welcome !

To be perfect you can add that "_" are not used in the clusterId generated by glassfish, so you can add how many "_" you want in cluster name, it doesn't count in the length.

for example : MY_CLSTR_DEV
generate following index :

Joined: 2007-09-10
Points: 0

The transformation from MY_CLSTR_DEV to MQ clusterid MYCLSTRDEV_MQ is done in GlassFish server - filed to document this transformation - To MQ broker, it only sees clusterid MYCLSTRDEV_MQ