[CONJ-703] ClassNotFoundException when trying to connect using two-authentication in an OSGI environment. Created: 2019-05-15 Updated: 2020-04-08 Resolved: 2019-06-12 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | authentication |
| Affects Version/s: | 2.4.1 |
| Fix Version/s: | 2.4.2 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Simon Haslam | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows+Glassfish+Blueprint |
||
| Issue Links: |
|
||||||||
| Description |
|
There is bug in your mariadb-java-client jar version 2.4.1 that means it doesn't work within an OSGI environment when the database connections is secured with SSL/TLS using two way authentication. This is due a couple of missing import statements in the pom.xml that is used to build the jar file. You currently have this
But I have found 3 additional imports need to be added, giving this:
|
| Comments |
| Comment by Diego Dupin [ 2019-06-11 ] | |||||||
|
It would seem that implementation would list non-mandatory packages and asterisk, like :
or not setting anything at all <Import-Package/>. | |||||||
| Comment by Simon Haslam [ 2019-06-11 ] | |||||||
|
For OSGI bundles the <Import-Package> lists all the packages that the bundle needs in-order to run. When the bundle starts up if any of the listed packages are missing the bundle will not start. Also if the bundle requires any packages that are not listed in the import-packages then that will generate a classNofFoundException at the point in which java tries to load the class. An asterisk is a special case and tell the bundle builder that any package it sees in use (by analysing the byte code) should be automatically included in the import-package statement. Marking an import as optional is important for packages which are refereed to by code, but which are not always needed, depending on the setup. This allows the bundle to startup without those packages being available. In this example the waffle.windows.auth packages need to be marked as optional, as not all software making use of the MariaDB client (e.g. those running on linux) will have those packages installed! If you build the client using my suggested imports, and then look at the generated Java Manifest you will be able to see what packages have been added to the import-package section (and you will see that the asterisk has been removed and substituted for all the packages that your driver references). |