
EJB
™
Development Using Borland
®
JBuilder
®
8 and BEA WebLogic Server
™
7.0
50
Right-click the MDB TestJMS and click View bean source. Change the onMessage()
method of TestJMSBean.java as follows:
public void onMessage(Message msg) {
try {
TextMessage txtMessage = (TextMessage) msg;
System.out.println("Message from EJB TestJMS = " +
txtMessage.getText());
}
catch (JMSException ex) {
}
}
Note: The on Message (message) method gets executed when the MDB receives a message. In
this case, the on Message (message) method will print the received message.
Make the project and make sure that there are no build errors.
Deploy and run the MDB
Create a runtime configuration to start the WebLogic Server within JBuilder. From JBuilder
main menubar, click Run -> Configuration -> click New. In the Runtime Configuration
Properties window enter name as Start WebLogic 7.0 and Build Target as <None>.
Start WebLogic Server within JBuilder (click Run icon from JBuilder toolbar-> click Start
WebLogic 7.0).
Deploy TestJMSMod to WebLogic Server (right-click TestJMSMod -> click Deploy options
for TestJMSMod.jar -> click Deploy).
Test the MDB
To test the MDB TestJMS, create a test client. A test client can be created by clicking File ->
New -> General tab of Object Gallery -> Class -> Click OK.
Comentarios a estos manuales