java.lang.NoClassDefFoundError: org/elasticsearch/transport/Netty4Plugin

I am getting this error on tomcat start. java.lang.NoClassDefFoundError: org/elasticsearch/transport/Netty4Plugin

I am using elasticsearch-6.0.0.jar, transport-5.6.4.jar. In maven it showed 5 other jars having compiler dependecy with transport.jar . I added even those 5 in my classpath. Still I am getting this error. Basically my project was using elasticsearch-1.7 and I am trying to upgrade it.

Client client = new PreBuiltTransportClient(settings)
			.addTransportAddress(new TransportAddress(InetAddress.getByName(ESHost1), ESPort))
			.addTransportAddress(new TransportAddress(InetAddress.getByName(ESHost2), ESPort));

Am I missing something here?

There’s something wrong as you can see a 6.0.0 jar mixed with a 5.6.4.

Something is wrong in your pom.xml I guess.

Did you read the Java client documentation?

BTW what is your elasticsearch server version?

I was facing same issue. Please update Netty with 4.1.13 dependency in yor pom.

I changed the transport jar to 6.0. My elasticsearch server is 6.0.1. My project is SVN. I am not using pom.xml. All the required jars I am downloading manually and adding into my classpath.jars

Now on tomcat restart I am getting

java.lang.NoClassDefFoundError: org/elasticsearch/common/settings/Settings

I am using 4.1.18

Can u please update transport to 6.0.0 in pom.

Saw the snapshot. Try to add these jars in buildpath.

Didn't you say:

In maven it showed 5 other jars

It means to me that you are using maven to list the needed dependencies, no?

I downloaded the jars from there and added in mine

I got that. But how do you know what are the needed deps?

I know it sound weird. I was running the method through main and whenever I got class not found exception I was finding those jars and adding. Actually the issue which I mentioned seems to work now, but still my tomcat is not starting. java.lang.IncompatibleClassChangeError: Implementing class.

What you should do is to create a simple pom.xml with this single dependency:


Then run:

mvn dependency:tree 

This will give you the exact list you need.

That said, you might suffer from some conflicts with the embedded libs that tomcat is using. This is what you need to figure out I guess.

1 Like

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