Results 1 to 2 of 2

Thread: Errors while running tests: Failed to load ApplicationContext

  1. #1

    Default Errors while running tests: Failed to load ApplicationContext

    Hi!

    I created a Roo project and built up a nice little model. Had it all working fine. Then I did a 'web mvc setup' and setup controllers for everything. Then, I decided I didn't want to have the web mvc integration here, so I deleted the controllers and the src/main/webapp directories. Now I can't run the tests.

    I am using Spring Roo 1.2.1 with STS 2.8.1 on a Mac, Lion, with JDK 1.6. I can't say for certain whether or not my brute force removal of things is the cause; it seems like it is, but I don't remember running the tests prior to now.

    When I do a 'mvn clean test' from the command line. When I look at the test results, I see lots of these:

    2012-02-29 22:03:14,918 [main] ERROR org.springframework.test.context.TestContextManage r - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener@525c7734] to prepare test instance [com.loquatic.clcmops.consignortool.AddressIntegrat ionTest@3496212a]
    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:157)

    In the surefire-reports output.

    I want to be able to build the Roo as it's own jar file and then create a separate Web MVC project and create the dependency via Maven rather than have it all in one project - I know I can do this all in Roo but I don't know the MVC framework and I want to keep things separate. I am not really a Web/UI guy and I find that the scaffolding just confuses me; I digress.

    My question is, does this seem like something I caused and if so (and even if not) what do I have to do get past it?

    Thanks!

  2. #2

    Default

    The issue seems to have had to do with the contents of the applicationContent.xml. My file had this:

    <context:component-scan base-package="com.loquatic.clcmops.consignortool">

    Though the package that the tests were in was in com.loquatic.clcmops.consignortool.entities, so changing the entry to this:

    <context:component-scan base-package="com.loquatic.clcmops.consignortool.entiti es">

    Fixes the issue.

    When I created this project, using the STS wizards (rather than the pure Roo shell) I see this in the log.roo:

    project --topLevelPackage com.loquatic.clcmops.consignortool --projectName consignortool --java 6

    So my guess is that whatever created the applicationContext.xml used that --topLevelPackage argument and it never got updated. Anyway, moving on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •