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

@DataSourceDefinition incorrectly requires other properties than name and class-name

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 8.0.0.Alpha1
    • EE

      When using the <data-source> element in e.g. web.xml or application.xml JBoss EAP 6.0.1/JBoss AS 7.1.3 does not accept a configuration without properties other than name and class-name. For instance:

      <data-source>
          <name>java:app/myDS</name>
          <class-name>com.example.MyDS</class-name>
      </data-source>
      

      With such configuration, the following exception is thrown:

      Caused by: org.jboss.jca.common.api.validator.ValidateException: IJ010069: Missing required element xa-datasource-property in org.jboss.jca.common.metadata.ds.v11.XADataSourceImpl
      	at org.jboss.jca.common.metadata.ds.v10.XADataSourceImpl.validate(XADataSourceImpl.java:385)
      	at org.jboss.jca.common.metadata.ds.v10.XADataSourceImpl.<init>(XADataSourceImpl.java:116)
      	at org.jboss.jca.common.metadata.ds.v11.XADataSourceImpl.<init>(XADataSourceImpl.java:76)
      	at org.jboss.as.connector.subsystems.datasources.ModifiableXaDataSource.getUnModifiableInstance(ModifiableXaDataSource.java:373)
      	at org.jboss.as.connector.subsystems.datasources.XaDataSourceService.getDeployer(XaDataSourceService.java:70)
      	at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService.start(AbstractDataSourceService.java:116)
      

      At the point where the exception is thrown, the code checks if there are any properties at all:

      if (this.xaDataSourceProperty.isEmpty())
          throw new ValidateException(
              bundle.requiredElementMissing(
                  Tag.XA_DATASOURCE_PROPERTY.getLocalName(),
                  this.getClass().getCanonicalName()));
      

      I don't understand why this check is there. If I'm not mistaken the spec (e.g. JSR 250 section 2.13 and JSR 316 section EE.5.17) does not seem to mandate properties to be present and the corresponding annotation only requires name and className to be specified.

      A workaround is to subclass the data source class and provide a dummy property, e.g.

      <data-source>
          <name>java:app/myDS</name>
          <class-name>com.example.MySubDS</class-name>
          <property>
              <name>dummy</name>
              <value>dummy</value>
          </property>
      </data-source>
      

              emartins@redhat.com Eduardo Martins
              arjan.tijms@gmail.com Arjan Tijms (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: