Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-9585

Wildfly 10 ignores jboss-ejb3.xml resource-ref lookup-name

XMLWordPrintable

      We have a ear that use a datasource that is injected. The application runs normally in Jboss EAP 6.4, with the correct datasource being used. But when deployed to Wildfly-10.1.0_Final, instead of the datasource specified in the jboss-ejb3.xml, the default datasource is alway injected.

      We have in the ejb-jar.xml

        <enterprise-beans>
          <session>
              <ejb-name>BackgroundRecoverySessionEJB</ejb-name>
              <resource-ref>
                  <res-ref-name>jdbc/RMDataSource</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <res-auth>Container</res-auth>
              </resource-ref>
              <persistence-context-ref>
                  <persistence-context-ref-name>persistence/RMEntityManager</persistence-context-ref-name>
              </persistence-context-ref>
          </session>
      

      and in jboss-ejb3.xml

        <jboss:enterprise-beans>
          <jboss:ejb>
              <ejb-name>BackgroundRecoverySessionEJB</ejb-name>
              <resource-ref>
                  <res-ref-name>jdbc/RMDataSource</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <lookup-name>java:jboss/jdbc/RMDataSource</lookup-name>
              </resource-ref>
          </jboss:ejb>
      

      the datasource java:jboss/jdbc/RMDataSource got injected into the EJB under JBoss EAP 6.4.

      But in WildFly 10.1, the default datasource java:jboss/datasources/ExampleDS was injected, causing "org.h2.jdbc.JdbcSQLException: Table "XXX" not found;"

      If we set the default datasource to java:jboss/jdbc/RMDataSource, java:jboss/jdbc/RMDataSource jot injected into the EJB.

      Seems like the jboss-ejb3.xml has no effect on WildFly 10.1, the default datasource is always used.

        1. jBossLookup-ear-0.0.1-SNAPSHOT.ear
          27 kB
          Shing Lam
        2. jBossLookup-ear-0.0.1-SNAPSHOT.ear
          23 kB
          Shing Lam

              tadamski@redhat.com Tomasz Adamski
              lamshing Shing Lam (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: