Hi,
I also use camel in karaf with groovy.

Although it shows in the exports, groovy xml is not included in the groovy
package from org.codehaus.groovy/groovy/3.0.8 but is in a different bundle
so you have to add it.

You can do that with
install mvn:org.codehaus.groovy/groovy-xml/3.0.8
Or you can include it in your own feature.

-John



On Mon, Nov 13, 2023 at 10:47 AM Ephemeris Lappis <
ephemeris.lap...@gmail.com> wrote:

> Hello.
>
> I'm migrating camel projects from old Camel 2.x to Camel 3.21.
>
> Camel routes are deployed as OSGi blueprints to be executed in Karaf.
>
> I have a strange exception I had not before about some Groovy classes
> that are not found while the groovy scripts seem to be executed.
>
> My bundle manifest declares a dynamic import for groovy scripting (and
> quartz) :
>
> DynamicImport-Package =
>         groovy.*,
>         org.codehaus.groovy.*,
>         org.apache.camel.pollconsumer.*
>
> But classes in package groovy.xml are not resolved as expected.
> Statements like this :
>
> <setProperty name="myAliceXML">
> <groovy>new
> groovy.xml.XmlParser().parse(request.getBody(File.class))</groovy>
> </setProperty>
>
> Fails with the following error :
>
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> Script_bb14d11f44acc4f9bf59e5db81b864e4.groovy: 3: unable to resolve
> class groovy.xml.XmlParser
>
> When I check exports and imports, all seems to be ok :
>
> admin@root()> exports | grep groovy.xml
> groovy.xml
>                           │ 3.0.8             │ 883 │ groovy
>
> admin@root()> imports | grep groovy | grep 975
> groovy.*
>                           (0x                  │            │ 975 │
> caterpillar-switch
> org.codehaus.groovy.*
>                           (0x                  │            │ 975 │
> caterpillar-switch
>
> What has changed in groovy scripting that could be the cause of these
> errors ? It seems the script classloader doesn't include the dynamic
> import.
>
> Thanks for your help.
>
> Regards.
>

Reply via email to