Reputation: 15769
when using jersey moxy
<!-- Jersey moxy -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-moxy</artifactId>
<version>1.18.3</version>
<scope>provided</scope>
</dependency>
together with eclipse link 2.6.0-M3
<!-- Eclipse Link persistence -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<!-- <version>2.4.2-RC1</version> -->
<!-- <version>2.5.1-RC3</version> -->
<!-- <version>2.5.1</version> -->
<!-- <version>2.5.2-M1</version> -->
<!-- <version>2.5.2</version> -->
<version>2.6.0-M3</version>
<exclusions>
<exclusion>
<artifactId>commonj.sdo</artifactId>
<groupId>commonj.sdo</groupId>
</exclusion>
</exclusions>
</dependency>
i get
java.lang.NoClassDefFoundError: javax/validation/ConstraintViolationException
at org.eclipse.persistence.jaxb.JAXBMarshaller.<init>(JAXBMarshaller.java:102)
at org.eclipse.persistence.jaxb.JAXBContext$JAXBContextState.createMarshaller(JAXBContext.java:1527)
at org.eclipse.persistence.jaxb.JAXBContext.createMarshaller(JAXBContext.java:385)
at org.eclipse.persistence.jaxb.JAXBContext.createMarshaller(JAXBContext.java:1)
i tried to work-around the issue by changing the order in my pom.xml and that works in some of my projects. In a nested environment where some projects depend on another the issue showed up again.
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg08372.html suggest that a dependeny might be missing so I added:
<!--
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg08372.html
http://mvnrepository.com/artifact/javax.validation/validation-api/1.1.0.Final
-->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
right where the eclipselink dependency shows up. This seems also to help.
Is this really a bug? What would be a "proper" way to solve this issue?
Unfortunately there is no option for me to upgrade Jersey to 2.x since there are too many incompatibilities and (as I hear) bugs.
Upvotes: 0
Views: 413
Reputation: 391
The proper way to solve this issue is to add javax.validation:validation-api dependency.
Bean validation is new feature in EclipseLink 2.6.0 as stated in Design Doc https://bugs.eclipse.org/bugs/attachment.cgi?id=241506
The result is, that there is now required dependency.
I have filed new enhancement request against EclipseLink to make this dependency optional.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=460330
Upvotes: 2