0

I followed this example to implement moxy in my project. However I am getting the following error and have not been able to find a solution yet.

   Exception in thread "main" Local Exception Stack: 
   Exception [EclipseLink-50019] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.JAXBException
   Exception Description: Invalid parameter type encountered while processing external metadata via properties Map.  The Value associated with Key [eclipselink-oxm-xml] is required to be one of [Map<String, Source>], where String = package, Source = handle to metadata file.
    at org.eclipse.persistence.exceptions.JAXBException.incorrectValueParameterTypeForOxmXmlKey(JAXBException.java:245)
    at org.eclipse.persistence.jaxb.JAXBContextFactory.getXmlBindingsFromProperties(JAXBContextFactory.java:330)
    at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:115)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:249)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
    at blog.bindingfile.Demo.main(Demo.java:13)

I am new to jaxb and moxy, any help towards getting my moxy setup is appreciated.

GenerousJoker
  • 87
  • 1
  • 12

1 Answers1

0

Use instance of Source, it is in the error message:

 Value associated with Key [eclipselink-oxm-xml] is required to be one of [Map<String, Source>], where String = package, Source = handle to metadata file.

example:

 ... 
 javax.xml.transform.Source source = 
   new javax.xml.transform.stream.StreamSource("mypackage-metadata.xml") 
 map.put("example.mypackage", source);
 ...
miran
  • 1,419
  • 1
  • 12
  • 26