Thank you, egoodenuf.
There are two problems to resolve. We need to:
- somehow create the initial tables in the hsqldb database
- make sure Maven knows where to look for AlbumDaoTest
Create initial tables in the hsqldb database
If you look under
wrox-pix-web/src/test/resources, you will find a file named
pixhsql.sql This file is an SQL command file. Load it into a text editor to view if you are curious. It basically contains the SQL commands to create the required tables.
In step 3 on Page 61. Just before running the command:
java -cp ./target/pixweb-0.0.1/WEB-INF/lib/hsqldb-1.8.0.7.jar org.hsqldb.util.SqlTool pix-sa
You should first run the following command to create the tables:
java -cp ./target/pixweb-0.0.1/WEB-INF/lib/hsqldb-1.8.0.7.jar org.hsqldb.util.SqlTool pix-sa src/test/resources/pixhsql.sql
The output you will see is:
1 row updated
1 row updated
Make sure Maven knows where to look for AlbumDaoTest
As egoodenuf has kindly pointed out, the Maven exec plugin is simply looking in the wrong places for
AlbumDaoTest classes. This appears to be a change in default plugin behavior since publication of the book.
Now, you need to explicitly tell Maven to look under
test-classes for
AlbumDaoTest. This is the default destination classpath for compiled tests.
On page 62, step 4, the command to execute the
AlbumDaoTest needs to be modified slightly:
mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass=com.wrox.beginspring.pix.dao.examp les.AlbumDaoTest
The additional
-Dexec.classpathScope=test tells Maven to include the default test classpath when looking for Java classes to execute.
The above changes should enable you to successfully run the JDBC example
AlbumDaoTest.