Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. In WebMDB project select WebContent/WEB-INF/geronimo-web.xml and modify the content with the one shown below.
    Code Block
    titlegeronimo-web.xml
    borderStylesolid
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns8:web-app xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2" 
    xmlns:ns2="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" 
    xmlns:ns3="http://geronimo.apache.org/xml/ns/naming-1.2" 
    xmlns:ns4="http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0" 
    xmlns:ns5="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" 
    xmlns:ns6="http://geronimo.apache.org/xml/ns/security-2.0" 
    xmlns:ns7="http://java.sun.com/xml/ns/persistence" 
    xmlns:ns8="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" 
    xmlns:ns9="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0">
        <environment>
            <moduleId>
                <groupId>default</groupId>
                <artifactId>WebMDB</artifactId>
                <version>1.0</version>
                <type>car</type>
            </moduleId>
            <dependencies>
                <dependency>
                    <groupId>default</groupId>
                    <artifactId>MessageDrivenBean</artifactId>
                    <version>1.0</version>
                    <type>car</type>
                </dependency>
            <dependency>
                    <groupId>org.apache.geronimo.configs</groupId>
                    <artifactId>activemq-ra</artifactId>
                    <version>2.1.1</version>
                    <type>car</type>
                </dependency> 
            </dependencies>
        </environment>
        <ns8:context-root>/WebMDB</ns8:context-root>
        <ns3:resource-ref>
            <ns3:ref-name>testfactory</ns3:ref-name>
            <ns3:resource-link>DefaultActiveMQConnectionFactory</ns3:resource-link>
       		</ns3:resource-ref>
    </ns8:web-app>
    
  2. In MessageDrivenBean project select META-INF/openejb-jar.xml and modify it as follows
    Code Block
    titleopenejb-jar.xml
    borderStylesolid
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2" 
    xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" 
    xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" 
    xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.2" 
    xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <sys:environment>
            <sys:moduleId>
                <sys:groupId>default</sys:groupId>
                <sys:artifactId>MessageDrivenBean</sys:artifactId>
                <sys:version>1.0</sys:version>
                <sys:type>car</sys:type>
            </sys:moduleId>
            <sys:dependencies>
            <sys:dependency>
            <sys:groupId>org.apache.geronimo.configs</sys:groupId>
            <sys:artifactId>activemq-ra</sys:artifactId>
            <sys:version>2.1.1</sys:version>
            <sys:type>car</sys:type>
            </sys:dependency>
            </sys:dependencies>
            </sys:environment>
            <enterprise-beans>
              <message-driven>
                <ejb-name>AdminMDB</ejb-name>
        		<nam:resource-adapter>
         		<nam:resource-link>ActiveMQ RA</nam:resource-link>
        		</nam:resource-adapter>
        		
        		<activation-config>
    
         <activation-config-property>
          <activation-config-property-name>
           destination
          </activation-config-property-name>
          <activation-config-property-value>
          SendReceiveQueue
          </activation-config-property-value>
         </activation-config-property>
          <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>
       			</message-driven>
                </enterprise-beans>
    </openejb-jar>
    



    Deploy and Run

  3. Export MessageDrivenBean.jar and WebMDB.war from eclipse as shown in the figure below








  4. Launch Administrative console and deploy the EJB and Web Application using Deploy New.
  5. Once done launch the web application with http://localhost:8080/WebMDB/.\\

  6. Fill the form as suggested in the figure and Select Submit.





  7. Once done check out the command prompt. Message Driven Bean has triggered and it displays the message currently on the queue.