Jcoder
Jcoder

Reputation: 37

Persistence.xml doesn't exist or can't be accessed

When run my test, i have problem that my test method can not invoke, in stack trace this caused by

java.lang.IllegalArgumentException: persistence.xml doesn't exist or can't be accessed

My file located in /src/main/resources/META-INF/persistence.xml

My test

@Deployment
public static JavaArchive createDeployment() {
    return ShrinkWrap.create (JavaArchive.class)
            .addPackage (PersistanceService.class.getPackage())
            .addPackage(Todo.class.getPackage())
            .addAsResource("persistence.xml", "/META-INF/persistence.xml")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
}

Also if i comment //.addAsResource("persistence.xml", "/META-INF/persistence.xml") test is completed

if you know what i need to do, please help me, tnx!

enter image description here

Upvotes: 0

Views: 90

Answers (0)

Related Questions