The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

michaell (2) [Avatar] Offline
#1
Another problem has been occurred at Chapter 11 Ibatis.
I have no idea about why the test has been failed.

Please advise!

-------------------------------------------------------------------------------
Test set: net.chrisrichardson.foodToGo.viewOrdersTransactionScripts.dao.OrderDAOIBatisImplTests
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.656 sec <<< FAILURE!
testFindOrdersWithoutRonum(net.chrisrichardson.foodToGo.viewOrdersTransactionScripts.dao.OrderDAOIBatisImplTests) Time elapsed: 3.475 sec <<< ERROR!
com.ibatis.sqlmap.client.SqlMapException: There is no statement named findOrders in this SqlMap.
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:28smilie
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:601)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:105)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:82)
at org.springframework.orm.ibatis.SqlMapClientTemplate$4.doInSqlMapClient(SqlMapClientTemplate.java:256)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:165)
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:204)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:254)
at net.chrisrichardson.foodToGo.viewOrdersTransactionScripts.dao.OrderDAOIBatisImpl.findOrdersInlineWithoutRownum(OrderDAOIBatisImpl.java:87)
at net.chrisrichardson.foodToGo.viewOrdersTransactionScripts.dao.OrderDAOIBatisImplTests.testFindOrdersWithoutRonum(OrderDAOIBatisImplTests.java:49)
michaell (2) [Avatar] Offline
#2
Re: test failure at Ch 11 Ibatis
I have resolved the problem.
I have run the "mvn install" at every sub folders of each chapters.
Then the build and test has been successfully done.
I don't know why...
By the way, I am trying to make an eclipse project and am trying to test with IBM RAD6.

Thanks.
ceracm (113) [Avatar] Offline
#3
Re: test failure at Ch 11 Ibatis
Michael,

You should be able to just run 'mvn install' in the top level.

I guess I would do a 'mvn install clean' and see what happens.
If the individual installs succeeded I would expect the top-level to do so also.
To debug the problem I would need to see what tests failed - what is in the target/surefire-reports directories.
Did you set MAVEN_OPTS to increase the heap size?

Chris
ceracm (113) [Avatar] Offline
#4
Re: test failure at Ch 11 Ibatis
To create the eclipse projects just run 'mvn eclipse:eclipse' at the top-level.
That will create eclipse projects in the subdirs.

Chris
foreverman (4) [Avatar] Offline
#5
Re: test failure at Ch 11 Ibatis
This error occurs in module "pia-ch-11-queries-ibatis". it seems that it loads sqlMap-config.xml in module "pia-ch-09-transaction-scripts" instead of its own because it depends on module "pia-ch-09-transaction-scripts". So it can't find corresponding sql map
queries. (i don't know why this problem doesn't exist when i run command "mvn install" in directory "pia-ch-11-queries-ibatis").

The same problem does exist in module "pia-ch-12-concurrency-transaction-script".

My solution: rename sqlMap-config.xml to another name such as sqlMap-config_09.xml
in directory "pia-ch-09-transaction-scriptssrcmain esources", then modify "place-order-ibatis-config.xml" and "place-order-ibatis-dao.xml" to point to new sqlMap file name:sqlMap-config_09.xml. So module "pia-ch-12-concurrency-transaction-script" and module "pia-ch-11-queries-ibatis" will never load sqlMap-config.xml in module "pia-ch-09-transaction-scripts".
Hope this can help.