我正在遵循here所述的快速入门指南。
我在centos6虚拟机中执行了以下步骤来安装cygnus,我得到了一个ClassNotFoundException:
yum install java-1.7.0-openjdk-devel
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64 (to .bash_profile)
cat > /etc/yum.repos.d/fiware.repo <<EOL
[Fiware]
name=FIWARE repository
baseurl=http://repositories.testbed.fi-ware.eu/repo/rpm/x86_64/
gpgcheck=0
enabled=1
EOL
yum install cygnus
配置和测试我使用
填写/usr/cygnus/conf/agent_test.conf
的安装
cygnus-ngsi.sources = http-source
cygnus-ngsi.sinks = test-sink
cygnus-ngsi.channels = test-channel
cygnus-ngsi.sources.http-source.channels = test-channel
cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnus-ngsi.sources.http-source.port = 5050
cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
cygnus-ngsi.sources.http-source.handler.notification_target = /notify
cygnus-ngsi.sources.http-source.handler.default_service = def_serv
cygnus-ngsi.sources.http-source.handler.default_service_path = def_servpath
cygnus-ngsi.sources.http-source.handler.events_ttl = 2
cygnus-ngsi.sources.http-source.interceptors = ts gi
cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
cygnus-ngsi.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.NGSIGroupingInterceptor$Builder
cygnus-ngsi.sources.http-source.interceptors.gi.grouping_rules_conf_file = /Applications/apache-flume-1.4.0-bin/conf/grouping_rules.conf
cygnus-ngsi.channels.test-channel.type = memory
cygnus-ngsi.channels.test-channel.capacity = 1000
cygnus-ngsi.channels.test-channel.transactionCapacity = 100
cygnus-ngsi.sinks.test-sink.channel = test-channel
cygnus-ngsi.sinks.test-sink.type = com.telefonica.iot.cygnus.sinks.NGSITestSink
cygnus-ngsi.sinks.test-sink.batch_size = 1
cygnus-ngsi.sinks.test_sink.batch_timeout = 10
我执行了命令:
/usr/cygnus/bin/cygnus-flume-ng agent --conf /usr/cygnus/conf/ -f /usr/cygnus/conf/agent_test.conf -n cygnus-ngsi -Dflume.root.logger=INFO,console
运行后,显示以下错误:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/cygnus/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/cygnus/plugins.d/cygnus/lib/cygnus-0.13.0-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
time=2017-02-24T17:53:59.608BRT | lvl=INFO | trans= | srv= | subsrv= | function=main | comp=Cygnus | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[248] : Starting Cygnus application
time=2017-02-24T17:53:59.615BRT | lvl=INFO | trans= | srv= | subsrv= | function=main | comp=Cygnus | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[254] : Waiting for valid Flume components references...
time=2017-02-24T17:53:59.616BRT | lvl=INFO | trans= | srv= | subsrv= | function=start | comp=Cygnus | msg=org.apache.flume.node.PollingPropertiesFileConfigurationProvider[61] : Configuration provider starting
time=2017-02-24T17:53:59.618BRT | lvl=INFO | trans= | srv= | subsrv= | function=run | comp=Cygnus | msg=org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable[133] : Reloading configuration file:/usr/cygnus/conf/agent_test.conf
time=2017-02-24T17:53:59.623BRT | lvl=INFO | trans= | srv= | subsrv= | function=addProperty | comp=Cygnus | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test-sink
time=2017-02-24T17:53:59.623BRT | lvl=INFO | trans= | srv= | subsrv= | function=addProperty | comp=Cygnus | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test-sink
time=2017-02-24T17:53:59.623BRT | lvl=INFO | trans= | srv= | subsrv= | function=addProperty | comp=Cygnus | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test_sink
time=2017-02-24T17:53:59.623BRT | lvl=INFO | trans= | srv= | subsrv= | function=addProperty | comp=Cygnus | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[930] : Added sinks: test-sink Agent: cygnus-ngsi
time=2017-02-24T17:53:59.623BRT | lvl=INFO | trans= | srv= | subsrv= | function=addProperty | comp=Cygnus | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test-sink
time=2017-02-24T17:53:59.637BRT | lvl=INFO | trans= | srv= | subsrv= | function=validateConfiguration | comp=Cygnus | msg=org.apache.flume.conf.FlumeConfiguration[140] : Post-validation flume configuration contains configuration for agents: [cygnus-ngsi]
time=2017-02-24T17:53:59.637BRT | lvl=INFO | trans= | srv= | subsrv= | function=loadChannels | comp=Cygnus | msg=org.apache.flume.node.AbstractConfigurationProvider[150] : Creating channels
time=2017-02-24T17:53:59.646BRT | lvl=INFO | trans= | srv= | subsrv= | function=create | comp=Cygnus | msg=org.apache.flume.channel.DefaultChannelFactory[40] : Creating instance of channel test-channel type memory
time=2017-02-24T17:53:59.650BRT | lvl=INFO | trans= | srv= | subsrv= | function=loadChannels | comp=Cygnus | msg=org.apache.flume.node.AbstractConfigurationProvider[205] : Created channel test-channel
time=2017-02-24T17:53:59.651BRT | lvl=INFO | trans= | srv= | subsrv= | function=create | comp=Cygnus | msg=org.apache.flume.source.DefaultSourceFactory[39] : Creating instance of source http-source, type org.apache.flume.source.http.HTTPSource
time=2017-02-24T17:53:59.654BRT | lvl=ERROR | trans= | srv= | subsrv= | function=configure | comp=Cygnus | msg=org.apache.flume.source.http.HTTPSource[113] : Error while configuring HTTPSource. Exception follows.
java.lang.ClassNotFoundException: com.telefonica.iot.cygnus.handlers.NGSIRestHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at org.apache.flume.source.http.HTTPSource.configure(HTTPSource.java:102)
at org.apache.flume.conf.Configurables.configure(Configurables.java:41)
at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:331)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:102)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
time=2017-02-24T17:53:59.665BRT | lvl=ERROR | trans= | srv= | subsrv= | function=loadSources | comp=Cygnus | msg=org.apache.flume.node.AbstractConfigurationProvider[366] : Source http-source has been removed due to an error during configuration
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.telefonica.iot.cygnus.handlers.NGSIRestHandler
at com.google.common.base.Throwables.propagate(Throwables.java:156)
at org.apache.flume.source.http.HTTPSource.configure(HTTPSource.java:114)
at org.apache.flume.conf.Configurables.configure(Configurables.java:41)
at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:331)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:102)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.telefonica.iot.cygnus.handlers.NGSIRestHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at org.apache.flume.source.http.HTTPSource.configure(HTTPSource.java:102)
... 11 more
time=2017-02-24T17:53:59.668BRT | lvl=INFO | trans= | srv= | subsrv= | function=create | comp=Cygnus | msg=org.apache.flume.sink.DefaultSinkFactory[40] : Creating instance of sink: test-sink, type: com.telefonica.iot.cygnus.sinks.NGSITestSink
time=2017-02-24T17:53:59.668BRT | lvl=ERROR | trans= | srv= | subsrv= | function=run | comp=Cygnus | msg=org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable[142] : Failed to load configuration data. Exception follows.
org.apache.flume.FlumeException: Unable to load sink type: com.telefonica.iot.cygnus.sinks.NGSITestSink, class: com.telefonica.iot.cygnus.sinks.NGSITestSink
at org.apache.flume.sink.DefaultSinkFactory.getClass(DefaultSinkFactory.java:69)
at org.apache.flume.sink.DefaultSinkFactory.create(DefaultSinkFactory.java:41)
at org.apache.flume.node.AbstractConfigurationProvider.loadSinks(AbstractConfigurationProvider.java:415)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:103)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.telefonica.iot.cygnus.sinks.NGSITestSink
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at org.apache.flume.sink.DefaultSinkFactory.getClass(DefaultSinkFactory.java:67)
... 11 more
time=2017-02-24T17:54:00.616BRT | lvl=INFO | trans= | srv= | subsrv= | function=main | comp=Cygnus | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[254] : Waiting for valid Flume components references...
有谁知道如何解决这个问题?我表演错了吗?
答案 0 :(得分:1)
这可能是一个安装错误。使用docker进行安装时,此问题不存在。