0

I am trying to run an application which uses Datastax library for DSE-graph

Project pom.xml

<dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>dse-driver</artifactId>
            <version>1.1.1-beta1</version>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-core</artifactId>
            <version>2.1.5</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.vertx/vertx-hazelcast -->
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-hazelcast</artifactId>
            <version>2.1.5</version>
        </dependency>

        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-platform</artifactId>
            <version>2.1.5</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.5.0</version>
                <configuration>
                    <mainClass>my.app.Server</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
        </plugins>
    </build>

When I am running this application on windows using mvn exec:java its running fine. But When I am running this application on Ubantu I am getting this below error.

    java.lang.VerifyError: class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe overrides final method beginRead.()V
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
            at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:264)
            at com.datastax.driver.core.NettyUtil.<clinit>(NettyUtil.java:96)
            at com.datastax.driver.core.NettyOptions.eventLoopGroup(NettyOptions.java:99)
            at com.datastax.driver.core.Connection$Factory.<init>(Connection.java:769)
            at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1400)
            at com.datastax.driver.core.Cluster.init(Cluster.java:159)
            at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:330)
            at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:305)
            at com.datastax.driver.core.Cluster.connect(Cluster.java:247)
            at com.datastax.driver.core.DelegatingCluster.connect(DelegatingCluster.java:71)
            at com.datastax.driver.dse.DseCluster.connect(DseCluster.java:351)
            at my.app.datasource.db.DataSource.getSessionInstance(DataSource.java:73)
 at my.app.services.VertexService.getVertexByName(VertexService.java:59)
        at my.app.services.VertexService.getVertexIdByName(VertexService.java:77)
        at my.app.api.eventdetails.EventDetailsRequestHandler$2.handle(EventDetailsRequestHandler.java:52)
        at org.vertx.java.core.VoidHandler.handle(VoidHandler.java:27)
        at org.vertx.java.core.VoidHandler.handle(VoidHandler.java:24)
        at org.vertx.java.core.http.impl.DefaultHttpServerRequest.handleEnd(DefaultHttpServerRequest.java:314)
        at org.vertx.java.core.http.impl.ServerConnection.handleEnd(ServerConnection.java:209)
        at org.vertx.java.core.http.impl.ServerConnection.processMessage(ServerConnection.java:313)
        at org.vertx.java.core.http.impl.ServerConnection.handleMessage(ServerConnection.java:94)
        at org.vertx.java.core.http.impl.DefaultHttpServer$ServerHandler.doMessageReceived(DefaultHttpServer.java:710)
        at org.vertx.java.core.http.impl.DefaultHttpServer$ServerHandler.doMessageReceived(DefaultHttpServer.java:600)
        at org.vertx.java.core.http.impl.VertxHttpHandler.channelRead(VertxHttpHandler.java:72)
        at org.vertx.java.core.net.impl.VertxHandler.channelRead(VertxHandler.java:155)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321)
        at org.vertx.java.core.http.impl.cgbystrom.FlashPolicyHandler.channelRead(FlashPolicyHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1280)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:890)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:564)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:505)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:419)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:391)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
        at java.lang.Thread.run(Thread.java:745)

EDIT 1 : added mvn dependency:tree

 [dependency:tree {execution: default-cli}]
[INFO] my.app:app1:jar:0.0.1-SNAPSHOT
[INFO] +- com.datastax.cassandra:java-dse-graph:jar:1.0.0-beta1:compile
[INFO] |  +- com.datastax.cassandra:dse-driver:jar:1.1.1-beta1:compile
[INFO] |  |  +- com.datastax.cassandra:cassandra-driver-core:jar:3.1.2:compile
[INFO] |  |  |  +- io.netty:netty-handler:jar:4.0.37.Final:compile
[INFO] |  |  |  |  +- io.netty:netty-buffer:jar:4.0.37.Final:compile
[INFO] |  |  |  |  |  \- io.netty:netty-common:jar:4.0.37.Final:compile
[INFO] |  |  |  |  +- io.netty:netty-transport:jar:4.0.37.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-codec:jar:4.0.37.Final:compile
[INFO] |  |  |  +- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
[INFO] |  |  |  +- com.github.jnr:jnr-ffi:jar:2.0.7:compile
[INFO] |  |  |  |  +- com.github.jnr:jffi:jar:1.2.10:compile
[INFO] |  |  |  |  +- com.github.jnr:jffi:jar:native:1.2.10:runtime
[INFO] |  |  |  |  +- org.ow2.asm:asm:jar:5.0.3:compile
[INFO] |  |  |  |  +- org.ow2.asm:asm-commons:jar:5.0.3:compile
[INFO] |  |  |  |  +- org.ow2.asm:asm-analysis:jar:5.0.3:compile
[INFO] |  |  |  |  +- org.ow2.asm:asm-tree:jar:5.0.3:compile
[INFO] |  |  |  |  +- org.ow2.asm:asm-util:jar:5.0.3:compile
[INFO] |  |  |  |  \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] |  |  |  \- com.github.jnr:jnr-posix:jar:3.0.27:compile
[INFO] |  |  |     \- com.github.jnr:jnr-constants:jar:0.9.0:compile
[INFO] |  |  \- com.google.guava:guava:jar:16.0.1:compile
[INFO] |  +- org.apache.tinkerpop:gremlin-groovy:jar:3.2.3:compile
[INFO] |  |  +- org.apache.tinkerpop:gremlin-core:jar:3.2.3:compile
[INFO] |  |  |  +- org.apache.tinkerpop:gremlin-shaded:jar:3.2.3:compile
[INFO] |  |  |  +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] |  |  |  |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |  |  +- org.yaml:snakeyaml:jar:1.15:compile
[INFO] |  |  |  +- org.javatuples:javatuples:jar:1.2:compile
[INFO] |  |  |  +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] |  |  |  +- com.jcabi:jcabi-manifests:jar:1.1:compile
[INFO] |  |  |  |  \- com.jcabi:jcabi-log:jar:0.14:compile
[INFO] |  |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] |  |  +- org.apache.ivy:ivy:jar:2.3.0:compile
[INFO] |  |  +- org.codehaus.groovy:groovy:jar:indy:2.4.7:compile
[INFO] |  |  +- org.codehaus.groovy:groovy-groovysh:jar:indy:2.4.7:compile
[INFO] |  |  |  +- org.codehaus.groovy:groovy:jar:2.4.7:compile
[INFO] |  |  |  +- jline:jline:jar:2.12:compile
[INFO] |  |  |  \- org.codehaus.groovy:groovy-console:jar:2.4.7:compile
[INFO] |  |  |     +- org.codehaus.groovy:groovy-swing:jar:2.4.7:compile
[INFO] |  |  |     \- org.codehaus.groovy:groovy-templates:jar:2.4.7:compile
[INFO] |  |  |        \- org.codehaus.groovy:groovy-xml:jar:2.4.7:compile
[INFO] |  |  +- org.codehaus.groovy:groovy-json:jar:indy:2.4.7:compile
[INFO] |  |  +- org.codehaus.groovy:groovy-jsr223:jar:indy:2.4.7:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.3.1:compile
[INFO] |  |  \- com.github.jeremyh:jBCrypt:jar:jbcrypt-0.4:compile
[INFO] |  \- org.apache.tinkerpop:tinkergraph-gremlin:jar:3.2.3:compile
[INFO] +- io.vertx:vertx-core:jar:2.1.5:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.6.2:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.2.2:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.2.2:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.2.2:compile
[INFO] |  +- io.netty:netty-all:jar:4.0.21.Final:compile
[INFO] |  \- log4j:log4j:jar:1.2.16:compile
[INFO] +- io.vertx:vertx-hazelcast:jar:2.1.5:compile
[INFO] |  \- com.hazelcast:hazelcast:jar:3.2.3:compile
[INFO] |     \- net.sourceforge.findbugs:annotations:jar:1.3.2:compile
[INFO] +- io.vertx:vertx-platform:jar:2.1.5:provided
[INFO] +- redis.clients:jedis:jar:2.9.0:compile
[INFO] |  \- org.apache.commons:commons-pool2:jar:2.4.2:compile
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] \- org.json:json:jar:20160810:compile
Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Prakash P
  • 3,582
  • 4
  • 38
  • 66
  • Delete jars from folder .mvn at your home in Ubuntu, and try to download all the dependency again.May be any wrong version dependency were on class-path that is not compatible. – Anil Agrawal Jan 25 '17 at 12:15
  • tried din't helped. I deployed this on two ubuntu server on cloud and got same error. – Prakash P Jan 25 '17 at 12:23

1 Answers1

2

Execute the below command from project home folder,

mvn dependency:tree

And find the version of below dependency

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-transport-native-epoll</artifactId>
</dependency>

May be multiple versions are available of this dependency.

You can exclude any specific version from any dependency if required as below

    <dependency>
        <groupId>parent-dependency-group</groupId>
        <artifactId>parent-dependency</artifactId>
        <version>${parent.dependency.version}</version>
        <exclusions>
            <exclusion>
                <groupId>parent-dependency-group</groupId>
                <artifactId>parent-dependency</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

As per dependency tree, replace

    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-core</artifactId>
        <version>2.1.5</version>
    </dependency>

with

<dependency> 
    <groupId>io.vertx</groupId> 
    <artifactId>vertx-core</artifactId> 
    <version>2.1.5</version>
    <exclusions> 
        <exclusion> 
            <groupId>io.netty</groupId> 
            <artifactId>netty-all</artifactId> 
        </exclusion> 
    </exclusions> 
</dependency>
<dependency> 
    <groupId>io.netty</groupId> 
    <artifactId>netty-all</artifactId> 
    <version>4.0.37.Final</version> 
</dependency>

In your POM

Anil Agrawal
  • 2,748
  • 1
  • 24
  • 31
  • `mvn dependency:tree | grep netty [INFO] | | | +- io.netty:netty-handler:jar:4.0.37.Final:compile [INFO] | | | | +- io.netty:netty-buffer:jar:4.0.37.Final:compile [INFO] | | | | | \- io.netty:netty-common:jar:4.0.37.Final:compile [INFO] | | | | +- io.netty:netty-transport:jar:4.0.37.Final:compile [INFO] | | | | \- io.netty:netty-codec:jar:4.0.37.Final:compile [INFO] | +- io.netty:netty-all:jar:4.0.21.Final:compile ` – Prakash P Jan 25 '17 at 12:34
  • I got above output `mvn dependency:tree` by running this command – Prakash P Jan 25 '17 at 12:34
  • 1
    I am not sure, because I didn't checked the classes inside netty-all dependency, but you can try. Exclude the dependency netty-all and add the same explicitly in your pom file with version 4.0.37 – Anil Agrawal Jan 25 '17 at 12:37
  • how can I know which library is downloading `netty-all` so that I can exclude it – Prakash P Jan 25 '17 at 12:48
  • It can be identify by analyzing dependency tree. If you carefully check the tree, it shows the dependency hierarchy. You can exclude the netty-all from the top most parent dependency (present in pom) . Share the whole dependency tree, I'll try to help you – Anil Agrawal Jan 25 '17 at 19:28
  • could you please have a look at `mvn dependency:tree` added above in question – Prakash P Jan 27 '17 at 07:05
  • io.vertx:vertx-core:jar:2.1.5:compile brings io.netty:netty-all:jar:`4.0.21`.Final:compile but om.datastax.cassandra:cassandra-driver-core:jar:3.1.2:compile brings io.netty:netty-handler:jar:`4.0.37`.Final:compile. These versions must match, Exclude one of them. – rkosegi Jan 27 '17 at 07:10
  • Thanks @AnilAgrawal but little confusion here, why to add `netty-all` again – Prakash P Jan 27 '17 at 07:41
  • Because netty-all is required by vertx-core but no other dependency fetching it from repo. If it present under any other dependency tree, it don't require to add it explicitly in POM. Is your application working now? – Anil Agrawal Jan 27 '17 at 07:45
  • yes working fine on ubuntu desktop without adding `netty-all`, though have not tested it on production. – Prakash P Jan 27 '17 at 07:52