Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
None
-
Cassandra 3.3
-
Low
Description
When running Cassandra in embedded mode (pulling the cassandra-all-3.3.jar from Maven) and activating UDF, I face the following exceptions when trying to create an UDF:
18:13:57.922 [main] DEBUG ACHILLES_DDL_SCRIPT - SCRIPT : CREATE FUNCTION convertToLong(input text) RETURNS NULL ON NULL INPUT RETURNS bigint LANGUAGE java AS $$return Long.parseLong(input);$$; 18:13:57.970 [SharedPool-Worker-1] ERROR o.apache.cassandra.transport.Message - Unexpected exception during request; channel = [id: 0x03f52731, /192.168.1.16:55224 => /192.168.1.16:9240] java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor at org.apache.cassandra.cql3.functions.JavaBasedUDFunction.<clinit>(JavaBasedUDFunction.java:79) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.cql3.functions.UDFunction.create(UDFunction.java:223) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.cql3.statements.CreateFunctionStatement.announceMigration(CreateFunctionStatement.java:162) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:93) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:206) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:237) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:222) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:115) ~[cassandra-all-3.3.jar:3.3] at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:507) [cassandra-all-3.3.jar:3.3] at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:401) [cassandra-all-3.3.jar:3.3] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.23.Final.jar:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.23.Final.jar:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32) [netty-all-4.0.23.Final.jar:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324) [netty-all-4.0.23.Final.jar:4.0.23.Final] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60-ea] at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:164) [cassandra-all-3.3.jar:3.3] at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) [cassandra-all-3.3.jar:3.3] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60-ea] Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_60-ea] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_60-ea] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_60-ea] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_60-ea] ... 18 common frames omitted
The stack-trace is quite explicit, some classes from the objectweb/asm are missing. By looking into the $CASSANDRA_HOME/lib folder:
19:44:07 :/opt/apps/apache-cassandra-3.2/lib] % ll total 48768 -rw-r--r--@ 1 archinnovinfo wheel 234K Jan 7 22:42 ST4-4.0.8.jar -rw-r--r--@ 1 archinnovinfo wheel 85K Jan 7 22:42 airline-0.6.jar -rw-r--r--@ 1 archinnovinfo wheel 164K Jan 7 22:42 antlr-runtime-3.5.2.jar -rw-r--r--@ 1 archinnovinfo wheel 5.1M Jan 7 22:42 apache-cassandra-3.2.jar -rw-r--r--@ 1 archinnovinfo wheel 189K Jan 7 22:42 apache-cassandra-clientutil-3.2.jar -rw-r--r--@ 1 archinnovinfo wheel 1.8M Jan 7 22:42 apache-cassandra-thrift-3.2.jar -rw-r--r--@ 1 archinnovinfo wheel 52K Jan 7 22:42 asm-5.0.4.jar -rw-r--r--@ 1 archinnovinfo wheel 2.2M Jan 7 22:42 cassandra-driver-core-3.0.0-beta1-bb1bce4-SNAPSHOT-shaded.jar -rw-r--r--@ 1 archinnovinfo wheel 224K Jan 7 22:42 cassandra-driver-internal-only-3.0.0-6af642d.zip
I can see there is a asm-5.0.4.jar. After adding the following dependency in Maven, the issue is solved:
<dependency> <groupId>org.ow2.asm</groupId> <artifactId>asm</artifactId> <version>5.0.4</version> </dependency>
What is strange is that this dependency is not mentioned anywhere, neither in the cassandra-all-3.3.pom.xml nor in the build.xml ant file...