Errata -Beginning EJB 3 Application Development

Chapter 1 - Introduction to EJB 3 Architecture

GlassFish application server is installed in c:\Software directory instead of c:\Software\GlassFish as mentioned in Page 16

Password file creation

There is one missing step, which is creation of a password file for GlassFish application server. This password file is used in all commands that are executed using asadmin utility or from all the Ant tasks, that you use to run the samples in different chapters. After you installed GlassFish server and setup the environment variables, create a file with asadminpass in %GLASSFISH_HOME% directory. This file should have the following one line

AS_ADMIN_PASSWORD=adminadmin

If you changed the default password, for you GlassFish application server, then substitue that password with adminadmin.

More information for GlassFish application server can be found at

https://glassfish.dev.java.net/javaee5/docs/DocsIndex.html

Copying JDBC driver

The wine store application, which is the sample application in the book, has been developed with the Oracle database as the data tier. You will have to copy right version of the JDBC drivers for the Oracle database into the %GLASSFISH_HOME%/lib directory. We have copied the ojdbc14.jar file that works with Oracle 10g.

Chapter 2 - EJB 3 Session Beans

There is a typo on the second paragraph of page 37. PostConstruct was spelled as PostContruct.

Chapter 5 - EJB 3 Message-Driven Beans

Page 171 - In Creating the JMS and JavaMail Resources, there is a missing dash in front of restype in the command that is used to create StatusMessageTopicConnectionFactory. The correct command is

Z:\Chapter05-MDBSamples\MDBSamples>%GLASSFISH_HOME%/bin/asadmin.bat create-jms-resource --host localhost --port 4848 --user admin –passwordfile %GLASSFISH_HOME%\asadminpass --restype javax.jms.TopicConnectionFactory StatusMessageTopicConnectionFactory

Page 173 - There are missing dashes in the command that is used to create JavaMail resource. The correct command is

Z:\Chapter05-MDBSamples\MDBSamples>%GLASSFISH_HOME%/bin/asadmin.bat create-javamail-resource --host localhost --port 4848 --user admin --passwordfile %GLASSFISH_HOME%\asadminpass --mailhost localhost --mailuser wineapp@localhost --fromaddress wineapp@localhost mail/wineappMail

Page 174 - There are missing dashes in the command that is used to deploy the application. The correct command is

Z:\Chapter05-MDBSamples\MDBSamples>%GLASSFISH_HOME%/bin/asadmin.bat deploy --host localhost --port 4848 --user admin --passwordfile %GLASSFISH_HOME%\asadminpass --upload=true --target server z:\Chapter05-MDBSamples\MDBSamples\archive\MDBSamples.jar

Page 175 - A new Ant task Run-Client has been added to run the client program. In the command shell you can run the Ant task.

Z:\Chapter05-MDBSamples\MDBSamples\>%ANT_HOME%/bin/ant Run-Client

Chapter 6 - EJB 3 and Web Services

The correct command for generating Web Services Proxy Classes is as follows:

Z:\chapter06-WebServiceSamples\WebServiceSamples>%GLASSFISH_HOME%/bin/wsimport.bat -keep -d ./classes/client http://localhost:8080/CreditService/CreditCheckEndp ointBean?WSDL

Chapter 7 - Integrating Session Beans, Entities, Message-Driven Beans, and Web Services

Page 245 - Creating the Database Schema

Login to SQLPlus as system user.

Execute runsql.sql using SQLPlus.

runsql.sql and other dependent sql scripts are available in z:\chapter07-IntegratedSamples\IntegratedSamples\PersistenceUnit\sqlscripts directory.

Page 250 - There are missing dashes in the command that is used to deploy the application. The correct command is

Z:\chapter07-IntegratedSamples\IntegratedSamples>%GLASSFISH_HOME%/bin/ asadmin.bat deploy --host localhost --port 4848 --user admin --passwordfile %GLASSFISH_HOME%\asadminpass --upload=true --target server z:\chapter07-IntegratedSamples\IntegratedSamples\archive\winestore.ear

Page 253 - There is a missing forward slash in the command that is used to run the client program. The correct command is

Z:\chapter07-IntegratedSamples\IntegratedSamples\GLassFishUnitTests>%JAVA_HOME%/bin/javac -classpath %GLASSFISH_HOME%\lib\javaee.jar;..\archive\winestoreEJB.jar;..\archive\lib\punit.jar -d ../classes src\com\apress\ejb3\chapter07\client\*.java



Chapter 9 - EJB 3 Performance and Testing

This chapter compares JOINED and SINGLE_TABLE inheritance strategies in Java Persistence API (JPA). JOINED inheritance strategy uses the wineapp schema that is used for other chapter samples. We have a different schema to test SINGLE_TABLE strategy. You can install the SINGLE_TABLE wineapp schema by

Login to SQLPlus as system user.

Execute runsql.sql using SQLPlus.

runsql.sql and other dependent sql scripts are available in z:\chapter09-PerformanceSamples\PersistenceUnit-ST\sqlscripts directory.

Deploying JOINED inheritance strategy winestore application

To deploy the winestore application which is using JOINED inheritance strategy, execute the following Ant task.

Open a command shell.

Change directory to chapter09-PeformanceSamples which is in Chapter 9 directory in the downloaded source code.

Execute

%ANT_HOME%/bin/ant DeployWineStoreApplication

After sucessful deployment, you can run the application using the following URL.

http://localhost:8080/wineapp/faces/winestore.jsp

Substitute localhost and 8080, with the host that is running GlassFish server and the port that is configured.

Running SINGLE_TABLE inheritance strategy winestore application

To deploy the winestore application which is using SINGLE_TABLE inheritance strategy, execute the following Ant task.

Open a command shell.

Change directory to chapter09-Sample which is Chapter 9 directory in the downloaded source code.

Execute

%ANT_HOME%/bin/ant DeployWineStoreApplication-ST

The client application is a Java class that is executed from the Grinder. After setting up Grinder environment you can use the python script JEE.py in chapter09-PerformanceSamples/J2SECompareClientWithFacadeAccess directory.

 

Samples

The samples zip file contains the completed samples for each chapter. Each chapter sample comes with a set of Ant tasks, that will execute the sample code along with required pre-requiste steps. A master readme.txt is provided with the samples zip file which contains details on how to setup and run. Each chapter also comes with the readme files that details the tasks done by the sample.