Search |
||
Configuring glassfish to use Jboss messaging as JMS providerPosted by rampsarathy on December 4, 2006 at 12:28 AM PST
Integrating JBoss Messaging (1.0.1) with Glassfish V2 (Build 26) using Generic JMS RA (1.7) Generic JMS RA (1.7) that is bundled with Glassfish V2 enables applications deployed on Glassfish to use almost any JMS 1.1 compliant message broker. This article talks about how applications (typically Message Driven Beans) deployed in glassfish can use JBoss Messaging as the JMS provider using Generic resource adapter for JMS. The steps/configuration mentioned below are based on the following versions : Project Glassfish V2 Build 26 JBoss Messaging 1.0.1 GA (over JBoss AS 4.0.4 GA). Generic JMS RA 1.7 Initial Setup * Creating Standalone JBoss Messaging instance : The following document describes how to setup a standalone JBoss messaging system. As mentioned in the above document a Jboss AS 4.0.4 instance is required by JBoss Messaging to start successfully. Once the above setup is done, you would have a JBoss AS 4.0.4 installation, lets call it JBOSS_HOME and also a new server configuration created under JBOSS_HOME/server called "standalone-messaging". Note : The default HTTP port used by the "standalone-messaging" configuration also happens to be 8080, which would conflict with your Glassfish V2 default HTTP port. Either modify your GLASSFISH_HOME/domains/ For the purpose of this document Jboss AS is installed under JBOSS_HOME, Glassfish V2 is installed under GLASSFISH_HOME. * Modify the Glassfish domain's classpath to add JBoss jars located in JBoss AS installation lib directory. The asadmin GUI could be used to modify a domain's classpath. Open a browser and type the url of the application server admin GUI - https://hostname:adminport. Go to Configuration -> server-config -> JVM Settings -> Path Settings . Add an entry for the jar files shown below in the classpath suffix. Restart the application server domain for these changes to take effect. JBOSS_HOME/server/standalone-messaging/lib/jboss-messaging.jar * Edit the server.policy file in the [GLASSFISH_HOME/domains/domain1/config/] directory using your favourite text editor and add the following line to the default grant block. permission java.util.logging.LoggingPermission "control"; permission javax.security.auth.PrivateCredentialPermission "javax.resource.spi.security.PasswordCredential * \"*\"","read";
The Jboss naming service is used to store the Message queue administered object such a queues and connection factories. There are a few administered objects bound by default when jboss AS starts up, like /queue/A, /queue/B, java:/XAConnectionFactory, /XAConnectionFactory..... After completing the steps mentioned in the "Initial Setup" section, start the Jboss AS (which starts the jboss messaging service). JBOSS_HOME/bin/run.sh -c standalone-messaging Make sure that the server starts up successfully without any error messages. * Add ${appserver-install-dir}/bin to your PATH. The asadmin CLI command can be found at ${appserver-install-dir}/bin. In glassfish a resource adapter configuration is used to specify the configuration of a resource adapter. Use the following command to create a resource adapter configuration for genericra, to configure it to work with Jboss Messaging 1.0.1. asadmin create-resource-adapter-config --user <adminname> --password <admin password> --property SupportsXA=true:ProviderIntegrationMode=jndi:UserName=guest:Password=guest:RMPolicy=OnePerPhysicalConnection: A brief description of the various properties used in the above command is explained below: ProviderIntegrationMode Username and Password JndiProperties RMPolicy Deploying the Resource adapter * Download the Generic RA bits from the project site. With Glassfish V2, Generic RA is available out-of-the-box with the application server and you could choose to use the bundle resource adapter as well in the step below. * Deploy the resource adapter using the asadmin deploy command, as shown below. In the image above, see Generic JMS RA deployed in the application server. $ asadmin deploy --user admin --password adminadmin <location of the generic resource adapter rar file> Creating Connection Factories and Administered Objects in Glassfish. Connector connection pool creation Admin Objects Component Deployment descriptors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>MyBean</ejb-name>
<jndi-name>sunMDB</jndi-name>
<resource-ref>
<res-ref-name>jms/MyQueueConnectionFactory</res-ref-name>
<jndi-name>jms/MyQCF</jndi-name>
</resource-ref>
<resource-env-ref>
<resource-env-ref-name>jms/OutQueue</resource-env-ref-name>
<jndi-name>jms/OutQueue</jndi-name>
</resource-env-ref>
<bean-pool>
<steady-pool-size>10</steady-pool-size>
<resize-quantity>2</resize-quantity>
<max-pool-size>30</max-pool-size>
<pool-idle-timeout-in-seconds>60</pool-idle-timeout-in-seconds>
</bean-pool>
<mdb-resource-adapter>
<resource-adapter-mid>genericra</resource-adapter-mid>
<activation-config>
<activation-config-property>
<activation-config-property-name>DestinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>MaxPoolSize</activation-config-property-name>
<activation-config-property-value>30</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>RedeliveryAttempts</activation-config-property-name>
<activation-config-property-value>3</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>RedeliveryInterval</activation-config-property-name>
<activation-config-property-value>1</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>ReconnectAttempts</activation-config-property-name>
<activation-config-property-value>1000</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>ReconnectInterval</activation-config-property-name>
<activation-config-property-value>1</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>DestinationJndiName</activation-config-property-name>
<activation-config-property-value>/queue/A</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>ConnectionFactoryJndiName</activation-config-property-name>
<activation-config-property-value>java:/XAConnectionFactory</activation-config-property-value>
</activation-config-property>
</activation-config>
</mdb-resource-adapter>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
The business logic encoded in Message Driven Bean could then lookup the configured QueueConnectionFactory/Destination resource
Simple Client
Known issues : The exception shown below might be encountered in the server.log (domains/ javax.jms.IllegalStateException: Cannot set a null MessageListener on the session
Resources
* Generic Resource Adapter for JMS community page - download/documentation
o Community Page https://genericjmsra.dev.java.net
o Please use the user/dev mailing lists at the project site for all your queries.
* Generic Resource Adapter for JMS user guide
o https://genericjmsra.dev.java.net/docs/userguide/userguide.html
* Project GlassFish
o http://glassfish.dev.java.net
* Jboss Messaging
o http://www.jboss.com/products/messaging
* JBoss Application Server
o http://www.jboss.com/products/jbossas
* For additional information on the 'RMPolicy' resource adapter configuration attribute refer issue#5 in the Generic RA issue tracker page. For documentation on usage of this attribute refer the Generic Resource Adapter for JMS user guide.
o https://genericjmsra.dev.java.net/issues/show_bug.cgi?id=5
»
Related Topics >>
J2EE Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|