Thank you very much! I am able to use the library now after adding it to the 
whitelist.

Brian

From: Ben Slater <ben.sla...@instaclustr.com<mailto:ben.sla...@instaclustr.com>>
Reply-To: "user@cassandra.apache.org<mailto:user@cassandra.apache.org>" 
<user@cassandra.apache.org<mailto:user@cassandra.apache.org>>
Date: Tuesday, June 7, 2016 at 4:30 PM
To: "user@cassandra.apache.org<mailto:user@cassandra.apache.org>" 
<user@cassandra.apache.org<mailto:user@cassandra.apache.org>>
Subject: Re: Unable to use native library in C* trigger

My guess would be it’s due to the UDF sandbox whitelist/blacklist 
(https://github.com/apache/cassandra/blob/5288d434b3b559c7006fa001a2dc56f4f4b2e2c3/src/java/org/apache/cassandra/cql3/functions/UDFunction.java).

As far as I’m aware there is no way current of avoiding this (other than 
recompiling C* with a new whitelist I guess). There is a JIRA for non-sandboxed 
UDFs: https://issues.apache.org/jira/browse/CASSANDRA-9892

Cheers
Ben

On Wed, 8 Jun 2016 at 01:07 Brian Kelly 
<brianke...@sgi.com<mailto:brianke...@sgi.com>> wrote:
Hi, all,

I am attempting write a trigger that depends on a native library. The library 
is successfully loaded by the JVM (so the java.library.path should not be the 
issue - I just have the jnilib in lib/sigar-bin for now) but any call to its 
methods result in a java.lang.UnsatisfiedLinkError. This only happens in the 
Cassandra trigger; a standalone Java program has no issues using the library. 
Does anybody have an idea what may be causing this? Here is the output when the 
trigger fires:

cqlsh>  INSERT INTO test.test (key, value) values ('1', '1');
ServerError: <ErrorMessage code=0000 [Server error] 
message="java.lang.UnsatisfiedLinkError: 
org.apache.cassandra.triggers.AuditTrigger.callSomeNativeMethod()Ljava/lang/String;">

And the debug.log:

ERROR [SharedPool-Worker-1] 2016-06-07 10:03:42,870 Message.java:611 - 
Unexpected exception during request; channel = [id: 0x3a5b79c3, 
L:/127.0.0.1:9042<http://127.0.0.1:9042> - 
R:/127.0.0.1:53097<http://127.0.0.1:53097>]
java.lang.UnsatisfiedLinkError: 
org.apache.cassandra.triggers.AuditTrigger.callSomeNativeMethod()Ljava/lang/String;
        at 
org.apache.cassandra.triggers.AuditTrigger.callSomeNativeMethod(Native Method) 
~[na:na]
        at 
org.apache.cassandra.triggers.AuditTrigger.augment(AuditTrigger.java:44) 
~[na:na]
        at 
org.apache.cassandra.triggers.TriggerExecutor.executeInternal(TriggerExecutor.java:229)
 ~[main/:na]
        at 
org.apache.cassandra.triggers.TriggerExecutor.execute(TriggerExecutor.java:119) 
~[main/:na]
        at 
org.apache.cassandra.service.StorageProxy.mutateWithTriggers(StorageProxy.java:819)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:431)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:417)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:188)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:219) 
~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:204) 
~[main/:na]
        at 
org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:115)
 ~[main/:na]
        at 
org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:507)
 [main/:na]
        at 
org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:401)
 [main/:na]
        at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
 [netty-all-4.0.36.Final.jar:4.0.36.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
 [netty-all-4.0.36.Final.jar:4.0.36.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)
 [netty-all-4.0.36.Final.jar:4.0.36.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:283)
 [netty-all-4.0.36.Final.jar:4.0.36.Final]
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
[na:1.8.0_25]
        at 
org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:164)
 [main/:na]
        at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:106) 
[main/:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]

I am just running one, local node.

Thanks,
Brian
--
————————
Ben Slater
Chief Product Officer, Instaclustr
+61 437 929 798

Reply via email to