GlassFish – Configuring JMS Connection Factory to connect to MQ Cluster

Recently, I was trying to find out how to configure a JMS Connection Factory to connect to MQ Cluster. I wanted to send and receive messages from MQ Cluster. It was very hard to find this information in one place. I found that this information is scattered and buried with other info. This blog is to help others to make this information easily available. I assume that you will be already knowing how to configure a JMS Connection Factory from admin console. So in this blog I will directly get to the point where you will change an  existing JMS Connection Factory to connect to MQ cluster. In Glassfish, for every JMS Connection Factory we create, the application server automatically creates a Connector Resource. It also creates a Connector Connection Pool with the same name and associates the connector resource with this connection pool. The connector connection pool is by default for the resource adapter called “jmsra”. For connecting to MQ Cluster we are going to create a new connector connection pool for resource adapter, “sun-jms-adapter” and associate this connection pool to the connector resource. Create a new Connector Connection Pool In admin console, go to Resources –> Connectors –> Connector Connection Pools. Click on New. Please make sure that you  select “sun-jms-adapter” as Resource Adapter. Click Next. Scroll down to the properties section. Add the properties as below: set the ConnectionURL property with comma separated URLs of MQ brokers. For example: mq://system1:7676,mq://system1:7677 Click on Finish. Now you can associate this connector connection pool to the connector resource. Locate the connector resource for the corresponding JMS Connection Factory. Go...

Read-only or Restricted access Glassfish admin console

  Sometimes you want to give the admin console access to users but also want to make sure that they should not be able to modify certain things. Below blog describes our attempt to achieve such requirement. Even though I couldn’t get a 100% read-only access I managed to get certain pages read only. 1. Open the file “granted.policy” located at <GlassFishInstallDir>/domains/domain1/generated/policy/admingui/ 2. Paste the following code block: grant principal com.sun.enterprise.deployment.Group "readonly" { permission javax.security.jacc.WebResourcePermission "/resource/*:/resource/js/*:/resource/css/*:/resource/images/*", "GET"; permission javax.security.jacc.WebResourcePermission "*.jsf:/resource/*:/resource/js/*:/download/*:/resource/css/*:/theme/META-INF/*:/theme/com/sun/webui/*:/resource/images/*:/theme/*", "GET"; permission javax.security.jacc.WebResourcePermission "/header.jsf","GET,POST,DELETE,PUT"; permission javax.security.jacc.WebResourcePermission "/download/*", "GET"; permission javax.security.jacc.WebRoleRefPermission "default", "admin"; permission javax.security.jacc.WebRoleRefPermission "FacesServlet", "admin"; permission javax.security.jacc.WebRoleRefPermission "jsp", "admin"; permission javax.security.jacc.WebRoleRefPermission "XmlHttpProxy", "admin"; permission javax.security.jacc.WebRoleRefPermission "ThemeServlet", "admin"; permission javax.security.jacc.WebRoleRefPermission "DownloadServlet", "admin"; permission javax.security.jacc.WebRoleRefPermission "", "admin"; }; 3. Go to admin console. Login as admin. 4. Go to Configurations -> Security -> Realms -> admin-realm 5. Click on Manage Users 6. Click “New..” for adding new User. 7. Give User ID as your desired user id. Give GroupList as “readonly”. Provide the password fields and save 8. Restart the server and login with the new user...