title: Spring Security SQL Error: 0, SQLState: null
body: <p>My project fully conects to the database to load all data but Spring Security throws me the following exception </p>
  
  <p>10:58:08  WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
  10:58:08 ERROR [JDBCExceptionReporter] com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [numThreadsAwaitingCheckoutDefaultUser] ] has been closed()</p>
  
  <p>here are is my spring security configuration class</p>
  
  <pre><code>&lt;http auto-config="true" use-expressions="false" authentication-manager-ref="authManager" access-decision-manager-ref="accessDecisionManager"
      access-denied-page="/unauthorized"&gt;
      &lt;intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" /&gt;
  
      &lt;form-login 
          login-processing-url="/j_login" 
          authentication-failure-url="/login?erro=usuarioIncorreto"
          always-use-default-target="false"
          login-page="/login" 
          default-target-url="/" /&gt;
  
      &lt;logout invalidate-session="true" 
          logout-success-url="/login"
          logout-url="/j_logout"
          delete-cookies="JSESSIONID" /&gt;
  
      &lt;session-management invalid-session-url="/login?erro=novaSessao" 
          session-fixation-protection="newSession"&gt;
          &lt;concurrency-control max-sessions="1" error-if-maximum-exceeded="false" /&gt;
      &lt;/session-management&gt;
  &lt;/http&gt;
  
  &lt;authentication-manager &gt;
      &lt;authentication-provider user-service-ref="securityServiceTrack"&gt;
          &lt;password-encoder hash="md5" /&gt;
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  
  &lt;beans:bean id="accessDecisionManager" class="org.springframework.security.access.vote.UnanimousBased"&gt;
      &lt;beans:property name="decisionVoters"&gt;
          &lt;beans:list&gt;
              &lt;beans:bean class="org.springframework.security.access.vote.AuthenticatedVoter" /&gt;
  </code></pre>
  
  <p> -->
              
          
      </p>
  
  <p>And here is my web.xml:</p>
  
  <pre><code>&lt;display-name&gt;Track Go Web&lt;/display-name&gt;
  
  &lt;!-- ******************************************************* --&gt;
  &lt;!-- Configuração do Spring --&gt;
  &lt;!-- ******************************************************* --&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/config/spring/applicationContext.xml
          /WEB-INF/config/spring/applicationContext-persistence.xml
          /WEB-INF/config/spring/applicationContext-security.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;!-- Spring Security --&gt;
  &lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;
          org.springframework.security.web.session.HttpSessionEventPublisher
      &lt;/listener-class&gt;
  &lt;/listener&gt; 
  
  &lt;!-- OpenEntityManagerInViewFilter --&gt;
  &lt;filter&gt;
      &lt;filter-name&gt;OpenEntityManagerInViewFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;
          org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
      &lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;OpenEntityManagerInViewFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;!-- ******************************************************* --&gt;
  &lt;!-- Configuração do SiteMesh --&gt;
  &lt;!-- ******************************************************* --&gt;
   &lt;filter&gt;
      &lt;filter-name&gt;sitemesh&lt;/filter-name&gt;
      &lt;filter-class&gt;org.sitemesh.config.ConfigurableSiteMeshFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;sitemesh&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  
  &lt;!-- ******************************************************* --&gt;
  &lt;!-- Configuração do VRaptor3 --&gt;
  &lt;!-- ******************************************************* --&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;br.com.caelum.vraptor.encoding&lt;/param-name&gt;
      &lt;param-value&gt;UTF-8&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;!-- Define Messages Bundle --&gt;
  </code></pre>
  
  <p>-->
  javax.servlet.jsp.jstl.fmt.localizationContext&lt;/param-name>-->
  messages&lt;/param-value>-->
  -->
      
      
          javax.servlet.jsp.jstl.fmt.locale
          pt_BR
      
      
  -->
  vraptor.jasperMaker&lt;/param-name>-->
  /WEB-INF/reports&lt;/param-value>-->
  --></p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;vraptor&lt;/filter-name&gt;
      &lt;filter-class&gt;br.com.caelum.vraptor.VRaptor&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;vraptor&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
      &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>Here is my persintence configuration file</p>
  
  <pre><code>&lt;!-- ********************************************* --&gt;
  &lt;!-- DataSource condfig--&gt;
  &lt;!-- ********************************************* --&gt;
  
  
  
  &lt;context:property-placeholder location="classpath:configuracoes.properties" /&gt;
  
   &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;
      &lt;property name="driverClass" value="${trackgoweb.jdbc.driverclass}" /&gt;
      &lt;property name="jdbcUrl" value="${trackgoweb.jdbc.url}" /&gt;
      &lt;property name="user" value="${trackgoweb.jdbc.username}" /&gt;
      &lt;property name="password" value="${trackgoweb.jdbc.password}" /&gt;
      &lt;property name="maxPoolSize" value="10" /&gt;
      &lt;property name="maxStatements" value="0" /&gt;
      &lt;property name="minPoolSize" value="3" /&gt;
      &lt;property name="checkoutTimeout" value="30000" /&gt;
  &lt;/bean&gt;
  
  &lt;!-- Configuraçãoes relativas a acesso a dados --&gt;
  &lt;bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
  
      &lt;property name="dataSource" ref="dataSource"/&gt;
  
      &lt;property name="jpaDialect"&gt;
          &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"&gt;&lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="jpaVendorAdapter"&gt;
          &lt;bean
              class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
              &lt;property name="showSql" value="true" /&gt;
              &lt;property name="databasePlatform" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="jpaProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.query.substitutions"&gt;true 'S',false 'N',yes 'S',no 'N'&lt;/prop&gt;
              &lt;prop key="hibernate.query.jpaql_strict_compliance"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Transaction Manager exclusivo para JPA --&gt;
  &lt;bean id="transactionManager"
      class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
      &lt;property name="jpaDialect"&gt;
          &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"&gt;&lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>