I am experiencing the same issue as this one.
I copied the code snippet provided by @baz and am able to run it without problems with mvn compile exec:java
or from Eclipse but when building the uber jar with Maven shade I am getting
Exception in thread "main" java.lang.IllegalArgumentException: cannot write time value xcontent for unknown value of type class java.util.Date
at org.elasticsearch.common.xcontent.XContentBuilder.timeValue(XContentBuilder.java:751)
at org.elasticsearch.common.xcontent.XContentBuilder.timeField(XContentBuilder.java:719)
at Snippet.main(Snippet.java:21)
The shade plugin is configured as follows
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.apache.storm.flux.Flux</mainClass>
<manifestEntries>
<Change></Change>
<Build-Date></Build-Date>
<Implementation-Version>1.15.0</Implementation-Version>
</manifestEntries>
</transformer>
</transformers>
<relocations>
<relocation>
<pattern>org.apache.http</pattern>
<shadedPattern>hidden.org.apache.http</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.logging</pattern>
<shadedPattern>hidden.org.apache.logging</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.codec</pattern>
<shadedPattern>hidden.org.apache.commons.codec</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.logging</pattern>
<shadedPattern>hidden.org.apache.commons.logging</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Thanks