Announcement Announcement Module
Collapse
No announcement yet.
MappingLocations for Webapp and Unit tests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MappingLocations for Webapp and Unit tests

    I have Hibernate mappings in a directory, and some inside a (jBPM) jar.

    To run it as a webapp, I configured by SessionFactory like this:
    Code:
            <property name="mappingDirectoryLocations">
                <value>WEB-INF/classes/</value>
            </property>
            <property name="mappingJarLocations">
                <value>WEB-INF/lib/jbpm-3.0+JBPM-272.jar</value>
            </property>
    But when I try to run my unit tests (which extend AbstractTransactionalDataSourceSpringContextTests), Spring can't find the mappings:

    Code:
    org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'sessionFactory' defined in class path resource &#91;applicationContext.xml&#93;&#58; Initialization of bean failed; nested exception is java.io.FileNotFoundException&#58; class path resource &#91;WEB-INF/lib/jbpm-3.0+JBPM-272.jar&#93; cannot be resolved to URL because it does not exist
    java.io.FileNotFoundException&#58; class path resource &#91;WEB-INF/lib/jbpm-3.0+JBPM-272.jar&#93; cannot be resolved to URL because it does not exist
    How can I configure my SessionFactory so that it works for both the Webapp and Unit tests?

    TIA,
    Daniel Serodio

  • #2
    Seems like you are executing your test cases in a directory that does not contains /WEB-INF/...

    Comment

    Working...
    X