To build, deploy, and run the application using NetBeans IDE, do the following:
In NetBeans IDE, choose Open Project from the File menu.
In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/ejb/.
Select the simplemessage folder.
Select the Open as Main Project check box and the Open Required Projects check box.
Click Open Project.
Right-click the simplemessage project and choose Build.
This task packages the application client and the message-driven bean, then creates a file named simplemessage.ear in the dist directory.
Right-click the project and choose Undeploy and Deploy.
Right-click the project and choose Run.
This command returns a JAR file named simplemessageClient.jar and then executes it.
The output of the application client in the Output pane looks like this:
Sending message: This is message 1 Sending message: This is message 2 Sending message: This is message 3 To see if the bean received the messages, check <install_dir>/domains/domain1/logs/server.log.
The output from the message-driven bean appears in the server log (domain-dir/logs/server.log), wrapped in logging information.
MESSAGE BEAN: Message received: This is message 1 MESSAGE BEAN: Message received: This is message 2 MESSAGE BEAN: Message received: This is message 3
The received messages often appear in a different order from the order in which they were sent.
Undeploy the application after you finish running the client. To undeploy the application, follow these steps:
Click the Services tab.
Expand the Servers node.
Expand the Sun Java System Application Server node.
Expand the Applications node.
Expand the Enterprise Applications node.
Right-click simplemessage and choose Undeploy.
To remove the generated files, right-click the simplemessage project and choose Clean.