title: Dependency error when deploying java project to Wildfly 8.2
body: <p>I'm having a problem deploying my java project with Wildfly 8.2 in eclipse EE. There seems to be some problems with the datasource but I can't seem to figure out where and why. When I test the connection in the Console Manager in Wildfly it connects successfully. </p>
  
  <p>The error from console:</p>
  
  <pre><code>14:18:43,952 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
  14:18:44,296 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
  14:18:44,389 INFO  [org.jboss.as] (MSC service thread 1-5) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
  14:18:46,156 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found EventNetzEAR.ear in deployment directory. To trigger deployment create a file called EventNetzEAR.ear.dodeploy
  14:18:46,174 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
  14:18:46,205 INFO  [org.xnio] (MSC service thread 1-2) XNIO version 3.3.0.Final
  14:18:46,221 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.3.0.Final
  14:18:46,268 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
  14:18:46,284 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
  14:18:46,284 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
  14:18:46,299 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
  14:18:46,315 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
  14:18:46,331 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
  14:18:46,377 INFO  [org.jboss.as.security] (MSC service thread 1-4) JBAS013170: Current PicketBox version=4.0.21.Final
  14:18:46,393 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
  14:18:46,487 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
  14:18:46,502 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
  14:18:46,518 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010417: Started Driver service with driver-name = h2
  14:18:46,549 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017502: Undertow 1.1.0.Final starting
  14:18:46,627 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
  14:18:46,643 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
  14:18:46,674 INFO  [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service
  14:18:47,112 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path C:\Program Files\JBoss\wildfly-8.2.0.Final/welcome-content
  14:18:47,143 INFO  [org.jboss.remoting] (MSC service thread 1-5) JBoss Remoting version 4.0.6.Final
  14:18:47,237 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 2.0)
  14:18:47,241 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = sqlserver
  14:18:47,272 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017525: Started server default-server.
  14:18:47,319 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017531: Host default-host starting
  14:18:47,585 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
  14:18:47,585 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/jdbc/MssqlDS]
  14:18:47,600 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
  14:18:47,663 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory C:\Program Files\JBoss\wildfly-8.2.0.Final\standalone\deployments
  14:18:47,663 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "EventNetzEAR.ear" (runtime-name: "EventNetzEAR.ear")
  14:18:47,678 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "sqljdbc4.jar" (runtime-name: "sqljdbc4.jar")
  14:18:47,928 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015973: Starting subdeployment (runtime-name: "EventNetzEJB.jar")
  14:18:47,928 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015973: Starting subdeployment (runtime-name: "EventNetzClient.war")
  14:18:48,483 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for EventNetz
  14:18:48,533 INFO  [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
  14:18:48,642 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 2.0)
  14:18:48,689 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010417: Started Driver service with driver-name = sqljdbc4.jar
  14:18:48,705 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment EventNetzEAR.ear
  14:18:48,924 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.1.3.Final
  14:18:49,174 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment EventNetzClient.war
  14:18:49,236 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" =&gt; "EventNetzEAR.ear")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" =&gt; [
      "jboss.deployment.unit.\"EventNetzEAR.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"EventNetzEAR.ear\".beanmanager]",
      "jboss.persistenceunit.\"EventNetzEAR.ear/EventNetzEJB.jar#EventNetz\".__FIRST_PHASE__ is missing [jboss.naming.context.java.\"\\njava:jboss\".datasources.jdbc.\"MssqlDS\\n\"]"
  ]}
  14:18:49,333 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "sqljdbc4.jar" (runtime-name : "sqljdbc4.jar")
  14:18:49,333 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "EventNetzEAR.ear" (runtime-name : "EventNetzEAR.ear")
  14:18:49,335 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
  JBAS014775:    New missing/unsatisfied dependencies:
        service jboss.deployment.unit."EventNetzEAR.ear".beanmanager (missing) dependents: [service jboss.deployment.unit."EventNetzEAR.ear".weld.weldClassIntrospector] 
        service jboss.naming.context.java."\njava:jboss".datasources.jdbc."MssqlDS\n" (missing) dependents: [service jboss.persistenceunit."EventNetzEAR.ear/EventNetzEJB.jar#EventNetz".__FIRST_PHASE__] 
  
  14:18:49,409 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
  14:18:49,409 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
  14:18:49,409 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.2.0.Final "Tweek" started (with errors) in 5840ms - Started 280 of 341 services (5 services failed or missing dependencies, 96 services are lazy, passive or on-demand)
  14:18:49,612 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015974: Stopped subdeployment (runtime-name: EventNetzEJB.jar) in 15ms
  14:18:49,612 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015974: Stopped subdeployment (runtime-name: EventNetzClient.war) in 15ms
  14:18:49,624 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment EventNetzEAR.ear (runtime-name: EventNetzEAR.ear) in 18ms
  14:18:49,687 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "EventNetzEAR.ear" (runtime-name: "EventNetzEAR.ear")
  14:18:49,687 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
  JBAS014775:    New missing/unsatisfied dependencies:
        service jboss.naming.context.java.module.EventNetzEAR.EventNetzClient (missing) dependents: [service jboss.deployment.subunit."EventNetzEAR.ear"."EventNetzClient.war".INSTALL] 
        service jboss.persistenceunit."EventNetzEAR.ear/EventNetzEJB.jar#EventNetz".__FIRST_PHASE__ (missing) dependents: [service jboss.deployment.subunit."EventNetzEAR.ear"."EventNetzEJB.jar".POST_MODULE] 
  
      14:18:54,422 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found EventNetzEAR.ear in deployment directory. To trigger deployment create a file called EventNetzEAR.ear.dodeploy
  </code></pre>
  
  <p>The datasource from standalone.xml</p>
  
  <pre><code> &lt;datasource jta="true" jndi-name="java:jboss/datasources/jdbc/MssqlDS" pool-name="MssqlDS" enabled="true" use-ccm="false"&gt;
      &lt;connection-url&gt;jdbc:sqlserver://localhost:1433;databaseName=Testdata;&lt;/connection-url&gt;
           &lt;driver&gt;sqlserver&lt;/driver&gt;
                       &lt;security&gt;
                         &lt;user-name&gt;sa&lt;/user-name&gt;
                         &lt;password&gt;hej123&lt;/password&gt;
                       &lt;/security&gt;
                              &lt;validation&gt;
                       &lt;validate-on-match&gt;false&lt;/validate-on-match&gt;
                      &lt;background-validation&gt;false&lt;/background-validation&gt;
                     &lt;background-validation-millis&gt;1&lt;/background-validation-millis&gt;
                   &lt;/validation&gt;
                  &lt;statement&gt;
      &lt;prepared-statement-cache-size&gt;0&lt;/prepared-statement-cache-size&gt;
      &lt;share-prepared-statements&gt;false&lt;/share-prepared-statements&gt;
      &lt;/statement&gt;
      &lt;/datasource&gt;
  </code></pre>
  
  <p>The driver from standalone.xml:</p>
  
  <pre><code>&lt;driver name="sqlserver" module="com.microsoft.sqlserver.jdbc"&gt;
  &lt;xa-datasource-class&gt;com.microsoft.sqlserver.jdbc.SQLServerXADataSource
  &lt;/xa-datasource-class&gt;
  &lt;/driver&gt;
  </code></pre>
  
  <p>The module.xml in path com/microsoft/sqlserver/jdbc/main. Alse where the driver.jar is located.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;module xmlns="urn:jboss:module:1.0" name="com.microsoft.sqlserver.jdbc"&gt;
  &lt;resources&gt;
  &lt;resource-root path="sqljdbc4.jar"/&gt;
  &lt;/resources&gt;
  &lt;dependencies&gt;
  &lt;module name="javax.api"/&gt;
  &lt;module name="javax.transaction.api"/&gt;
  &lt;/dependencies&gt;
  &lt;/module&gt;
  </code></pre>
  
  <p>The persistance.xml file in my project:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence"&gt;
  &lt;persistence-unit name="EventNetz"&gt;
  &lt;jta-data-source&gt;
  java:jboss/datasources/jdbc/MssqlDS
  &lt;/jta-data-source&gt;
  &lt;non-jta-data-source&gt;
  java:jboss/datasources/jdbc/MssqlDS
  &lt;/non-jta-data-source&gt;
  &lt;properties&gt;
  &lt;property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/&gt;
  &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>