Skip to content

Fallback to platform classes for Database Reader's isolated ClassLoader #338

Description

@paul-hristea

Picking up from an older issue regarding some trouble with class loading from within isolated contexts such as Database Readers (see here).

Basically, in these contexts there is a separate ClassLoader built specifically based on the Resources assigned to those Channels/Connectors. This would allow different versions of different custom drivers to be used in parallel (ClassLoader instantiated here, more info in comments here).

Example steps to reproduce:

  1. Download ojdbc17.jar from Oracle
  2. Place it somewhere accessible to OIE but outside of server-lib or custom-lib
  3. In OIE Settings, create a Resource containing only ojdbc17.jar
  4. Create a Channel, assign the Resource to its Dependencies
  5. Configure source as Database Reader with settings as follows:
  • Driver: Oracle
  • URL: jdbc:oracle:thin:@
  • Username: username
  • Password: password
  • SQL: select
  1. Attempt to deploy the channel
  2. There should be a DeployException caused by NoClassDefFoundError: java/sql/Driver

Note that attempting to deploy the channel without having the Resource assigned should result in a different error (StartException: Failed to start channel fallback_test), which shows that the default server-lib ojdbc class loads successfully.

With the official move to Java 9+, this could now be solved by having the isolated ClassLoader fall back to ClassLoader.getPlatformClassLoader() as its parent, effectively replicating the behavior previously seen with null parent on Java 8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions