reset password
Author Message
Yuan-Yu
Posts: 21
Posted 01:16 Jan 28, 2015 |

Hello,

I was able to run UserDaoTest.java as TestNG successfully. However, after I created my own classes(ex: Student.java, Checkpoint.java, etc.) in the same project but different package, it turns wrong. It shows an exception: Failed to load ApplicationContext. What is the problem? I didn't change anything in example files. All I have done is creating new classes. Why does it matter?

Thank you for your answer.

Last edited by Yuan-Yu at 01:18 Jan 28, 2015.
cysun
Posts: 2935
Posted 09:16 Jan 28, 2015 |

It matters because Spring initializes all the beans when the application starts. If one bean (e.g. a newly created DaoImpl) has a problem, it'll cause an error like "failed to load application context" and the whole application fails.

Again, read the error message carefully - try finding the line that states exactly what the problem is.

Yuan-Yu
Posts: 21
Posted 09:43 Jan 28, 2015 |

Hello,

Just found out the problem. Post it here in case someone has same problem as I had.

Use multiple "fetch=FetchType.EAGER" carefully. It may cause an error: cannot simultaneously fetch multiple bags.

Last edited by Yuan-Yu at 09:54 Jan 28, 2015.