Elasticsearch 6.1 mvn Dependencies tree. How to find missing and automatically include dependencies


(SatyaRaj) #1

Hi Team,

SEVERE: Exception sending context initialized event to listener instance of class kv.complex.web.LifecycleListener
java.lang.NoClassDefFoundError: org/apache/lucene/util/Accountable
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3205)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
        at org.elasticsearch.common.settings.Settings$Builder.loadFromSource(Settings.java:1147)
        at kv.complex.services.search.base.NodeIndexer.init(NodeIndexer.java:62)
        at kv.complex.services.search.base.NodeIndexer.<init>(NodeIndexer.java:37)
        at kv.complex.services.search.base.NodeIndexer.<clinit>(NodeIndexer.java:32)
        at kv.complex.web.LifecycleListener.contextInitialized(LifecycleListener.java:30)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.util.Accountable
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
        ... 25 more

Jan 12, 2018 12:56:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Jan 12, 2018 12:56:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/container] startup failed due to previous errors
Jan 12, 2018 12:56:49 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class kv.complex.web.LifecycleListener
java.lang.NoClassDefFoundError: Could not initialize class kv.complex.services.search.base.NodeIndexer
        at kv.complex.web.LifecycleListener.contextDestroyed(LifecycleListener.java:38)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5165)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5829)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:149)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)

Please Help


(David Pilato) #2

I can't see anything in this stacktrace which package starts with org.elasticsearch.
Are you using elasticsearch?

How? What do you do?

Sounds like you're deploying inside a Tomcat container. What are you deploying?

Hard to help without any clue.


(SatyaRaj) #3

Hi dadoonet,

I'm using elastic search v6.1. And has deployed .war file on tomcat.
While starting up just before tomcat starts this is the only exception that is throwing up.
I've updated the complete stack trace in desc

Assuming lucene in stacktrace is related ot elasticsearch.


(David Pilato) #4

Again, without any code, any pom, anything which can help to understand what you are doing, it's hard to diagnose.

May be you have a dependency in your project which is conflicting?

mvn dependency:tree 

Might help.


(SatyaRaj) #5

ok, Let me dig back to what I've done with my code.
I'm upgrading to ES v6.1. I've also included ES v5.0 in pom.xml to make the below code work.
Seems like this has caused the issue.

Please let me know if pom.xml containing 2 versions of elastic search can cause application not to load properly. Also an alternative to below.

Settings settings = Settings.builder()
        .put("cluster.name", "Local-Dev").build();
client = new PreBuiltTransportClient(settings);
try {
		client.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300));
	} catch (UnknownHostException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

(David Pilato) #6

Yes. You can't have 2 versions in the same classloader .


(SatyaRaj) #7

OK. So Now my issue is , prebuilttransportclient is latest in 6.1 as per
docs. why is it saying class not found when try to build my service.


(David Pilato) #8

I don't know without seeing what you are doing.


(system) #9

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.