DeploymentUnitProcessingException

546 views Asked by At

when I try to deploy my project on my JBoss EAP 7.1 I get this error (stacktrace?):

16:13:07,986 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"test.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class rest.RestResource for component RestResource has errors: 
WFLYJPA0033: Can't find a persistence unit named primary in deployment \"test.war\""},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"test.war\".beanmanager"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.deployment.unit.\"test.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"test.war\".beanmanager]",
        "jboss.deployment.unit.\"test.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"test.war\".beanmanager]"

So, I have a DeploymentUnitProcessingException. The console says that a persistence unit named primary cannot be found. But I think that this is a lie because in my RestResource.java the unit name is primary.

package rest;

import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

@Path("/pair")
@Stateful
public class RestResource {
    @PersistenceContext(unitName = "primary")
    private EntityManager em;


    @POST
    public Pair writePair(Pair p) {
        em.persist(p);
        return p;
    }
}

The next claim of the console is that I dont have a beanmanager installed. I searched for it and this should only be a problem if I dont have a beans.xml. But I do have a src/META-INF/beans.xml and it can be created in a wizard of the IDE (Red Hat Developer Studio). Also, I read a beans.xml usually is no longer required.

Another thing that I found was https://github.com/javaee-samples/javaee7-samples/issues/371

Here they suggest to rebuild the project with the command

mvn clean install -Pwildfly-managed

In my IDE I do it like this:

executing the maven command

That works just fine but the console output remains unchanged.

Have you had that problem before? Thank you for your help.

Edit 08.11.18 I added a screenshot of my folder structure, such that people can see the location of my persistence.xml and beans.xml enter image description here

Edit 10.11.18 My beans.xml

<?xml version="1.0"?>
<beans bean-discovery-mode="annotated" version="2.0"
 xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"/>

is it correct?

0

There are 0 answers