I am working on the following Nifi controller service bundle:
- nifi-controllers-bundle
- nifi-controllers
- nifi-controllers-api
- nifi-controllers-nar
- nifi-controllers-api-nar
I have a custom controller service created(StandardMyService) that extends DBCPConnectionPool in the nifi-controllers module and when I try to use it in UI I get the following exception in logs: ERROR [NiFi Web Server-36] o.a.nifi.controller.ExtensionBuilder Could not create Controller Service of type com.xxx.yyy.StandardMyService for ID 812de259-0181-1000-3536-a06e3ae9f2ed due to: Controller Service com.xxx.yyy.StandardMyService is bundled with its supporting APIs org.apache.nifi.dbcp.DBCPService. The service APIs should not be bundled with the implementations.; creating "Ghost" implementation
and this one in UI: 'Missing Controller Service' validated angainst 'Any property' is invalid because controller service is of type com.xxx.yyy.StandardMyService but this is not a valid Reporting Task Type
I do not think there is something wrong with the way I have implemented the StandardMyService class because I have tested it in a nifi controller service maven archetype and it works.
My nifi-controllers build.gradle looks like this:
dependencies {
implementation group: 'com.oracle.ojdbc', name: 'ojdbc8', version: '19.3.0.0'
implementation group: 'org.apache.nifi', name: 'nifi-nar-bundles', version: '1.12.0', ext: 'pom'
compileOnly group: 'org.apache.nifi', name: 'nifi-api', version: '1.16.1'
implementation group: 'org.apache.nifi', name: 'nifi-utils', version: '1.16.1'
compileOnly group: 'org.apache.nifi', name: 'nifi-dbcp-service-api', version: '1.16.1'
implementation group: 'org.apache.nifi', name: 'nifi-dbcp-service-nar', version: '1.16.1'
compileOnly group: 'org.apache.nifi', name: 'nifi-dbcp-service', version: '1.16.1'
testImplementation group: 'org.apache.nifi', name: 'nifi-mock', version: '1.16.1'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.36'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
implementation group: 'com.fasterxml', name: 'aalto-xml', version: '1.3.2'
}
tasks.named('test') {
useJUnitPlatform()
}
CodePudding user response:
I got it to work by extending AbstractControllerService instead of DBCPConnectionPool therefore not needing org.apache.nifi.dbcp.DBCPService anymore.