Try changing to:
instead of your current line that adds the persistence.xml file assuming that you have a META-INF/persistence.xml file within your test/resources folder of your project.
Ok, thanks! Now its running!
With regards to ShrinkWrap, overall descriptions are missing. From javadoc it's possible to deduce, what could work. But it's a stony, very time consuming trial and error way!
It works, but I still don't know why! Why it is src/test/resources Folder? Why it must be mentioned twice? What is the difference between the solution where you mention it only once and the used one, where the same information is given twice?
What exactly does the "beans.xml" declaration?
It would be nice if such background information is given somewhere in a tutorial, or any other documentation.
1 of 1 people found this helpful
Hi. I'm glad it's working now.
The src/test/resources folder is the standard path for test resources for Maven so all resources go in there or subfolders.
The first parameter to .addAsResource() specifies the file to add to the archive. You want to add the persistence.xml file which is in the META-INF folder. The second parameter specifies where this file goes in the archive. So it looks like the info is given twice, but this is not the case.
Beans.xml is needed to allow CDI beans. If you aren't using those I don't think it's not needed.
Thanks for the clarifications. However I would prefer to see all of this in a general documentation. I don't feel good, when I just know, “how it works”. I need to know, “why it works”. Only the latter gives me the freedom to choose the most adequate solution.
Example beans.xml and CDI.
I’m using EJB (JSR-318) not CDI (JSR-299). So beans.xml goes with CDI. Does EJB require another MetaData configuration with ShrinkWrap? You see the kind of questions, which I would like to have answered in a document giving me the whole overview.
Aah! looks not bad. I was just not able to find it!
I'm reading through. I'll tell you the outcome.