0

When run my application through mvn compile exec:java it says:

[main] DefaultTypeConverter           INFO  Loaded 199 type converters 

When run through java -jar (uberjar made with maven-shade-plugin) it says:

[main] DefaultTypeConverter           INFO  Loaded 182 type converters

Check the difference (199 over 182). As the result my code does not work as expected in some cases.

Using camel 2.16.1. If full list of dependencies needed, let me know, I'll put with update.

UPDATE 1 Solved by adding

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/services/org/apache/camel/TypeConverter</resource>
</transformer>

to my maven-shade-plugin configuration.

raulk
  • 2,809
  • 15
  • 32
Archer
  • 5,073
  • 8
  • 50
  • 96
  • Type Converters are discovered via the [Service Loader](https://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html) mechanism. Could you please post the configuration of the `maven-shade-plugin` and the output of `mvn dependency:tree` so I can analyse? My suspicion is that some Camel dependency is not being packaged, e.g. `runtime` or `provided` dependencies. – raulk Jan 14 '16 at 17:03
  • See this FAQ: http://camel.apache.org/how-do-i-use-a-big-uber-jar.html – Claus Ibsen Jan 14 '16 at 17:14

1 Answers1

0

Solved by adding

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/services/org/apache/camel/TypeConverter</resource>
</transformer>

to my maven-shade-plugin configuration.

More details here: How to package an Apache CXF application into a monolithic JAR with the Maven "shade" plugin

Community
  • 1
  • 1
Archer
  • 5,073
  • 8
  • 50
  • 96