arjan tijms created WFLY-1366:
---------------------------------
Summary: @DataSourceDefinition incorrectly requires other properties than
name and class-name
Key: WFLY-1366
URL:
https://issues.jboss.org/browse/WFLY-1366
Project: WildFly
Issue Type: Feature Request
Reporter: arjan tijms
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:
{code:xml}
<data-source>
<name>java:app/myDS</name>
<class-name>com.example.MyDS</class-name>
</data-source>
{code}
With such configuration, the following exception is thrown:
{noformat}
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)
{noformat}
At the point where the exception is thrown, the code checks if there are any properties at
all:
{code}
if (this.xaDataSourceProperty.isEmpty())
throw new ValidateException(
bundle.requiredElementMissing(
Tag.XA_DATASOURCE_PROPERTY.getLocalName(),
this.getClass().getCanonicalName()));
{code}
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.
{code:xml}
<data-source>
<name>java:app/myDS</name>
<class-name>com.example.MySubDS</class-name>
<property>
<name>dummy</name>
<value>dummy</value>
</property>
</data-source>
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira