10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Enterprise Bean Example Applications<br />

822<br />

If the username and password you enter are authorized, you will see the output of the<br />

application client in the Output pane:<br />

...<br />

Retrieving book title from cart: Infinite Jest<br />

Retrieving book title from cart: Bel Canto<br />

Retrieving book title from cart: Kafka on the Shore<br />

Removing "Gravity’s Rainbow" from cart.<br />

Caught a BookException: "Gravity’s Rainbow" not in cart.<br />

<strong>Java</strong> Result: 1<br />

run-cart-secure-app-client:<br />

Building, Deploying, and Running the Secure Cart Example Using Ant<br />

To build, deploy, and run the secure EJB example using the Ant tool, follow these steps:<br />

1. If you have not already done so, specify properties specific to your installation in the<br />

tut-install/javaeetutorial5/examples/bp-project/build.properties file and the<br />

tut-install/javaeetutorial5/examples/common/admin-password.txt file. See “Building<br />

the Examples” on page 69 for information on which properties need to be set in which files.<br />

2. If you have not already done so, add a user to the file realm and specify user for the group<br />

of this new user. Refer to the section “Managing Users and Groups on the Application<br />

Server” on page 779 for instructions on completing this step.<br />

3. From a terminal window or command prompt, go to the<br />

tut-install/javaeetutorial5/examples/ejb/cart-secure/ directory.<br />

4. Build, package, and deploy the enterprise application, and build and run the client, by<br />

entering the following at the terminal window or command prompt in the<br />

ejb/cart-secure/ directory:<br />

ant all<br />

Note – This step assumes that you have the executable for ant in your path; if not, you will<br />

need to provide the fully qualified path to the ant executable. This command runs the ant<br />

target named all in the build.xml file.<br />

5. A Login for User dialog displays. Enter a user name and password that correspond to a user<br />

set up on the Application Server with a group of user. Click OK.<br />

If the user name and password are authenticated, the client displays the following output:<br />

run:<br />

[echo] Running appclient for Cart.<br />

appclient-command-common:<br />

[exec] Infinite Jest<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!