服务API不应与实施捆绑在一起。创建“幽灵”执行
我正在研究以下NIFI控制器服务捆绑包:
- Nifi-Controllers-Bundle
- nifi-controllers
- nifi-controllers-api
- nifi-controllers-nar
- nifi-controllers-api-nar
i有一个自定义控制器服务(standardMyservice),该服务将dbcpconnectionpool扩展到nifi-controllers中的dbcpconnectionpool,当我尝试在UI中使用它时,我会在UI中使用它。日志中的以下例外:错误[NIFI Web Server-36] oanifi.controller.extensionbuilder无法创建com.xxx.yyy.standardmyservice的控制器服务ID 812DE259-0181-1000181-1000-3536-A06E3AE3AE9F2 DUCOM:控制器服务com.xxx.yyy.standardmyservice与其支持的apis org.apache.nifi.dbcp.dbcpservice捆绑在一起。服务API不应与实施捆绑在一起。创建“ ghost”实现
和UI中的此功能:'丢失控制器服务'已验证的'Angy ofthy属性'无效,因为控制器服务是com.xxx.yyy.standardmyservice的类型,但这不是有效的报告任务类型
我认为我实现标准电流服务类的方式没有什么问题,因为我已经在NIFI Controller Service Service Maven Artepepe中对其进行了测试,并且可以正常进行。
我的nifi-controllers build.gradle看起来像这样:
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()
}
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()
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过扩展
AbstractControllerService
而不是dbcpconnectionpool
,因此我可以使用它来工作,因此不需要org.apache.nifi.dbcp.dbcpservice
。le:将项目与Gradle构建,
Nifi-Standard-Services-api-nar没有,将这种依赖性放在nar nar档案中的清单文件中。当我在清单文件中手动添加这些行时,所有内容都可以使用:
项目中唯一需要的依赖性是buildors build.gradle中的nifi-dbcp-service-api。
I got it to work by extending
AbstractControllerService
instead ofDBCPConnectionPool
, therefore not needingorg.apache.nifi.dbcp.DBCPService
anymore.LE: Having the project built with gradle, there is no
for nifi-standard-services-api-nar that puts this dependency in the MANIFEST file of the nar archive of processors-nar. When I added manually these lines in MANIFEST file, everything worked:
and the only dependency needed in the project is nifi-dbcp-service-api in processors build.gradle.