Hello John.

Indeed, I've checked two hours ago the groovy bundle jar, and its package groovy.xml, only contains one class (QName). That explains my error. I also checked that my old camel feature (in Fuse) includes groovy-all instead of the smaller groovy.

I suppose I can add groovy-xml (or groovy-all) as a supplementary bundle in one of our common karaf features, but I'm not sure it's going to work over the bundle that comes from the camel-groovy feature (two bundles exporting the same package groovy.xml). Any idea ?

This also requires I manage the groovy version to match the camel-groovy that comes with a given Camel version...

Another way to ensure all the groovy code comes from Camel features only ?

I'm going to test that, and I'll give you feedback.

Thanks a lot for your answer.

Regards.



Ephemeris Lappis

Le 13/11/2023 à 19:15, John Taylor a écrit :
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.


--
Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
www.avast.com

Reply via email to