Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Single context loading for all test classes

  1. #11
    Join Date
    Aug 2004
    Location
    Los Angeles, USA
    Posts
    62

    Default

    In fact the "AbstractDependencyInjectionSpringContextTests " class does correctly cache the applicationcontext. The problem is that even though the applicationcontext is cached, my Hibernate session factory does get rebuild.

  2. #12
    Join Date
    Aug 2004
    Location
    Los Angeles, USA
    Posts
    62

    Default

    ok. I figured out a bug in the way I implemented the test class. Now I dig into Maven and see what's going on there.

  3. #13
    Join Date
    Oct 2004
    Posts
    2

    Default Problem with ContextTestCase

    Hi there.
    First I'd like to thank feester for the class. Great job.

    Now, the problem I am having. I am able to pass the xml files and the loading starts with no problem.
    During the initialization of a bean with property defined as follows
    Code:
    <property name="location">
         <value>/WEB-INF/my.properties</value>
    </property>
    I get a nested exception java.io.FileNotFoundException: Could not open class path resource [WEB-INF/my.properties].

    If I remove the /WEB-INF/ from the value field everything works perfectly.
    Or, without removing that, I can add my root to the classpath, but I do not want to do that.

    I have tried to add such resource dynamically to the class path but I could not figure out a way to add it to the context.

    Any help will be appreciated thanks.

  4. #14
    Join Date
    Oct 2004
    Posts
    2

    Default ... work around.

    Well, I think I solved my problem.

    In case anybody is interested, the only modification I had to make was to change the ClassPathXmlApplicationContext to FileSystemXmlApplicationContext. In other words:

    Code:
    context = new FileSystemXmlApplicationContext &#40; xmlFiles &#41;;
    Now the context is built from the file system using the app working directory as the base dir. So now my initilize() method looks like:
    Code:
    initialize&#40;"/WEB-INF/classes/file1.xml,/WEB-INF/classes/file2.xml&#41;;
    Hope it helps.

Similar Threads

  1. Error loading context: unknown protocol: jndi
    By graeder in forum Container
    Replies: 12
    Last Post: Oct 27th, 2005, 09:07 AM
  2. Replies: 2
    Last Post: Oct 13th, 2005, 02:47 PM
  3. Loading context from custom classloader
    By mgarber in forum Container
    Replies: 6
    Last Post: Oct 13th, 2005, 03:17 AM
  4. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  5. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM

Posting Permissions

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