Edwin
Edwin

Reputation: 440

Camel in Action published by Manning

I'm learning Camel by the book of Claus Ibsen and I would like to have your advise on this.

I have got the book and the code from the side.

In chapter1 it says run:

C:\camelinaction-master\chapter1\file-copy>mvn compile exec:java -Dexec.mainClass=camelinaction.FileCopierWithCamel

The error it produces is:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default-cli) on project chapter1-file-copy: An exception occured while executing the Java class. null: InvocationTargetException: javax/xml/bind/annotation/XmlRootElement: javax.xml.bind.annotation.XmlRootElement -> [Help 1]

I'using java 15.01 and mavem 3.3.5

Since I got this issue at the very beginning of the book I thought before I start debugging the issue perhaps it is good to ask if the code from the book is still working or is it to old and not maintained? If that is not the case it is worth solving the issue otherwise is there newer learning material that you have used and good experience with?

Upvotes: 0

Views: 209

Answers (3)

Edwin
Edwin

Reputation: 440

Thank you Claus Ibsen.

With the link to the new source files I'm able to continue my study.

https://github.com/camelinaction/camelinaction2/tree/camel37

Upvotes: 0

Tadayoshi Sato
Tadayoshi Sato

Reputation: 1746

UPDATE: As Claus (one of the authors of the book) pointed out, there are branches for Camel 3.x versions in the book source code repository:
https://github.com/camelinaction/camelinaction2/tree/camel37

3.x supports Java LTS versions: 8, 11, or 14, but does not officially support the non LTS Java versions.


As Kristof advised, short answer is use Java 8.

In addition to that, the Camel in Action book (2nd ed.) uses Camel 2.x and it supports only Java 8 so otherwise the sample code doesn't work.

If you really want to use later Java versions (11 and higher) you should use Camel 3.x (the latest version as of now is 3.7.1). Since it's a major upgrade you'd need to go through some migration work in order to make the sample code run with Camel 3.x. See the following official migration/upgrade guides for what to do:
https://camel.apache.org/manual/latest/camel-3-migration-guide.html
https://camel.apache.org/manual/latest/camel-3x-upgrade-guide.html

Upvotes: 0

Kristof Neirynck
Kristof Neirynck

Reputation: 4162

The JAXB APIs are considered to be Java EE APIs and therefore are no longer contained on the default classpath in Java SE 9. In Java 11, they are completely removed from the JDK. (Quote from Java: How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException )

Try using Java 8.

Upvotes: 1

Related Questions