java.lang.NoSuchFieldError: REFLECTION
Or it could be just different versions of com.sun.xml.bind:jaxb-core
and com.sun.xml.bind:jaxb-impl
. Ensure they are the same across your dependency:tree
.
I had -core
v.2.2.11 and -impl
v.2.2.6 in my project which led to the same exception. After setting both versions to 2.2.11 via dependencyManagement
section everything became fine.
You have a conflict between the cxf-rt-frontend-jaxws
and cxf-common-utilities
libraries. Both of these provide as their dependencies com.sun.xml.bind
which is the cause of your problem. So you should either exclude com.sun.xml.bind:jaxb-impl
from cxf-common-utilities
or remove your dependency on cxf-common-utilities
.
Got the same error and found out that in my case there was a mismatch of versions of jaxb-api and jaxb-impl. The jaxb-api was included in the pom.xml with provided scope (server jboss) and the application was picking jaxb-impl from other dependency. These both were of different versions as per the stack trace.
Servlet.service() for servlet Spring MVC Servlet threw exception: java.lang.NoSuchFieldError: REFLECTION[0m
[Server:ODIN64_Server01] [31m at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:87) [**jaxb-impl-2.1.7.jar:2.1.7**][0m
.....
[Server:ODIN64_Server01] [31m at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) **[jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3**][0m
So adding jaxb-impl in pom and marking the scope as 'provided' made sure that both has the same version and that fixed the problem.
Exclude dependence after you run mvn dependency:tree
<exclusions>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>