streamsets处理器找不到redis libs

ny6fqffe  于 2021-06-09  发布在  Redis
关注(0)|答案(1)|浏览(418)

我有两个装有redis和streamset的容器。我想用java编写定制处理器并放到流水线上。但当我将教程中的代码添加到处理器中,将jar发送到lib并尝试启动时,出现了一个异常。你能帮帮我吗?
处理器教程-https://github.com/streamsets/tutorials/blob/master/tutorial-processor/readme.md
redis教程-https://dzone.com/articles/quickstart-how-to-use-redis-on-java

redis:
    image: redis
    ports:
      - 6379:6379
    command: redis-server

  streamsets:
    build:
      context: "."
      args:
        SDC_LIBS: streamsets-datacollector-apache-kafka_2_0-lib                ports:
      - 18630:18630
    volumes:
      - ./user-libs:/opt/streamsets-datacollector-3.9.0/user-libs

在sampleprocessor中启动:

@Override
  protected List<ConfigIssue> init() {
      ....
      Config config = new Config();
      config.useSingleServer().setAddress("redis://redis:6379");
      redisson = Redisson.create(config);
      ... }

  <dependency>
      <groupId>org.redisson</groupId>
      <artifactId>redisson</artifactId>
      <version>3.10.4</version>
      <scope>provided</scope>
  </dependency>

处理器代码测试成功。
日志

streamsets_1  | 2020-03-21 14:00:19,954 [user:] [pipeline:] [runner:] [thread:main] [stage:] ERROR Main - Abnormal exit: java.lang.NoClassDefFoundError: Lorg/redisson/api/RedissonClient;

streamsets_1  | java.lang.NoClassDefFoundError: Lorg/redisson/api/RedissonClient;
streamsets_1  |         at java.lang.Class.getDeclaredFields0(Native Method)
streamsets_1  |         at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
streamsets_1  |         at java.lang.Class.privateGetPublicFields(Class.java:2614)
streamsets_1  |         at java.lang.Class.privateGetPublicFields(Class.java:2629)
streamsets_1  |         at java.lang.Class.getFields(Class.java:1557)
streamsets_1  |         at com.streamsets.datacollector.definition.ConfigDefinitionExtractor.validate(ConfigDefinitionExtractor.java:82)
streamsets_1  |         at com.streamsets.datacollector.definition.ConfigDefinitionExtractor.validate(ConfigDefinitionExtractor.java:65)
streamsets_1  |         at com.streamsets.datacollector.definition.StageDefinitionExtractor.validate(StageDefinitionExtractor.java:141)
streamsets_1  |         at com.streamsets.datacollector.definition.StageDefinitionExtractor.extract(StageDefinitionExtractor.java:197)
streamsets_1  |         at com.streamsets.datacollector.stagelibrary.ClassLoaderStageLibraryTask.loadStages(ClassLoaderStageLibraryTask.java:557)
streamsets_1  |         at com.streamsets.datacollector.stagelibrary.ClassLoaderStageLibraryTask.initTask(ClassLoaderStageLibraryTask.java:278)
streamsets_1  |         at com.streamsets.datacollector.task.AbstractTask.init(AbstractTask.java:62)
streamsets_1  |         at com.streamsets.datacollector.task.CompositeTask.initTask(CompositeTask.java:44)
streamsets_1  |         at com.streamsets.datacollector.task.AbstractTask.init(AbstractTask.java:62)
streamsets_1  |         at com.streamsets.datacollector.task.TaskWrapper.init(TaskWrapper.java:40)
streamsets_1  |         at com.streamsets.datacollector.main.Main.lambda$doMain$1(Main.java:123)
streamsets_1  |         at java.security.AccessController.doPrivileged(Native Method)
streamsets_1  |         at com.streamsets.datacollector.security.SecurityUtil.doAs(SecurityUtil.java:92)
streamsets_1  |         at com.streamsets.datacollector.main.Main.doMain(Main.java:158)
streamsets_1  |         at com.streamsets.datacollector.main.DataCollectorMain.main(DataCollectorMain.java:53)
streamsets_1  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
streamsets_1  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
streamsets_1  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
streamsets_1  |         at java.lang.reflect.Method.invoke(Method.java:498)
streamsets_1  |         at com.streamsets.pipeline.BootstrapMain.bootstrap(BootstrapMain.java:351)
streamsets_1  |         at com.streamsets.pipeline.BootstrapMain.main(BootstrapMain.java:110)
streamsets_1  | Caused by: java.lang.ClassNotFoundException: org.redisson.api.RedissonClient
streamsets_1  |         at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
streamsets_1  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
streamsets_1  |         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
streamsets_1  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:353)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:316)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:353)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:316)
streamsets_1  |         ... 26 more
streamsets_1  |
streamsets_1  | Abnormal exit: java.lang.NoClassDefFoundError: Lorg/redisson/api/RedissonClient;Check STDERR for more details
streamsets_1  |
streamsets_1  | java.lang.NoClassDefFoundError: Lorg/redisson/api/RedissonClient;
streamsets_1  |         at java.lang.Class.getDeclaredFields0(Native Method)
streamsets_1  |         at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
streamsets_1  |         at java.lang.Class.privateGetPublicFields(Class.java:2614)
streamsets_1  |         at java.lang.Class.privateGetPublicFields(Class.java:2629)
streamsets_1  |         at java.lang.Class.getFields(Class.java:1557)
streamsets_1  |         at com.streamsets.datacollector.definition.ConfigDefinitionExtractor.validate(ConfigDefinitionExtractor.java:82)
streamsets_1  |         at com.streamsets.datacollector.definition.ConfigDefinitionExtractor.validate(ConfigDefinitionExtractor.java:65)
streamsets_1  |         at com.streamsets.datacollector.definition.StageDefinitionExtractor.validate(StageDefinitionExtractor.java:141)
streamsets_1  |         at com.streamsets.datacollector.definition.StageDefinitionExtractor.extract(StageDefinitionExtractor.java:197)
streamsets_1  |         at com.streamsets.datacollector.stagelibrary.ClassLoaderStageLibraryTask.loadStages(ClassLoaderStageLibraryTask.java:557)
streamsets_1  |         at com.streamsets.datacollector.stagelibrary.ClassLoaderStageLibraryTask.initTask(ClassLoaderStageLibraryTask.java:278)
streamsets_1  |         at com.streamsets.datacollector.task.AbstractTask.init(AbstractTask.java:62)
streamsets_1  |         at com.streamsets.datacollector.task.CompositeTask.initTask(CompositeTask.java:44)
streamsets_1  |         at com.streamsets.datacollector.task.AbstractTask.init(AbstractTask.java:62)
streamsets_1  |         at com.streamsets.datacollector.task.TaskWrapper.init(TaskWrapper.java:40)
streamsets_1  |         at com.streamsets.datacollector.main.Main.lambda$doMain$1(Main.java:123)
streamsets_1  |         at java.security.AccessController.doPrivileged(Native Method)
streamsets_1  |         at com.streamsets.datacollector.security.SecurityUtil.doAs(SecurityUtil.java:92)
streamsets_1  |         at com.streamsets.datacollector.main.Main.doMain(Main.java:158)
streamsets_1  |         at com.streamsets.datacollector.main.DataCollectorMain.main(DataCollectorMain.java:53)
streamsets_1  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
streamsets_1  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
streamsets_1  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
streamsets_1  |         at java.lang.reflect.Method.invoke(Method.java:498)
streamsets_1  |         at com.streamsets.pipeline.BootstrapMain.bootstrap(BootstrapMain.java:351)
streamsets_1  |         at com.streamsets.pipeline.BootstrapMain.main(BootstrapMain.java:110)
streamsets_1  | Caused by: java.lang.ClassNotFoundException: org.redisson.api.RedissonClient
streamsets_1  |         at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
streamsets_1  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
streamsets_1  |         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
streamsets_1  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:353)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:316)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:353)
streamsets_1  |         at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:316)
streamsets_1  |         ... 26 more
m2xkgtsf

m2xkgtsf1#

问题很可能是您的依赖范围。您已指定 provided ,定义为:
这很像 compile ,但表示希望jdk或容器在运行时提供依赖关系。例如,在为javaenterpriseedition构建web应用程序时,可以将对servlet api和相关javaeeapi的依赖关系设置为scope provided 因为web容器提供了这些类。此作用域仅在编译和测试类路径上可用,并且不可传递。
您应该指定 compile 范围。

相关问题