Проблема
Я пытаюсь использовать верблюжий пучок camel -asticsearch-rest 2.22.2 в среде karaf 4.2.2 .
Когда я устанавливаю комплект верблюдов camel -asticsearch-rest все идет хорошо, и он автоматически устанавливает свои зависимости ( снимок экрана установочного комплекта camel -asticsearch-rest в karaf ):
- org.apache.servicemix.bundles.elasticsearch ( org.apache.servicemix.bundles / org.apache.servicemix.bundles.elasticsearch / 6.1.1_1 )
- org.apache.servicemix.bundles.elasticsearch-client ( org.apache.servicemix.bundles / org.apache.servicemix.bundles.elasticsearch-client / 6.1.1_1 )
- org.apache.httpcomponents.httpasyncclient ( org.apache.httpcomponents / httpasyncclient-osgi / 4.1.3 )
- org.apache.httpcomponents.httpclient ( org.ache.httpcomponents / httpclient-osgi / 4.5.5 )
- org.apache.httpcomponents.httpcore ( org.apache.httpcomponents / httpcore-osgi / 4.4.9 )
Код
В моем коде я называю camel -asticsearch-rest inвот так:
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
public class ServiceRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
CamelContext context = this.getContext();
restConfiguration()
.component("jetty")
.host("localhost")
.port(8200)
.contextPath("/api")
.dataFormatProperty("prettyPrint", "true")
.apiProperty("cors", "true");
rest("/elastic/test")
.get("/")
.route()
.setBody(simple("{ \"indexName\": \"test-index\" }"))
.to("elasticsearch-rest://elasticsearch?hostAddresses=127.0.0.1:9200&operation=INDEX&indexName=test-index&indexType=sample");
}
}
Я установил свой jar-комплект на karaf, но при запуске контекста верблюда я получаю это предупреждение, которое вызывает отключение верблюжьих маршрутов:
09:58: 44.595 WARN [fileinstall-C: \ Program Files \ apache-karaf \ 4.2.2 / deploy] Прослушиватель, вызвавший исключение, будет проигнорирован java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org / apache / http/ client / AuthCache на java.util.concurrent.FutureTask.report (FutureTask.java:122) ~ [?:?] на java.util.concurrent.FutureTask.get (FutureTask.java:192) ~ [?:?]в java.util.concurrent.AbstractExecutorService.doInvokeAny (AbstractExecutorService.java:193) ~ [?:?] в java.util.concurrent.AbstractExecutorService.invokeAny (AbstractExecutorService.java:225) ~ [?]: at:?.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper $ 4.call (ScheduledExecutorServiceWrapper.java:185) ~ [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper $ 15.call (ScheduledExecutorServiceWrapper.java:446) ~ [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.blueprint.utils.threading.RWLock.runReadOperation (RWLock.java:33) ~ [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.runUnlessShutdown (ScheduledExecutorServiceWrapper.java:443) ~ [44: org.apache.aries.blueprint.core: 1.10.1] atg.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.invokeAny (ScheduledExecutorServiceWrapper.java:180) ~ [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListener (BlueprintEventDispatcher.java:188) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListeners (BlueprintEventDispatcher.java:17) [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.blueprint.container.BlueprintEventDispatcher.blueprintEvent (BlueprintEventDispatcher.java:133) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun (BlueprintContainerImpl.java:427) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.blueprint.container.BlueprintContainerImpl.run (BlueprintContainerImpl.java:278) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.blueprint.container.BlueprintExtender.createContainer (BlueprintExtender.java: 299) [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.blueprint.container.BlueprintExtender.createContainer (BlueprintExtender.java:268)[44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.blueprint.container.BlueprintExtender.createContainer (BlueprintExtender.java:264) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle (BlueprintExtender.java:254) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.util.tracker.hook.BundleHookBundleTracker $ Tracked.customizerModified (BundleHookBundleTracker.java:500) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.util.tracker.hook.BundleHookBundleTracker $Tracked.customizerModified (BundleHookBundleTracker.java:433) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.aries.util.tracker.hook.BundleHookBundleTracker $ AbstractTracked.track (BundleHookBundleTracker.jpg: BundleHookBundleTracker.jpg725) [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker $ Tracked.bundleChanged (BundleHookBundleTracker.java:463) [44: org.apache.aries.blueprint.core: 1.10.1] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker $ BundleEventHook.event (BundleHookBundleTracker.java:422) [44: org.apache.aries.blueprint.core: 1.10.1] в org.apache.felix.framework.util.SecureAction.invokeBundleEventHook (SecureAction.java:1179) [?:?] В org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks (EventDispatcher.java:730) [?:?] В org.apache.felix.framework.fireBundleEvent (EventDispatcher.java:485) [?:?] в org.apache.felix.framework.Felix.fireBundleEvent (Felix.java:4579) [?:?] в org.apache.felix.framework.Felix.startBundle (Felix.java:2174) [?:?] В org.apache.felix.framework.BundleImpl.start (BundleImpl.java:998) [?:?] В org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle (DirectoryWatcher.java:1260) [10: org.apache.felix.fileinstall: 3.6.4] в org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles (DirectoryWatcher.java:1233) [10: org.apache.felix.fileinstall: 3.6.4] по адресу org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess (DirectoryWatcher.java:520) [10: org.apache.felix.fileinstall: 3.6.4] в org.apache.felix.fileinstall.internal.DirectoryWatcher.process (DirectoryWatcher.java:365) [10: org.apache.felix.fileinstall: 3.6.4] at org.apache.felix.fileinstall.internal.DirectoryWatcher.run (DirectoryWatcher.java:316) [10: org.apache.felix.fileinstall: 3.6.4] Причина:java.lang.NoClassDefFoundError: org / apache / http / client / AuthCache на org.apache.camel.component.elasticsearch.ElasticsearchProducer.createClient (ElasticsearchProducer.java:255) ~ [?:?] на org.apache.camel.com.elasticsearch.ElasticsearchProducer.startClient (ElasticsearchProducer.java:246) ~ [?:?] at org.apache.camel.component.elasticsearch.ElasticsearchProducer.doStart (ElasticsearchProducer.java:237) ~ [?:?] в org.apache.camel.support.ServiceSupport.start (ServiceSupport.java:61) ~ [?:?] в org.apache.camel.util.ServiceHelper.startService (ServiceHelper.java:75) ~ [?:?] в org.apache.camel.impl.DeferServiceStartupListener.onCamelContextStarted (DeferServiceStartupListener.java:49) ~ [?:?] в org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices (DefaultCamelContext.java:3863) ~ [?:?] в org.apache.camel.impl.Def.doStartOrResumeRoutes (DefaultCamelContext.java:3642) ~ [?:?] в org.apache.camel.impl.DefaultCamelContext.doStartCamel (DefaultCamelContext.java:3494) ~ [?:?] в org.apache.camel.limpl.получить доступ к $ 000 (DefaultCamelContext.java:209) ~ [?:?] в org.apache.camel.impl.DefaultCamelContext $ 2.call (DefaultCamelContext.java:3253) ~ [?:?] в org.apache.camel.impl.DefaultCamelContext $ 2.call (DefaultCamelContext.java:3249) ~ [?:?]в org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader (DefaultCamelContext.java:3272)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext.doStart (DefaultCamelContext.java:3249)
~ [:?]
в org.apache.camel.support.ServiceSupport.start (ServiceSupport.java:61)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext.start (DefaultCamelContext.java:3165)
~ [:?]
в org.apache.camel.blueprint.BlueprintCamelContext.start (BlueprintCamelContext.java:243)
~ [:?]
в org.apache.camel.blueprint.BlueprintCamelContext.maybeStart (BlueprintCamelContext.java:283)
~ [:?]
в org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent (BlueprintCamelContext.java:177)
~ [:?]
в org.apache.aries.blueprint.container.BlueprintEventDispatcher $ 3.call (BlueprintEventDispatcher.java:190)
~ [:?]
в org.apache.aries.blueprint.container.BlueprintEventDispatcher $ 3.call (BlueprintEventDispatcher.java:188)
~ [:?]
в java.util.concurrent.FutureTask.run (FutureTask.java:266) ~ [?:?]
в java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java:511)
~ [:?]
в java.util.concurrent.FutureTask.run (FutureTask.java:266) ~ [?:?]
в java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java:511)
~ [:?]
в java.util.concurrent.FutureTask.run (FutureTask.java:266) ~ [?:?]
в java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 201 (ScheduledThreadPoolExecutor.java:180)
~ [:?]
в java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:293)
~ [:?]
в java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
~ [:?]
в java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:624)
~ [:?]
at java.lang.Thread.run (Thread.java:748) ~ [?:?] Причина: java.lang.ClassNotFoundException: org.apache.http.client.AuthCache not
найден org.apache.servicemix.bundles.elasticsearch-client [124]
в org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation (BundleWiringImpl.java:1639)
~ [:?]
в org.apache.felix.framework.BundleWiringImpl.access $ 200 (BundleWiringImpl.java:80)
~ [:?]
в org.apache.felix.framework.BundleWiringImpl $ BundleClassLoader.loadClass (BundleWiringImpl.java:2053)
~ [:?]
at java.lang.ClassLoader.loadClass (ClassLoader.java:357) ~ [?:?]
в org.apache.camel.component.elasticsearch.ElasticsearchProducer.createClient (ElasticsearchProducer.java:255)
~ [:?]
в org.apache.camel.component.elasticsearch.ElasticsearchProducer.startClient (ElasticsearchProducer.java:246)
~ [:?]
в org.apache.camel.component.elasticsearch.ElasticsearchProducer.doStart (ElasticsearchProducer.java:237)
~ [:?]
в org.apache.camel.support.ServiceSupport.start (ServiceSupport.java:61)
~ [:?]
в org.apache.camel.util.ServiceHelper.startService (ServiceHelper.java:75)
~ [:?]
в org.apache.camel.impl.DeferServiceStartupListener.onCamelContextStarted (DeferServiceStartupListener.java:49)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices (DefaultCamelContext.java:3863)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes (DefaultCamelContext.java:3642)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext.doStartCamel (DefaultCamelContext.java:3494)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext.access $ 000 (DefaultCamelContext.java:209)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext $ 2.call (DefaultCamelContext.java:3253)
~ [:?]
в org.apache.camel.impl.DefaultCamelContext $ 2.call (DefaultCamelContext.java:3249)
~ [:?]в org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader (DefaultCamelContext.java:3272) ~ [?:?] в org.apache.camel.impl.DefaultCamelContext.doStart (DefaultCamelContext.java:32])в org.apache.camel.support.ServiceSupport.start (ServiceSupport.java:61) ~ [?:?] в org.apache.camel.impl.DefaultCamelContext.start (DefaultCamelContext.java:3165) ~ [?:?]в org.apache.camel.blueprint.BlueprintCamelContext.start (BlueprintCamelContext.java:243) ~ [?:?] в org.apache.camel.blueprint.BlueprintCamelContext.maybeStart (BlueprintCamelContext.java:283]??:в org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent (BlueprintCamelContext.java:177) ~ [?:?] в org.apache.aries.blueprint.container.BlueprintEventDispatcher $ 3.call (BlueprintEventDispatcher.java? 190):?] at org.apache.aries.blueprint.container.BlueprintEventDispatcher $ 3.call (BlueprintEventDispatcher.java:188) ~ [?:?] at java.util.concurrent.FutureTask.run (FutureTask.java:266) ~ [?:?] на java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java:511) ~ [?:?] в java.util.concurrent.FutureTask.run (FutureTask.java:266) ~ [?:?] в java.util.concurrent.Executors $RunnableAdapter.call (Executors.java:511) ~ [?:?] В java.util.concurrent.FutureTask.run (FutureTask.java:266) ~ [?:?] В java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.доступ к $ 201 (ScheduledThreadPoolExecutor.java:180) ~ [?:?] в java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:293) ~ [?:?] at java.util.conecor(ThreadPoolExecutor.java:1149) ~ [?:?] В java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:624) ~ [?:?] В java.lang.Thread.run (Thread.java: 748) ~ [?:?]
Вопрос
Мой вопрос, почему org.apache.servicemix.bundles.elasticsearch-client делаетне найти класс org.apache.http.client.AuthCache .
Этот класс должен находиться в зависимости org.apache.httpcomponents.httpclient , правильно установленной на karaf.
Я видел, что в org.apache.servicemix.bundles.elasticsearch-client В комплекте нет импортированных пакетов ( снимок экрана импортированных пакетов ), это нормально?Это ошибка или я что-то упустил?