« Return to Thread: Maven2 test not finding src/resources/META-INF/persistence.xml

Re: Maven2 test not finding src/resources/META-INF/persistence.xml

by Ryan de Laplante :: Rate this Message:

Reply to Author | View in Thread

I found this ticket:

http://jira.codehaus.org/browse/SUREFIRE-427

They were using the JBoss EJB container in unit tests and having the same problem.  They ended up deciding that the problem was not Maven surefire plugin, but the EJB container.  That made me wonder if my problem is the Spring container.

I found that I could specify the path to the persistenceXml file in my spring xml file:

<bean id="entityManagerFactory" class= "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceXmlLocation" value="file:/home/ryan/dev/MyProject/src/test/resources/META-INF/persistence.xml"/>
...

And now I'm past this problem.  Well, except the fact that I must specify the full path.  No matter what I enter using classpath: prefix doesn't work.  I don't know what Spring thinks the classpath is, or how that even gets set.


Thanks,
Ryan

 « Return to Thread: Maven2 test not finding src/resources/META-INF/persistence.xml