Groovy JsonBuilder throws NoClassDefFoundError when using camel-groovy component

Solution Verified - Updated -

Issue

Getting NoClassDefFoundError While working with JsonBuilder.toString() in Groovy code inside a Camel route, which runs inside Jboss Fuse 7 running on top of EAP 7.

The code looks like so:

def builder = new JsonBuilder()
builder {
'myField': myFieldVal
}
return builder.toString()

The builder.toString() method invocation produces the following error:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class 
groovy.json.internal.FastStringUtils

Environment

  • RedHat JBoss Fuse
    • 6.x
  • RedHat JBoss EAP

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content