1
votes

I was trying to set Moxy as my default JAXB provider cause i need another algorithm convention for XmlElement names, so i found very useful XMLNameTransformer.

I create package-info

@XmlNameTransformer(NameXMLPattern.class)
package com.onix.validadores.messages;

import com.onix.validadores.utils.NameXMLPattern;
import org.eclipse.persistence.oxm.annotations.XmlNameTransformer;

And jaxb.properties file

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory

But when i make a main to test i get

System.out.println(JAXBContext.newInstance(RequestAutorizacion.class).getClass());

OUTPUT:

class com.sun.xml.bind.v2.runtime.JAXBContextImpl

But i wanted org.eclipse.persistence.jaxb.JAXBContext

I follow this tutorial

1
Where's Blaise Doughan when you need him? - Hovercraft Full Of Eels
@HovercraftFullOfEels i answer my own question but perhaps there is a more elegant solution xD, i just post if someone has the same problem - nachokk
@HovercraftFullOfEels - I was getting a tea :). - bdoughan

1 Answers

2
votes

jaxb.properties location

The jaxb.properties file needs to go in the same package as one of the classes used to bootstrap the JAXBContext. For your use case it would need to go in the same package as the RequestAutorizacion class.

Name Transformer

Your implementation of name transformer can be in any package you like and does not impact where the jaxb.properties file should be located.