title: @PostConstruct fail on first execution
body: <p>Since I'm new using Java EE 7, I've creating a project just for study purpose.
  I've created a CDI bean with Request scope as follows (it's just implementing Serializable because I've tried using it with @javax.faces.view.ViewScoped)</p>
  
  <pre><code>import com.issuerepository.domain.Issue;
  import com.issuerepository.domain.IssueType;
  import com.issuerepository.facade.api.IssueRepositoryFacade;
  
  import javax.annotation.PostConstruct;
  import javax.enterprise.context.RequestScoped;
  import javax.inject.Inject;
  import javax.inject.Named;
  import java.io.Serializable;
  import java.util.List;
  
  @Named
  @RequestScoped
  public class CreateIssueBean implements Serializable {
  
      @Inject
      private IssueRepositoryFacade issueRepository;
  
      private Issue issue;
      private List&lt;IssueType&gt; allIssueType;
  
      @PostConstruct
      private void init() {
          issue = new Issue();
          allIssueType = issueRepository.findAllIssueType();
      }
  
      public String saveIssue() {
          issueRepository.saveOrUpdateIssue(issue);
          return "searchIssue.xhtml?faces-redirect=true";
      }
  
      public Issue getIssue() {
          return issue;
      }
  
      public void setIssue(Issue issue) {
          this.issue = issue;
      }
  
      public List&lt;IssueType&gt; getAllIssueType() {
          return allIssueType;
      }
  
      public void setAllIssueType(List&lt;IssueType&gt; allIssueType) {
          this.allIssueType = allIssueType;
      }
  }
  </code></pre>
  
  <p>The thing is: I start WildFly (A.k.a. JBoss AS 8) and my application starts normally. Then I open my browser and try to access the URL of the application. In the first access I get this Exception:</p>
  
  <pre><code>Stack Trace
  javax.servlet.ServletException: WELD-000049: Unable to invoke private void com.issuemanager.web.bean.CreateIssueBean.init() on com.issuemanager.web.bean.CreateIssueBean@5c0dc28a
  </code></pre>
  
  <p>The above is showed on browser, the below is showed on server.log: </p>
  
  <pre><code>Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:235) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:63) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:162) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:160) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1884) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1861) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.doQuery(Loader.java:909) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.doList(Loader.java:2553) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.doList(Loader.java:2539) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2369) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.Loader.list(Loader.java:2364) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:231) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1264) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
      ... 177 more
  Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:154)
      at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      ... 198 more
  Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction
      at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:416)
      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:513)
      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)
      ... 201 more
  Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple &lt; ac, BasicAction: 0:ffffc0a81906:-758bf077:5376ec7d:9 status: ActionStatus.ABORT_ONLY &gt;
      at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:400)
      ... 203 more
  </code></pre>
  
  <p>So as you can see it has a problem invoking the @PostConstruct method. Just so you know</p>
  
  <pre><code>IssueRepositoryFacade
  </code></pre>
  
  <p>is an EJB. However, when I refresh the same URL it works OK. I don't know what is happening. This EJB is annotated with </p>
  
  <pre><code>@TransactionAttribute(TransactionAttributeType.REQUIRED)
  </code></pre>
  
  <p>So I'm using container managed transaction. I use JPA 2.1 with MySql database.
  Could someone, if not giving me a solution, at least explain why this is happening?</p>
  
  <p>Thanks.</p>