Bug #85566 Missing OSGi-Export Package for com.mysql.cj.api.conf
Submitted: 21 Mar 2017 13:03 Modified: 22 May 2018 20:28
Reporter: Philipp Marx Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:6.0.6 OS:Any
Assigned to: CPU Architecture:Any

[21 Mar 2017 13:03] Philipp Marx
Description:
The OSGi exports defined in the build.xml [1] are missing the export for the configuration packages in the 6.x branch:

[1]
 <property name="com.mysql.cj.build.meta-inf.configs-exports"
                  value="com.mysql.cj.configurations;version=&quot;${com.mysql.cj.build.meta-inf.osgid-version}&quot;" />

How to repeat:
Build an OSGi bundle and try to setup a MySqlXaDatasource and configure it like in the following snippet:

        final MysqlXADataSource xaDataSource = new MysqlXADataSource();
        xaDataSource.setServerName(dataSourceConfig.getServer());
        xaDataSource.setPort(dataSourceConfig.getPort());
        xaDataSource.setDatabaseName(dataSourceConfig.getDatabase());
        xaDataSource.setPassword(dataSourceConfig.getPassword());

        xaDataSource.getModifiableProperty(PNAME_nullNamePatternMatchesAll).setValue(true);
        xaDataSource.getModifiableProperty(PNAME_maxAllowedPacket).setValue(4194304);
        xaDataSource.getModifiableProperty(PNAME_cachePrepStmts).setValue(true);
        xaDataSource.getModifiableProperty(PNAME_useServerPrepStmts).setValue(true);

Having a reference to "ModifiableProperty" will require the MySql-Driver-Bundle to export the package mentioned above.
[22 Mar 2017 15:56] Filipe Silva
Hi Philipp,

This bug was verified as described, by code review.

Thank you for your interest in MySQL and Connector/J.
[22 May 2018 20:28] Daniel So
Posted by developer:
 
Added the following entry to the C/J 8.0.11 changelog:

"In the Ant build file build.xml, com.mysql.cj.api.conf was missing in the list of OSGi exported packages, causing missing dependencies in OSGi bundles that use Connector/J."