0
votes

I just created a simple WAR containing a simple JAX-RS Service, an Stateless EJB and some JPA entities. I'm using WildFly 12.

My WAR structure is the following:

  • WEB-INF
  • classes
    • META-INF
      • jboss-ds.xml
      • persistence.xml
    • compiled classes

My jboss-ds.xml looks like this

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<datasource jndi-name="java:/jdbc/shortbox" pool-name="mysql_pool" enabled="true" use-java-context="true">
    <connection-url>jdbc:mysql://localhost:3306/shortbox</connection-url>
    <driver>mysql</driver>
    <security>
        <user-name>admin</user-name>
        <password>admin</password>
    </security>
</datasource>
</datasources>

My persistence.xml looks like this

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="shortbox-unit" transaction-type="JTA">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <jta-data-source>java:/jdbc/shortbox</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties/>
</persistence-unit>
</persistence>

I also injected the EntityManager in my EJB like this

@PersistenceContext(unitName = "shortbox-unit")
private EntityManager em;

My problem is, that the WAR is not deploying like this and I just can't figure out why. The Exception during deployment is the following

16:56:07,052 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "api.war" was rolled back with the following failure message: { "WFLYCTL0412: Required services that are not installed:" => [ "jboss.deployment.unit.\"api.war\".component.IssueBean.WeldInterceptorBindingsService", "jboss.deployment.unit.\"api.war\".component.IssueBean.START", "jboss.deployment.unit.\"api.war\".weld.weldClassIntrospector", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".WeldInstantiator", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START", "jboss.deployment.unit.\"api.war\".WeldStartService", "jboss.persistenceunit.\"api.war#shortbox-unit\"", "jboss.persistenceunit.\"api.war#shortbox-unit\".FIRST_PHASE", "jboss.naming.context.java.jdbc.shortbox", "jboss.deployment.unit.\"api.war\".component.IssueBean.WeldInstantiator", "jboss.deployment.unit.\"api.war\".ee.ComponentRegistry", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START", "jboss.naming.context.java.module.api.api.env.\"xyz.shortbox.backend.ejb.IssueBean\".em", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".WeldInstantiator", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START", "jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator", "jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".START", "jboss.undertow.deployment.default-server.default-host./api", "jboss.undertow.deployment.default-server.default-host./api.UndertowDeploymentInfoService", "jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator", "jboss.deployment.unit.\"api.war\".jndiDependencyService", "jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".START" ], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.deployment.unit.\"api.war\".ee.ComponentRegistry is missing [jboss.deployment.unit.\"api.war\".weld.weldClassIntrospector]", "jboss.deployment.unit.\"api.war\".component.IssueBean.START is missing [jboss.naming.context.java.module.api.api.env.\"xyz.shortbox.backend.ejb.IssueBean\".em, jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.deployment.unit.\"api.war\".jndiDependencyService, jboss.deployment.unit.\"api.war\".component.IssueBean.WeldInstantiator]", "jboss.deployment.unit.\"api.war\".component.IssueBean.WeldInterceptorBindingsService is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.deployment.unit.\"api.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.undertow.deployment.default-server.default-host./api.UndertowDeploymentInfoService is missing [jboss.deployment.unit.\"api.war\".WeldStartService, jboss.deployment.unit.\"api.war\".ee.ComponentRegistry]", "jboss.deployment.unit.\"api.war\".CdiValidatorFactoryService is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START is missing [jboss.deployment.unit.\"api.war\".jndiDependencyService, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".WeldInstantiator]", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START is missing [jboss.deployment.unit.\"api.war\".jndiDependencyService, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".WeldInstantiator]", "jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".START is missing [jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator, jboss.deployment.unit.\"api.war\".jndiDependencyService]", "jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.deployment.unit.\"api.war\".WeldStartService is missing [jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.deployment.unit.\"api.war\".jndiDependencyService]", "jboss.deployment.unit.\"api.war\".component.IssueBean.WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService, jboss.deployment.unit.\"api.war\".component.IssueBean.WeldInterceptorBindingsService]", "jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.deployment.unit.\"api.war\".moduleDeploymentRuntimeInformationStart is missing [jboss.deployment.unit.\"api.war\".component.IssueBean.START]", "jboss.persistenceunit.\"api.war#shortbox-unit\".FIRST_PHASE is missing [jboss.naming.context.java.jdbc.shortbox]", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START is missing [jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.deployment.unit.\"api.war\".jndiDependencyService, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator]", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.naming.context.java.module.api.api.env.\"xyz.shortbox.backend.ejb.IssueBean\".em is missing [jboss.persistenceunit.\"api.war#shortbox-unit\"]", "jboss.undertow.deployment.default-server.default-host./api is missing [jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".START, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START, jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".START, jboss.deployment.unit.\"api.war\".WeldStartService, jboss.undertow.deployment.default-server.default-host./api.UndertowDeploymentInfoService, jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.persistenceunit.\"api.war#shortbox-unit\".FIRST_PHASE, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START, jboss.deployment.unit.\"api.war\".component.IssueBean.START, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START]", "jboss.deployment.unit.\"api.war\".WeldEndInitService is missing [jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".START, jboss.deployment.unit.\"api.war\".WeldStartService, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START, jboss.deployment.unit.\"api.war\".component.IssueBean.START, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START, jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".START]", "jboss.deployment.unit.\"api.war\".jndiDependencyService is missing [jboss.naming.context.java.module.api.api.env.\"xyz.shortbox.backend.ejb.IssueBean\".em]", "jboss.deployment.unit.\"api.war\".deploymentCompleteService is missing [jboss.deployment.unit.\"api.war\".component.\"javax.faces.webapp.FacetTag\".START, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START, jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START, jboss.undertow.deployment.default-server.default-host./api, jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".START, jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.persistenceunit.\"api.war#shortbox-unit\".FIRST_PHASE, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START, jboss.deployment.unit.\"api.war\".component.IssueBean.START, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START]", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService]", "jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".START is missing [jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.deployment.unit.\"api.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator, jboss.deployment.unit.\"api.war\".jndiDependencyService]", "jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START is missing [jboss.persistenceunit.\"api.war#shortbox-unit\", jboss.deployment.unit.\"api.war\".jndiDependencyService, jboss.deployment.unit.\"api.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator]", "jboss.persistenceunit.\"api.war#shortbox-unit\" is missing [jboss.naming.context.java.jdbc.shortbox, jboss.persistenceunit.\"api.war#shortbox-unit\".FIRST_PHASE]", "jboss.deployment.unit.\"api.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".WeldInstantiator is missing [jboss.deployment.unit.\"api.war\".WeldStartService]" ] }

When I remove the jboss-ds.xml and configure the persistence.xml to use my db everything is deploying fine - but the application is using the exampleDS, because I have not configured any other DS. What am I doing wrong?

One more important note - I definitly want to manage the DS in my Appliaction, not in the JBoss config.

Thanks in advance!

1

1 Answers

0
votes

The solution was simple as ABC... The jboss.xml must be placed in the WEB-INF root and not in the META-INF.