Running the mailconnector Example - The Java EE 6 Tutorial
2. Using the Tutorial Examples
3. Getting Started with Web Applications
4. JavaServer Faces Technology
7. Using JavaServer Faces Technology in Web Pages
8. Using Converters, Listeners, and Validators
9. Developing with JavaServer Faces Technology
10. JavaServer Faces Technology: Advanced Concepts
11. Using Ajax with JavaServer Faces Technology
12. Composite Components: Advanced Topics and Example
13. Creating Custom UI Components and Other Custom Objects
14. Configuring JavaServer Faces Applications
16. Uploading Files with Java Servlet Technology
17. Internationalizing and Localizing Web Applications
18. Introduction to Web Services
19. Building Web Services with JAX-WS
20. Building RESTful Web Services with JAX-RS
21. JAX-RS: Advanced Topics and Example
23. Getting Started with Enterprise Beans
24. Running the Enterprise Bean Examples
25. A Message-Driven Bean Example
26. Using the Embedded Enterprise Bean Container
27. Using Asynchronous Method Invocation in Session Beans
Part V Contexts and Dependency Injection for the Java EE Platform
28. Introduction to Contexts and Dependency Injection for the Java EE Platform
29. Running the Basic Contexts and Dependency Injection Examples
30. Contexts and Dependency Injection for the Java EE Platform: Advanced Topics
31. Running the Advanced Contexts and Dependency Injection Examples
32. Introduction to the Java Persistence API
33. Running the Persistence Examples
34. The Java Persistence Query Language
35. Using the Criteria API to Create Queries
36. Creating and Using String-Based Criteria Queries
37. Controlling Concurrent Access to Entity Data with Locking
38. Using a Second-Level Cache with Java Persistence API Applications
39. Introduction to Security in the Java EE Platform
40. Getting Started Securing Web Applications
41. Getting Started Securing Enterprise Applications
42. Java EE Security: Advanced Topics
Part VIII Java EE Supporting Technologies
43. Introduction to Java EE Supporting Technologies
45. Resources and Resource Adapters
46. The Resource Adapter Example
47. Java Message Service Concepts
48. Java Message Service Examples
49. Bean Validation: Advanced Topics
50. Using Java EE Interceptors
51. Duke's Bookstore Case Study Example
52. Duke's Tutoring Case Study Example
53. Duke's Forest Case Study Example
You can use either NetBeans IDE or Ant to build, package, deploy, and run the mailconnector example.
Before You Deploy the mailconnector Example
Before you deploy the mailconnector application, perform the following steps.
- Download mock-javamail-1.9.jar from http://download.java.net/maven/2/org/jvnet/mock-javamail/mock-javamail/1.9/.
- Copy this JAR file to the directory as-install/lib.
- Restart GlassFish Server.
- Open the GlassFish Server Administration Console in a web browser at http://localhost:4848.
- In the Administration Console, expand the Configurations node, then expand the server-config node.
- Select the Security node.
- Select the Default Principal to Role Mapping Enabled check box.
- Click Save.
To Build, Package, and Deploy the mailconnector Example Using NetBeans IDE
- From the File menu, choose Open Project.
- In the Open Project dialog, navigate to:
tut-install/examples/connectors/mailconnector/
- Select the mailconnector-ra folder and click Open Project.
- In the Projects tab, right-click the mailconnector-ra project and select Build.
This command builds the resource adapter. It also places identical files named mailconnector.rar and mailconnector.jar in the mailconnector directory.
- In the Projects tab, right-click the mailconnector-ra project and select Deploy.
- From the File menu, choose Open Project.
- In the Open Project dialog, navigate to:
tut-install/examples/connectors/mailconnector/
- Select the mailconnector-ear folder.
- Select the Open Required Projects check box and click Open Project.
- In the Projects tab, right-click the mailconnector-ear project and select Build.
- In a terminal window, navigate to:
tut-install/examples/connectors/mailconnector/mailconnector-ear/
- Enter the following command to create the resources and users:
ant setup
- In NetBeans IDE, in the Projects tab, right-click the mailconnector-ear project and select Deploy.
To Build, Package, and Deploy the mailconnector Example Using Ant
- In a terminal window, go to:
tut-install/examples/connectors/mailconnector/mailconnector-ear/
- Enter the following command:
ant all
This command builds and deploys the mailconnector-ra RAR file, sets up users and resources, then builds and deploys the mailconnector-ear EAR file. It also places identical files named mailconnector.rar and mailconnector.jar in the mailconnector directory.
To Run the mailconnector Example
- In a web browser, navigate to the following URL:
http://localhost:8080/mailconnector-war/
- Log in with a user name of either user1, user2, user3, or
user4. The password is the same as the user name.
You can send messages and browse for the messages you sent. The messages you sent are available 30 seconds after you sent them.
For example, you can log in as user1 and send a message to user4, then log in as user4 and query for messages. In the form for browsing messages, verify that the fields are correct, then click Browse.
View the server log to follow the flow of the application. Most classes and methods specify logging information that makes the sequence of events easy to follow.
- Before you undeploy the application, in a terminal window, navigate to tut-install/examples/connectors/mailconnector/mailconnector-ear/ and
enter the following command to remove the resources and users:
ant takedown
You cannot undeploy the resource adapter until you run this command.
Next Steps
When you clean the application, you can also remove the mailconnector.rar and mailconnector.jar files from the mailconnector directory.
Remove the mock-javamail-1.9.jar file from the as-install/lib directory if you might run any other applications that use the JavaMail API (for example, The async Example Application).
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices


