|
Hi
I have some classes (not domain, in src/groovy folder), that are saved to a XML file. The same classes are used as commands in controller forms. But when the class is going to be initialized from a service, I get this error: Caused by NoClassDefFoundError: Could not initialize class ciruelo.ConfigurationService ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run in '' ^ 662 | run . . in java.lang.Thread In resume, I have this: =============================================================================== class ConfigurationService { private static final JAXBContext jc = JAXBContext.newInstance(Configuration.class); Configuration configuration = new Configuration(); @PostConstruct public void init() { log.info("Initializing configuration service...") this.loadConfiguration(); } public void loadConfiguration() { Unmarshaller unmarshaller = jc.createUnmarshaller(); try { this.configuration = (Configuration) unmarshaller.unmarshal("file.xml); } catch (Exception ex) { // log... } } =============================================================================== @Log4j @XmlRootElement(name="ciruelo-conf") @XmlAccessorType(XmlAccessType.FIELD) @Validateable class Configuration { } =============================================================================== Simply with that, i get the error. Ig I remove the Validateabe annotation, everything works fine. Any idea how to solve this? Using Grails 2.0.3 in Ubuntu 11.04 x64. Regards. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On 27/04/2012 21:21, Juan Asensio Sánchez wrote:
> Simply with that, i get the error. Ig I remove the Validateabe > annotation, everything works fine. Any idea how to solve this? Using > Grails 2.0.3 in Ubuntu 11.04 x64. Regards. The @Validateable annotation applies a compile-time AST transformation that adds additional fields into the bytecode of the class, and these extra fields are probably not JAXB compatible. I suspect your only recourse will be to use @XmlAccessorType(XmlAccessType.NONE) and explicitly annotate the fields you want to be mapped by JAXB. Ian -- Ian Roberts | Department of Computer Science [hidden email] | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Thank you very much Ian, now it works perfect!
Regards. El día 27 de abril de 2012 22:38, Ian Roberts <[hidden email]> escribió: > On 27/04/2012 21:21, Juan Asensio Sánchez wrote: >> Simply with that, i get the error. Ig I remove the Validateabe >> annotation, everything works fine. Any idea how to solve this? Using >> Grails 2.0.3 in Ubuntu 11.04 x64. Regards. > > The @Validateable annotation applies a compile-time AST transformation > that adds additional fields into the bytecode of the class, and these > extra fields are probably not JAXB compatible. I suspect your only > recourse will be to use @XmlAccessorType(XmlAccessType.NONE) and > explicitly annotate the fields you want to be mapped by JAXB. > > Ian > > -- > Ian Roberts | Department of Computer Science > [hidden email] | University of Sheffield, UK > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
