To be clear, Cassandra triggers require that you be a skilled and confident Java developer. If you aren't fluent in Java and the Java development process, triggers are not a great place to start learning Java.

That said, maybe the doc does need to be a little more clear about some of the specifics.

-- Jack Krupansky

-----Original Message----- From: Michael Dykman
Sent: Monday, July 28, 2014 10:35 AM
To: Cassandra Users
Subject: Re: Cassandra trigger following the CQL for Cassandra 2.0 tutorial does not work

How to compile is a much biggest question and probably way off topic
for this list.   I think you need a starter tutorial on building and
packaing java; there is more than one concept at work.

you will need a compiler of the appropriate version. that source has
external dependancies declared in the imports from these packages:
org.apache.cassandra.io
org.apache.cassandra.db
org.slf4j

The rest of the import are internal to Java's standard library.

I think you need to master the art of building and running a jar
before you can reasonably hope to be playing with cassandra triggers.


On Mon, Jul 28, 2014 at 10:15 AM, Martin Marinov
<martin.mari...@securax.org> wrote:
I'm not compiling it.
I just download it from:

https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob_plain;f=examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java;hb=HEAD

Save the downloaded file into a .class file and jar it.

How do I compile it ?


On 07/28/2014 05:11 PM, Michael Dykman wrote:

This is not really a Cassandra problem: it's a basic Java packaging
problem.

First of all, the java source file is not what the runtime needs to
see in your jar; it needs the class file which was generated by
compiling it.  That compiled class needs to be in a folder
corresponding to it's package, which I infer is
'org.apache.cassandra.triggers' from your earlier jar creation command
(obviously not the command you used to create the jar you just showed
us the dump of):
       jar cvf
/etc/cassandra/triggers/org.apache.cassandra.triggers.InvertedIndex.jar
org.apache.cassandra.triggers.InvertedIndex.class

The META-INF looks fine, but that class should be listed as

org/apache/cassandfra/triggers/InvertedIndex.class

When you compile the source, does the compiler NOT put the binary in
an appropriate folder?


On Mon, Jul 28, 2014 at 9:04 AM, Martin Marinov
<martin.mari...@securax.org> wrote:

Correction.
It's:

unzip -l /etc/cassandra/triggers/InvertedIndex.jar
Archive:  /etc/cassandra/triggers/InvertedIndex.jar
   Length      Date    Time    Name
---------  ---------- -----   ----
         0  2014-07-25 10:07   META-INF/
        68  2014-07-25 10:07   META-INF/MANIFEST.MF
      2761  2014-07-25 10:07   InvertedIndex.java
---------                     -------
      2829                     3 files




On 07/28/2014 04:02 PM, Martin Marinov wrote:

The output is:

unzip /etc/cassandra/triggers/InvertedIndex.jar
Archive:  /etc/cassandra/triggers/InvertedIndex.jar
    creating: META-INF/
   inflating: META-INF/MANIFEST.MF
   inflating: InvertedIndex.java


On 07/28/2014 03:54 PM, Michael Dykman wrote:

I wonder; your jar creation looks a little off and I suspect your problem
might be the jar format which would lead to the failure to load.  Could
you
list the output of
$ unzip -l my.jar?

On Jul 28, 2014 3:49 AM, "Martin Marinov" <martin.mari...@securax.org>
wrote:

I did:
ls /etc/cassandra/triggers/
InvertedIndex.jar  README.txt


But I'm not sure I'm creating the jar correctly.

I'm running:
jar cvf
/etc/cassandra/triggers/org.apache.cassandra.triggers.InvertedIndex.jar
org.apache.cassandra.triggers.InvertedIndex.class

where org.apache.cassandra.triggers.InvertedIndex.class contains the
java
code on this url:


https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob_plain;f=examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java;hb=HEAD

Also I tried with the name of the .class file and the .jar file as:
InvertedIndex.jar, InvertedIndex.class
and as
org.apache.cassandra.triggers.InvertedIndex.jar,
org.apache.cassandra.triggers.InvertedIndex.class


On 07/28/2014 10:43 AM, DuyHai Doan wrote:

Did you put the jar into the /lib folder on the server ? I know it's a
basic question but it's the first idea to come in mind


On Mon, Jul 28, 2014 at 9:36 AM, Martin Marinov
<martin.mari...@securax.org> wrote:

Anybody got an idea on this matter ?


On 07/24/2014 06:34 PM, Martin Marinov wrote:

Hi,

I posted the question on stackoverflow:


http://stackoverflow.com/questions/24937425/cassandra-trigger-following-the-cql-for-cassandra-2-0-tutorial-does-not-work

On 07/24/2014 06:25 PM, Martin Marinov wrote:

Hi,

I'm following the tutorial at:

http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/trigger_r.html

I'm using Cassandra 2.0.9 with Oracle Java (java version "1.7.0_60").

I have downloaded the example Java Class from

https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob_plain;f=examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java;hb=HEAD
into a file named org.apache.cassandra.triggers.InvertedIndex.jar .

I then created a jar using:

jar cvf
/etc/cassandra/triggers/org.apache.cassandra.triggers.InvertedIndex.jar
org.apache.cassandra.triggers.InvertedIndex.class

I restarted the cassandra service.

The trigger does not exist:

cqlsh:mykeyspace> CREATE TRIGGER myTrigger ON myTable USING
'org.apache.cassandra.triggers.InvertedIndex';
Bad Request: Trigger class
'org.apache.cassandra.triggers.InvertedIndex'
doesn't exist

What am I doing wrong ?


--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited.  If you have received this email in error, please notify
the
sender immediately and permanently delete the email and files, if any.



--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited.  If you have received this email in error, please notify
the
sender immediately and permanently delete the email and files, if any.



--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited.  If you have received this email in error, please notify
the
sender immediately and permanently delete the email and files, if any.




--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited. If you have received this email in error, please notify the
sender immediately and permanently delete the email and files, if any.



--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited.  If you have received this email in error, please notify the
sender immediately and permanently delete the email and files, if any.



--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited.  If you have received this email in error, please notify the
sender immediately and permanently delete the email and files, if any.





--
Best Regards,

Martin Marinov
Securax LTD

NOTICE:  This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed.  If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited.  If you have received this email in error, please notify the
sender immediately and permanently delete the email and files, if any.




--
- michael dykman
- mdyk...@gmail.com

May the Source be with you.

Reply via email to