I'm trying to use EclipseLink MOXy as JAXB provider for JAX-WS web-service deployed on JBoss EAP 6.1.0.Beta1 application server. For now I've implemented javax.xml.ws.Provider as described here and placed jaxb.properties file into packages containing my Provider implementation and domain classes used in the web-service. Here is a content of this file:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
When I try to deploy web-application containing the service I have the following error in log:
@XmlValue is not allowed on a class that derives another class
The main reason to use MOXy as JAXB-provider in my case is to be able to use @XmlValue annotation in subclasses. This error doesn't occure when I try to unmarshall with the same classes as used for the web-service in a test application using MOXy. Furthermore , there are no classes from org.eclipse.persistence package and its subpackages in a stacktrace, only com.sun.xml.bind.v2 classes instead. Apparently, MOXy isn't used when the web-application being deployed. All required Maven artifacts from org.eclipse.persistence is in WAR-file:
$ jar tf my-app.war | grep org.eclipse.persistence
WEB-INF/lib/org.eclipse.persistence.antlr-2.5.0.jar
WEB-INF/lib/org.eclipse.persistence.asm-2.5.0.jar
WEB-INF/lib/org.eclipse.persistence.moxy-2.5.0.jar
WEB-INF/lib/org.eclipse.persistence.core-2.5.0.jar
What am I doing wrong? As far as I understand, Provider is called in runtime when web-service is invoked. But the error occurs in deploy time. Should I reimplement something in addition to Provider?
The first step is to ensure that the EclipseLink libraries are in the correct place. Instead of configuring MOXy as the JAXB provider can you try using the MOXy APIs directly?
import org.eclipse.persistence.jaxb.JAXBContext;
import org.eclipse.persistence.jaxb.JAXBContextFactory;
public class Demo {
public static void main(String[] args) {
JAXBContext jc = JAXBContextFactory.createContext(new Class[] {Foo.class, Bar.class}), null);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With