0

I'm trying to configure and test the Riak for Grails plugin. I've removed the hibernate plugin by removing it's dependency in BuildConfig. Note: I'm not attempting to use this against GORM - but merely querying using the spring data support.

I've had to add the following two lines to avoid errors at runtime after removing hibernate;

springConfig.addAlias "persistenceInterceptor", "riakPersistenceInterceptor"
springConfig.addAlias('transactionManager', 'riakTransactionManager')

The project compiles fine, and runs. However - as soon as I attempt to use any of the Riak methods I usually end up with a 404 - Object not found error, or something more elusive.

Documentation suggests I can use an autowired service;

import org.springframework.data.keyvalue.riak.core.RiakTemplate

class myClass {

    // Service injection
    def riakTemplate

    def myMethod() {
        riakTemplate.set("myBucket", "myKey", "A String")
    }

}

But this doesn't work. I've tried;

RiakTemplate riakTemplate = new riakTemplate("serviceurl", "mapredurl")
riakTemplate.set("myBucket", "myKey", "A String")

I'm running out of ideas. Is there a guide or something helpful to get this working?

Its worth noting I have Riak running on my localhost, and I can manage keys using Curl easily enough. So I don't think it's a Riak issue.

I'm possibly missing something obvious. :)

I'm running Grails 2.1.0.

Thank you!

Cadriel
  • 735
  • 1
  • 5
  • 6
  • It appears that if I manually create a key (using curl) under the bucket name i'm trying to access via code - things start working. So it appears that if you use riakTemplate to create a key under a NEW bucket things fail. If its using an existing bucket - it works okay. – Cadriel Aug 07 '12 at 02:02
  • Flag that. None of the set methods appear to work, they all error with a 404. However - if you use the put method (i.e., they generate a key for you) they appear to work. Also - if you run the 'containsKey' method for example, that always errors with a 404 on keys that don't exist - but work as intended on keys that DO exist. – Cadriel Aug 07 '12 at 02:14

2 Answers2

0

I know this does not 'answer the question,' but for a current project we decided to abandon the plugin, because of similar problems, in favor of using Spring Rest directly in service classes. I think this approach would work well for you, too, since you mention at the top that you are not trying to use the plugin's GORM support.

You should find a direct Spring Rest approach fairly easy to implement with greater control over map reduce and leveraging 2i. I would also recommend starting with a Riak interface that attempts to follow Basho's own Java client so that you might find it easier to replace your Rest implementation with Basho's PBC implementation sometime in the future if you feel you need the performance advantages.

A particular note about the Riak plugin: it seems to have gone on indefinite hold a while ago, and the lead, Jonathan Brisbin, seems to be particularly focused on the new Spring Data - REST project lately - maybe new work on the Riak plugin will 'spring' out of this?

-Todd

Todd
  • 31
  • 2
0

I was hit with this issue as well and found it is due to the fact that the default configuration is to use the DefaultErrorHandler in the underlying RestTemplate.

To have the RiakTemplate not fail on 404s you can set the property 'ignoreNotFound' to true and it will work again.

T J Zeeman
  • 46
  • 1
  • 4