I am working on a jetty service, and when starting it, I get a lot of:
SomeClass scanned from multiple locations: jar: jar1!Someclass.class, jar2!Someclass.class
So a single class is provided by two jars, and which I get on runtime is undefined, which is not good. Looking at other issues I found that tattletale can help diagnosing the problem. The report, in the Multiple Jar files section lists the same classes as jetty upon startup and which jars they were in. A subset of the conflicts are:
And looking at
mvn dependency:tree -D verbose
I get:
+- ca.uhn.hapi.fhir:hapi-fhir-jpaserver-base:jar:3.7.0:compile
| | ...
| +- org.jscience:jscience:jar:4.3.1:compile
| | \- org.javolution:javolution:jar:5.2.3:compile
And so it seems that my fhir-base-jpaserver-base dependency pulls jscience that pulls javolution. But jscience and javolution supply some of the same classes. No other dependency to javolution exists.
My question is then, how do I go about solving this?
I could do some stuff in pom.xml but I suppose jscience needs javolution, and might break?
Sounds like a bug in
jscience
with how they packaged their jar, might want to file an issue with them.They should either ...
Not mixing the two concepts.
Meanwhile, just use the
<dependency>/<exclusions>
to exclude specific transitive dependencies that are causing you duplicate classes.Also, you might want to run any of the various duplicate class/resource checker maven plugins to find any other cases you might have present on your project.