title: Spring MVC + Maven + JBoss: can't deploy (The application must supply JDBC connections)
body: <p>I'm currently trying to setup a Spring MVC 3.1.1 project using Maven and deploying on JBoss 7.1.1.
  I have tried a few tutorials but I couldn't finish any as at some point I would get stuck with something that was assumed in the tutorial and nonexistent in my setup.</p>
  
  <p>My second try was to create a "Spring MVC Project" using eclipse and copy/paste the configuration files from a working Spring MVC project to my new one but so far no good.</p>
  
  <p>I created my whole domain using JPA and now that I try to deploy I get this exception: <code>Schema export unsuccessful: java.lang.UnsupportedOperationException: The application must supply JDBC connections.</code></p>
  
  <p>I found many forum posts etc with people having the same issue but none of the proposed solutions suits my problem. Postgresql driver is well defined in maven dependencies and is in the build path.</p>
  
  <p>Here is the main/src/resources/META-INF/<strong>persistence.xml</strong> file:</p>
  
  <pre><code>&lt;persistence-unit name="root"&gt;
      &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
      &lt;class&gt;com.macoloc.domain.Colocation&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Invitation&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Key&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Message&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.MessageSeenBy&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Payment&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.PaymentParticipation&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Ping&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Subtask&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Task&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.TaskOrder&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.User&lt;/class&gt;
      &lt;class&gt;com.macoloc.domain.Versionable&lt;/class&gt;
      &lt;properties&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;
          &lt;property name="hibernate.show_sql" value="true" /&gt;
          &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>Here is the src/main/webapp/WEB-INF/<strong>web.xml</strong> file:</p>
  
  <pre><code>&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/root-context.xml,/WEB-INF/spring/infrastructure/infrastructure.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/spring/appServlet/servlet-context.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Here is a part of src/main/resources/WEB-INF/spring/appServlet/<strong>servlet-context.xml</strong> file:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.macoloc" /&gt;
  
  &lt;annotation-driven /&gt;
  
  &lt;tx:annotation-driven /&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;mvc:resources mapping="/js/**" location="/resources/js/" /&gt;
  &lt;mvc:resources mapping="/css/**" location="/resources/css/" /&gt;
  
  &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  
  &lt;beans:bean
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt;
      &lt;beans:property name="suffix" value=".jsp" /&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>And finally the src/main/resources/WEB-INF/spring/infrastructure/<strong>infrastructure.xml</strong> file:</p>
  
  <p></p>
  
  <pre><code>&lt;context:annotation-config /&gt;
  
  &lt;tx:annotation-driven /&gt;
  
  &lt;bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSourceDirect" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="dataSourceDirect" class="org.postgresql.ds.PGSimpleDataSource"&gt;
      &lt;property name="user" value="macoloc"&gt;&lt;/property&gt;
      &lt;property name="password" value="macoloc"&gt;&lt;/property&gt;
      &lt;property name="portNumber" value="5432"&gt;&lt;/property&gt;
      &lt;property name="serverName" value="localhost"&gt;&lt;/property&gt;
      &lt;property name="databaseName" value="MaColoc"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.springframework.orm.jpa.JpaTransactionManager"
      id="transactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In postgres I've set the user "macoloc" to use DB "MaColoc"'s "macoloc" schema.</p>
  
  <p>Note that the project I'm taking all these configuration files wasn't set by me (obviously since this one is working...). There might be some files unused? I don't know. I'm really new to this.</p>
  
  <p><strong>Any idea where this is going wrong? Do you guys need more files?</strong></p>
  
  <p>Thank you!</p>
  
  <p><strong>EDIT</strong>: here's the stacktrace:</p>
  
  <pre><code>16:11:21,568 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.0)
  16:11:21,585 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011402: Starting Persistence Unit Service 'MaColoc.war#root'
  16:11:22,205 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) HHH000231: Schema export unsuccessful: java.lang.UnsupportedOperationException: The application must supply JDBC connections
      at org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:62) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.tool.hbm2ddl.DatabaseExporter.&lt;init&gt;(DatabaseExporter.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:368) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:305) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:294) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:452) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_21]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_21]
      at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_21]
  </code></pre>
  
  <p>And: Most weird, I noticed the tables were created in my DB... What?</p>