Camel in Action 2 - InvocationTargetException

39 views Asked by At

I am trying to run the Camel in Action 2 examples from Chapter 2 - Spring folder ...the Camel-3.20 Branch of the repo. ( Camel in Action 2 - Chapter 2 - Spring )

My Java settings are : openjdk version "18.0.2" 2022-07-19 OpenJDK Runtime Environment (build 18.0.2+9-61) OpenJDK 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing)

My Maven settings are : Maven home: D:\Installed_Apps\Maven\apache-maven-3.8.4 Java version: 18.0.2, vendor: Oracle Corporation, runtime: D:\Installed_Apps\Open_JDK_18 Default locale: en_US, platform encoding: UTF-8 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

When I run from the command line I see error :

java.lang.ClassNotFoundException: org.apache.camel.spring.Main

I then adjusted the pom file to include :

       <plugin>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-maven-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-spring</artifactId>
                    <version>2.25.3</version>
                </dependency>
            </dependencies>
        </plugin>

When I run this version from the command line I see error :

java.lang.reflect.InvocationTargetException

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [META-INF/spring/*.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/spring/] cannot be resolved to URL because it does not exist

Caused by: java.io.FileNotFoundException: class path resource [META-INF/spring/] cannot be resolved to URL because it does not exist

Anyone have thoughts on how to correct this ? these are the existing sample projects without any changes.

1

There are 1 answers

0
Claus Ibsen On

Camel 3 does not support Java 18. It only supports Java 11 (Java 8 if you use Java 3.14 or older).

So you would need to install JDK 11 and use that with this example.