Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a UDF Fails in elassandra though works fine in cassandra #256

Open
masumsoft opened this issue Dec 23, 2018 · 6 comments
Open

Creating a UDF Fails in elassandra though works fine in cassandra #256

masumsoft opened this issue Dec 23, 2018 · 6 comments

Comments

@masumsoft
Copy link

masumsoft commented Dec 23, 2018

Elassandra version: 6.2.3.7

Plugins installed: []

JVM version (java -version): 1.8.0_101

OS version (uname -a if on a Unix-like system): MacOS High Sierra 10.13.6

Description of the problem including expected versus actual behavior:

Trying to create a user defined function in elassandra throws error. It works well in cassandra 3.11.1

Steps to reproduce:

  1. Run elassandra and open cqlsh
  2. Create a new keyspace:
cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
cqlsh> USE test ;
  1. Create a UDF:
cqlsh:test> CREATE OR REPLACE FUNCTION fLog (input double) CALLED ON NULL INPUT RETURNS double LANGUAGE java AS 'return Double.valueOf(Math.log(input.doubleValue()));';

The above command throws the following error:

ServerError: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor

Same steps works well in cassandra 3.11.1

  • elassandra logs (logs/system.logs or /var/lib/cassandra/system.log)
2018-12-23 23:39:03,801 INFO  [Native-Transport-Requests-1] org.apache.cassandra.service.MigrationManager.announceNewKeyspace(MigrationManager.java:331) Create new Keyspace: KeyspaceMetadata{name=test, params=KeyspaceParams{durable_writes=true, replication=ReplicationParams{class=org.apache.cassandra.locator.SimpleStrategy, replication_factor=1}}, tables=[], views=[], functions=[], types=[]}
2018-12-23 23:39:17,195 ERROR [Native-Transport-Requests-1] org.apache.cassandra.transport.Message$UnexpectedChannelExceptionHandler.apply(Message.java:629) Unexpected exception during request; channel = [id: 0xf2793262, L:/127.0.0.1:9042 - R:/127.0.0.1:49276]
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
	at org.apache.cassandra.cql3.functions.JavaBasedUDFunction.<clinit>(JavaBasedUDFunction.java:88)
	at org.apache.cassandra.cql3.functions.UDFunction.create(UDFunction.java:233)
	at org.apache.cassandra.cql3.statements.CreateFunctionStatement.announceMigration(CreateFunctionStatement.java:162)
	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:123)
	at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:224)
	at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:255)
	at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:240)
	at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116)
	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:517)
	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:353)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162)
	at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 18 common frames omitted
{"cluster_name":"Test Cluster","compressed_size_in_bytes":207,"version":4,"state_uuid":"AYhwtDpDSsSF5y_K7t77GA","master_node":"6121f05e-3a68-4dfe-bbb0-07d94a78bbc7","blocks":{},"nodes":{"6121f05e-3a68-4dfe-bbb0-07d94a78bbc7":{"name":"127.0.0.1","status":"ALIVE","ephemeral_id":"6121f05e-3a68-4dfe-bbb0-07d94a78bbc7","transport_address":"127.0.0.1:9300","attributes":{"rack":"rack1","dc":"dc1"}}},"metadata":{"version":0,"cluster_uuid":"6121f05e-3a68-4dfe-bbb0-07d94a78bbc7","templates":{},"indices":{},"index-graveyard":{"tombstones":[]}},"routing_table":{"indices":{}},"routing_nodes":{"unassigned":[],"nodes":{"6121f05e-3a68-4dfe-bbb0-07d94a78bbc7":[]}},"restore":{"snapshots":[]},"snapshot_deletions":{"snapshot_deletions":[]},"snapshots":{"snapshots":[]}}
  • cassandra schema (cqlsh>DESC KEYSPACE <your_keyspace>)
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
  • cassandra gossip state (run: nodetool gossipinfo)
localhost/127.0.0.1
  generation:1545586686
  heartbeat:416
  STATUS:16:NORMAL,-1134036937311619061
  LOAD:398:205932.0
  SCHEMA:83:f03e3797-9002-3ec3-ad6d-c884ffd83650
  DC:8:dc1
  RACK:10:rack1
  RELEASE_VERSION:4:3.11.3
  INTERNAL_IP:6:127.0.0.1
  RPC_ADDRESS:3:127.0.0.1
  NET_VERSION:1:11
  HOST_ID:2:6121f05e-3a68-4dfe-bbb0-07d94a78bbc7
  RPC_READY:18:true
  X1:20:{}
  X2:22:6121f05e-3a68-4dfe-bbb0-07d94a78bbc7/0
  TOKENS:15:<hidden>

Note that I've changed the following cassandra.yaml settings to enable UDFs:

enable_user_defined_functions: true
@vroyer
Copy link
Collaborator

vroyer commented Jan 10, 2019

Yes, it's a known issue dealing with class loading.
Both C* and ES use asm.jar to execute functions or scripts in a dedicated classloader, and the first who load the jar win, the second fails ! This still need some investigation, i keep the point.
Thanks.

@joffredlp
Copy link

joffredlp commented Aug 14, 2019

i'm getting the same. any fix update on this ?
i'm running on the latest docker version of elassandra version: strapdata/elassandra:latest
ELASSANDRA_VERSION=6.2.3.18

java.lang.NoClassDefFoundError: Could not initialize class org.apache.cassandra.cql3.functions.JavaBasedUDFunction
at org.apache.cassandra.cql3.functions.UDFunction.create(UDFunction.java:233)
at org.apache.cassandra.cql3.statements.CreateFunctionStatement.announceMigration(CreateFunctionStatement.java:162)
at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:123)
at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:225)
at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:256)
at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:241)
at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116)
at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:566)
at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:353)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162)
at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:114)
at java.lang.Thread.run(Thread.java:748)

@yunfongloh
Copy link

Is this possibly a
Duplicate of #165?

@comdiv
Copy link

comdiv commented Oct 15, 2019

Hello is where something about this problem. We use Elassandra and has some requirements for using UDFs but cannot do anything with them

@filthz
Copy link

filthz commented Apr 17, 2020

Any updates on this? We are affected as well

@filthz
Copy link

filthz commented Oct 22, 2020

Are there any updates on this issue? Has this been fixed in the more recent versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants