// Example from 'maruthi at aprameyah.com'
This project demonstrates how an EAR archive with an MDB can be created.
The project also demonstrates the use of an utility jar and the JNDI based datasource.
The project also demonstrates how to send a message to the MDB for testing.
This can be imported as an eclipse project.
Description of files:
build.xml: Builds the MDB jar file into the EAR folder
jbossmq-destinations-service.xml: The file that contains the Queue configuration for JBoss. Compare this with the file located in jboss\server\default\deploy\jms folder to understad the configuration of a new queue in jboss
mysql-ds.xml: the file that configures a MySQL database connection factory in JNDI. You might have to edit to suit your database. For use with other types of databases, refer to sample configuration XML files in jboss\docs\examples\jca folder
mysql-connector-java-5.0.5-bin.jar: this is the MySQL JDBC driver. Should be placed in jboss\server\default\lib folder so that the connection can be made
testMDB.java: the main method class that can be used to send a message to the MDB for testing
MyMDBean.java - the MDB class
Procedure to setup this archive:
1. create the Q required by copying jbossmq-destinations-service.xml to jboss\server\default\jms folder
2. create the database connection factory by copying mysql-ds.xml to jboss\server\default\deploy folder
3. Run the build.xml to create the EJB jar
4. Copy the SampleMDB.ear to jboss\server\default\deploy folder
5. Start jboss and run the testMDB.java to send the message for testing.
EclipseProjectMDB.zip( 4,511 k)