Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.2.0 and MVC Step by Step Chapter 5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.2.0 and MVC Step by Step Chapter 5

    Hello,

    I've been working through the MVC Step by Step tutorial against Spring 3.2.0 and Java Hotspot 1.6.20. I didn't experience any trouble until I reached chapter 5. Assuming I managed to follow the directions correctly I ran into the following error when running the dbTests ant task:

    Code:
    buildtests:
        [javac] /home/husseinb/Projects/springapp/build.xml:87: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 4 source files to /home/husseinb/Projects/springapp/war/WEB-INF/classes
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:5: cannot find symbol
        [javac] symbol: class AbstractTransactionalDataSourceSpringContextTests
        [javac] public class JdbcProductDaoTests extends AbstractTransactionalDataSourceSpringContextTests {
        [javac]                                          ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:14: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:21: cannot find symbol
        [javac] symbol  : variable super
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         super.deleteFromTables(new String[] {"products"});
        [javac]         ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:22: cannot find symbol
        [javac] symbol  : variable super
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         super.executeSqlScript("file:db/load_data.sql", true);
        [javac]         ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:19: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:27: cannot find symbol
        [javac] symbol  : class Product
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         List<Product> products = productDao.getProductList();
        [javac]              ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:29: cannot find symbol
        [javac] symbol  : method assertEquals(java.lang.String,int,int)
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         assertEquals("wrong number of products?", 3, products.size());
        [javac]         ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:35: cannot find symbol
        [javac] symbol  : class Product
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         List<Product> products = productDao.getProductList();
        [javac]              ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:37: cannot find symbol
        [javac] symbol  : class Product
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         for (Product p : products) {
        [javac]              ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:42: cannot find symbol
        [javac] symbol  : class Product
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         List<Product> updatedProducts = productDao.getProductList();
        [javac]              ^
        [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:43: cannot find symbol
        [javac] symbol  : class Product
        [javac] location: class springapp.repository.JdbcProductDaoTests
        [javac]         for (Product p : updatedProducts) {
        [javac]              ^
        [javac] 11 errors

    Which was resolved by adding the following import statements to JdbcProductDaoTests.java :

    Code:
    import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
    import springapp.domain.Product;
    Working output:

    Code:
    dbTests:
        [junit] Running springapp.repository.JdbcProductDaoTests
        [junit] Testsuite: springapp.repository.JdbcProductDaoTests
        [junit] May 31, 2010 7:07:08 PM org.springframework.test.AbstractSingleSpringContextTests loadContextLocations
        [junit] INFO: Loading context for locations: classpath:test-context.xml
        [junit] May 31, 2010 7:07:08 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
        [junit] INFO: Loading XML bean definitions from class path resource [test-context.xml]
        [junit] May 31, 2010 7:07:08 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
        [junit] INFO: Refreshing [email protected]e14a: startup date [Mon May 31 19:07:08 BST 2010]; root of context hierarchy
        [junit] May 31, 2010 7:07:08 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
        [junit] INFO: Loading properties file from class path resource [jdbc.properties]
        [junit] May 31, 2010 7:07:08 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
        [junit] INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@102b2b6: defining beans [productDao,dataSource,propertyConfigurer,transactionManager]; root of factory hierarchy
        [junit] May 31, 2010 7:07:08 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
        [junit] INFO: Loaded JDBC driver: org.hsqldb.jdbcDriver
        [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests deleteFromTables
        [junit] INFO: Deleted 3 rows from table products
        [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
        [junit] INFO: Executing SQL script 'file:db/load_data.sql'
        [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
        [junit] INFO: Done executing SQL scriptBuilder 'file:db/load_data.sql' in 13 ms
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao getProductList
        [junit] INFO: Getting products!
        [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests deleteFromTables
        [junit] INFO: Deleted 3 rows from table products
        [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
        [junit] INFO: Executing SQL script 'file:db/load_data.sql'
        [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
        [junit] INFO: Done executing SQL scriptBuilder 'file:db/load_data.sql' in 5 ms
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao getProductList
        [junit] INFO: Getting products!
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
        [junit] INFO: Saving product: Lamp
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
        [junit] INFO: Rows affected: 1
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
        [junit] INFO: Saving product: Table
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
        [junit] INFO: Rows affected: 1
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
        [junit] INFO: Saving product: Chair
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
        [junit] INFO: Rows affected: 1
        [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao getProductList
        [junit] INFO: Getting products!
        [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 1.149 sec
        [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 1.149 sec

    Can anyone confirm this was indeed a typo in the tutorial or if the error could be attributed to using the new version of Spring/JDK?

    cheers,
    Hoos
    Last edited by h0o5; May 31st, 2010, 05:16 PM.

  • #2
    Got same error when working with Spring Framework 2.5.6

    Hi,

    Thanks for your post. I was stuck too with the same error messages.

    After adding the imports as suggested by you, I am able to successfully compile and deploy.

    Thanks,
    Prince Richard

    Comment


    • #3
      spring tut. part 5

      Yes It was the same error with 2.5 version. So its evident that the authors strayed out of the righteous path after some redundant information pasting..
      Anyway with the imports suggested by you, all works well.
      Finally as a note from my side:
      there were default users commented out, and so avoid loosing time in searching for the reason, but just un comment them.
      ciao!

      Originally posted by h0o5 View Post
      Hello,

      I've been working through the MVC Step by Step tutorial against Spring 3.2.0 and Java Hotspot 1.6.20. I didn't experience any trouble until I reached chapter 5. Assuming I managed to follow the directions correctly I ran into the following error when running the dbTests ant task:

      Code:
      buildtests:
          [javac] /home/husseinb/Projects/springapp/build.xml:87: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
          [javac] Compiling 4 source files to /home/husseinb/Projects/springapp/war/WEB-INF/classes
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:5: cannot find symbol
          [javac] symbol: class AbstractTransactionalDataSourceSpringContextTests
          [javac] public class JdbcProductDaoTests extends AbstractTransactionalDataSourceSpringContextTests {
          [javac]                                          ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:14: method does not override or implement a method from a supertype
          [javac]     @Override
          [javac]     ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:21: cannot find symbol
          [javac] symbol  : variable super
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         super.deleteFromTables(new String[] {"products"});
          [javac]         ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:22: cannot find symbol
          [javac] symbol  : variable super
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         super.executeSqlScript("file:db/load_data.sql", true);
          [javac]         ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:19: method does not override or implement a method from a supertype
          [javac]     @Override
          [javac]     ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:27: cannot find symbol
          [javac] symbol  : class Product
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         List<Product> products = productDao.getProductList();
          [javac]              ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:29: cannot find symbol
          [javac] symbol  : method assertEquals(java.lang.String,int,int)
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         assertEquals("wrong number of products?", 3, products.size());
          [javac]         ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:35: cannot find symbol
          [javac] symbol  : class Product
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         List<Product> products = productDao.getProductList();
          [javac]              ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:37: cannot find symbol
          [javac] symbol  : class Product
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         for (Product p : products) {
          [javac]              ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:42: cannot find symbol
          [javac] symbol  : class Product
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         List<Product> updatedProducts = productDao.getProductList();
          [javac]              ^
          [javac] /home/husseinb/Projects/springapp/test/springapp/repository/JdbcProductDaoTests.java:43: cannot find symbol
          [javac] symbol  : class Product
          [javac] location: class springapp.repository.JdbcProductDaoTests
          [javac]         for (Product p : updatedProducts) {
          [javac]              ^
          [javac] 11 errors

      Which was resolved by adding the following import statements to JdbcProductDaoTests.java :

      Code:
      import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
      import springapp.domain.Product;
      Working output:

      Code:
      dbTests:
          [junit] Running springapp.repository.JdbcProductDaoTests
          [junit] Testsuite: springapp.repository.JdbcProductDaoTests
          [junit] May 31, 2010 7:07:08 PM org.springframework.test.AbstractSingleSpringContextTests loadContextLocations
          [junit] INFO: Loading context for locations: classpath:test-context.xml
          [junit] May 31, 2010 7:07:08 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
          [junit] INFO: Loading XML bean definitions from class path resource [test-context.xml]
          [junit] May 31, 2010 7:07:08 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
          [junit] INFO: Refreshing [email protected]e14a: startup date [Mon May 31 19:07:08 BST 2010]; root of context hierarchy
          [junit] May 31, 2010 7:07:08 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
          [junit] INFO: Loading properties file from class path resource [jdbc.properties]
          [junit] May 31, 2010 7:07:08 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
          [junit] INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@102b2b6: defining beans [productDao,dataSource,propertyConfigurer,transactionManager]; root of factory hierarchy
          [junit] May 31, 2010 7:07:08 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
          [junit] INFO: Loaded JDBC driver: org.hsqldb.jdbcDriver
          [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests deleteFromTables
          [junit] INFO: Deleted 3 rows from table products
          [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
          [junit] INFO: Executing SQL script 'file:db/load_data.sql'
          [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
          [junit] INFO: Done executing SQL scriptBuilder 'file:db/load_data.sql' in 13 ms
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao getProductList
          [junit] INFO: Getting products!
          [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests deleteFromTables
          [junit] INFO: Deleted 3 rows from table products
          [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
          [junit] INFO: Executing SQL script 'file:db/load_data.sql'
          [junit] May 31, 2010 7:07:09 PM org.springframework.test.AbstractTransactionalDataSourceSpringContextTests executeSqlScript
          [junit] INFO: Done executing SQL scriptBuilder 'file:db/load_data.sql' in 5 ms
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao getProductList
          [junit] INFO: Getting products!
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
          [junit] INFO: Saving product: Lamp
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
          [junit] INFO: Rows affected: 1
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
          [junit] INFO: Saving product: Table
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
          [junit] INFO: Rows affected: 1
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
          [junit] INFO: Saving product: Chair
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao saveProduct
          [junit] INFO: Rows affected: 1
          [junit] May 31, 2010 7:07:09 PM springapp.repository.JdbcProductDao getProductList
          [junit] INFO: Getting products!
          [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 1.149 sec
          [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 1.149 sec

      Can anyone confirm this was indeed a typo in the tutorial or if the error could be attributed to using the new version of Spring/JDK?

      cheers,
      Hoos

      Comment

      Working...
      X