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

support for cassandra 2.0 #70

Closed
knight1128 opened this issue Nov 5, 2013 · 15 comments
Closed

support for cassandra 2.0 #70

knight1128 opened this issue Nov 5, 2013 · 15 comments
Assignees
Milestone

Comments

@knight1128
Copy link

@knight1128 knight1128 commented Nov 5, 2013

Hi

I tried to use cassandra 2.0 lib, failed.
IllegalAccessError occured, Can you fix this?

java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/concurrent/ConcurrentMap; from class org.apache.cassandra.service.StorageProxy
at org.apache.cassandra.service.StorageProxy.(StorageProxy.java:84)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at org.apache.cassandra.service.StorageService.initServer(StorageService.java:432)
at org.apache.cassandra.service.StorageService.initServer(StorageService.java:411)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:278)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:366)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper$1.run(EmbeddedCassandraServerHelper.java:102)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

my pom.xml is below.

    <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-thrift</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.cassandraunit</groupId>
        <artifactId>cassandra-unit-spring</artifactId>
        <version>1.2.0.1</version>
    </dependency>
@knight1128
Copy link
Author

@knight1128 knight1128 commented Nov 5, 2013

As you know that, com.google.common.collect.MapMaker.makeComputingMap() method deprecated and accessor is friend. And below is javadoc.

  • @deprecated Caching functionality in {@code MapMaker} has been moved to
  • {@link com.google.common.cache.CacheBuilder}, with {@link #makeComputingMap} being replaced
    
  • by {@link com.google.common.cache.CacheBuilder#build}. See the
    
  • <a href="http://code.google.com/p/guava-libraries/wiki/MapMakerMigration">MapMaker
    
  • Migration Guide</a> for more details.
    
@ghost ghost assigned jsevellec Nov 5, 2013
@jsevellec
Copy link
Owner

@jsevellec jsevellec commented Nov 6, 2013

thanks for reporting that. I'm working on it

@jsevellec
Copy link
Owner

@jsevellec jsevellec commented Nov 14, 2013

I just pushed a first snapshot integrating the support of Cassandra 2

while waiting for the next release, snapshot is already available with the fix (2.0.2.0-SNAPSHOT : https://oss.sonatype.org/content/repositories/snapshots/)

@gibffe
Copy link

@gibffe gibffe commented Nov 14, 2013

I am having some issues with 2.0.2.0-SNAPSHOT , just tried using the snapshot you kindly published.

The issue at hand - I can't get CQL data loader to work. My code looks as follows

 EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra.yaml");
 CQLDataLoader loader = new CQLDataLoader("127.0.0.1", 9160);
 loader.load(new ClassPathCQLDataSet("data.cql"));

Cassy starts just fine, but creating new loader fails. After starting the server I get the usual

...
[pool-1-thread-1] INFO org.apache.cassandra.thrift.THsHaDisruptorServer - Starting up org.apache.cassandra.thrift.THsHaDisruptorServer@50d3608
[pool-1-thread-1] INFO org.apache.cassandra.thrift.TServerCustomFactory - Using custom half-sync/half-async thrift server on localhost : 9160
[Thread-2] INFO org.apache.cassandra.thrift.ThriftServer - Listening for thrift clients...

And then, when trying to load CQL data file

[Thrift-Selector_3] ERROR com.thinkaurelius.thrift.Message - Invalid frame size got (33554433), maximum expected 15728640

Any clue what might be causing this ?

@jsevellec
Copy link
Owner

@jsevellec jsevellec commented Nov 14, 2013

the CQL loader is based on the java driver which is not using the thrift protocol so i guess the problem is coming from somewhere else.

I don't know where com.thinkaurelius.thrift.Message class is coming from because it's not part of cassandra as well.

I updated the https://github.com/jsevellec/cassandra-unit-examples project and tried to reproduce your issue but without success.

Are you able to push a simple project repoducing the problem?

Regards,

@gibffe
Copy link

@gibffe gibffe commented Nov 14, 2013

this should be the smallest version that errors out, https://github.com/gibffe/cassyunit-2.0-test

@jsevellec
Copy link
Owner

@jsevellec jsevellec commented Nov 14, 2013

you're using a bad port. In your cassandra.yaml, the native protocol is using : native_transport_port: 9042

In your SimpleClientTest, just replace 9141 to 9042.

@gibffe
Copy link

@gibffe gibffe commented Nov 15, 2013

doh, that did it, ty ;)

@moulliet
Copy link

@moulliet moulliet commented Nov 26, 2013

Thanks for doing the work to upgrade to Cassandra 2 :)

In using 2.0.2.0-SNAPSHOT, I get two errors:

ERROR 2013-11-26 10:34:18,214 [Native-Transport-Requests:4] org.apache.cassandra.transport.messages.ErrorMessage [line 222] - Unexpected exception during request
java.lang.NoSuchMethodError: org.jboss.netty.channel.Channel.getAttachment()Ljava/lang/Object;
at org.apache.cassandra.transport.Frame$Decoder.decode(Frame.java:178) ~[cassandra-all-2.0.2.jar:2.0.2]

I got around this by excluding org.jboss.netty which allows Cassandra to use io.netty:netty

The other issue is with jamm's MemoryMeter:

java.lang.IllegalStateException: Instrumentation is not set; Jamm must be set as -javaagent
at org.github.jamm.MemoryMeter.measure(MemoryMeter.java:70) ~[jamm-0.2.5.jar:na]
at org.github.jamm.MemoryMeter.measureDeep(MemoryMeter.java:102) ~[jamm-0.2.5.jar:na]
at org.apache.cassandra.cql3.QueryProcessor.storePreparedStatement(QueryProcessor.java:224) ~[cassandra-all-2.0.2.jar:2.0.2]
at org.apache.cassandra.cql3.QueryProcessor.prepare(QueryProcessor.java:212) ~[cassandra-all-2.0.2.jar:2.0.2]

I set up jamm as a javaagent, which does resolve the issue. Would be great to not have to do that. Not sure how that could be done, as the requirement is in Cassandra.

@jsevellec
Copy link
Owner

@jsevellec jsevellec commented Nov 26, 2013

It sounds like a classpath problem but it´s just my first feeling. Are you able to push a simple project where i can reproduce this problem?

@moulliet
Copy link

@moulliet moulliet commented Nov 26, 2013

I tired to recreate the issue, and I think you're right. IntelliJ must have been caching the older version of netty.

Any thoughts on how to get around the -javaagent requirement? After poking around a bit, I don't know of any simple way w/o modifying jamm to allow starting the agent after the VM starts.

@moulliet
Copy link

@moulliet moulliet commented Nov 26, 2013

For my purposes, just running Cassandra for integration tests, I can hack MemoryMeter using Mockito:

Instrumentation instrumentation = mock(Instrumentation.class);
when(instrumentation.getObjectSize(any())).thenReturn(1000L);
MemoryMeter.premain("", instrumentation);

@jsevellec
Copy link
Owner

@jsevellec jsevellec commented Nov 27, 2013

So i understand well, no remaining issue on the cassandra-unit side?

@moulliet
Copy link

@moulliet moulliet commented Nov 28, 2013

correct. thank you :)

@jsevellec jsevellec closed this Nov 29, 2013
@amichair
Copy link

@amichair amichair commented Mar 24, 2014

I Just upgraded to 2.0.2.0 (and Cassandra 2.0.6) and hit the same NoSuchMethodError that was reported above. From what I can tell, cassandra-unit's pom points to org.jboss.netty:netty:3.2.9.Final, in which the org.jboss.netty.channel.Channel class indeed doesn't have a getAttachment method.

I suspect you may have had a newer Netty version pulled in by some other dependency, so it worked for you by chance. My workaround was to add io.netty:netty:3.7.0.Final (which itself is not the latest version, but was used elsewhere in my project) explicitly as the first dependency in my project's pom, so that it'll be first on the classpath. I haven't tested anything beyond that yet, but at least the NoSuchMethodError is fixed.

I would suggest to reopen this issue until cassandra-unit upgrades to a more recent version of netty where the missing method exists.

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

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.