Uthaman
Uthaman

Reputation: 25

Groovy @Grab generating java.lang.NoClassDefFoundError

I am attempting to get Jsoup to work on my Google App Engine experiment project with Gaelyk. I work with Grails at my day job, so figured it would be a piece of cake to start playing with Gaelyk... Not so fast...

The error happens when I include:

@Grab('org.jsoup:jsoup:1.9.2')

Project builds. But, accessing the page where I am doing the HTML scraping I get this error:

HTTP ERROR 500

Problem accessing /.

Reason: org/apache/ivy/core/report/ResolveReport
Caused by: java.lang.NoClassDefFoundError:   org/apache/ivy/core/report/ResolveReport 
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.report.ResolveReport
Caused by: java.lang.ClassNotFoundExeption:  org.apache.ivy.core.report.ResolveReport

Not having much luck updating the build.gradle file I use with Glide to build the project.... Any ideas would be MOST appreciated!

Upvotes: 2

Views: 1424

Answers (1)

kdabir
kdabir

Reputation: 9868

As you mentioned you are using glide, put this in your build.gradle file:

plugins {
    id "com.appspot.glide-gae" version "0.9.3"
}

dependencies {
    compile "org.jsoup:jsoup:1.9.2" 
}

In your Groovlet, all you need is:

import org.jsoup.*

def doc = Jsoup.connect("http://<your-url-here>").get()

And you are back in business

Update: I have added a sample Scraper in glide-samples

Upvotes: 1

Related Questions