Namespace customization in Java2easyWSDL ant task and PropertyException…
Publié par mbeldame dans Non classé, tags: easyWSDLThe main goal of the modifications in easyWsdl previously described was to improve the WSDL generated by Java2easyWSDL, and its ant task.
So, the Main class of Java2easyWSDL has been modified to used normalized namespaces, and to provide the possibility to use custom namespaces. These modifications have been exposed in the Java2WSDLTask class to be used from an ant build.
I tested it from eclipse, and it worked correctly, generating the WSDL with the customized namespaces.
When I tryied to use it in my ant builds, outside eclipse, it didn’t work anymore. I had the following error:
[Java2WSDL] org.ow2.easywsdl.wsdl.api.WSDLException: SchemaException: javax.xml.bind.PropertyException: name: com.sun.xml.bind.namespacePrefixMapper value: org.ow2.easywsdl.wsdl.util.CustomPrefixMapper@17d03c5: javax.xml.bind.PropertyException: name: com.sun.xml.bind.namespacePrefixMapper value: org.ow2.easywsdl.wsdl.util.CustomPrefixMapper@17d03c5
[Java2WSDL] at org.ow2.easywsdl.wsdl.impl.wsdl11.WSDLWriterImpl.useCustomNamespacesPrefixes(WSDLWriterImpl.java:105)[Java2WSDL] at org.ow2.easywsdl.wsdl.impl.generic.WSDLWriterImpl.getConcreteWriter(WSDLWriterImpl.java:89)
…
The marshaller returned me a PropertyException, meaning it didn’t accept the « com.sun.xml.bind.namespacePrefixMapper » property when I tryied to set it.
I used the same JDK for eclipse, and ant (1.6.0_11); So, I suspected a versionning problem in the jaxb2-impl library. After verification, the classes declared in the classpath of my task, and the ones in eclipse were the same.
The main method of my task, called from a script (outside eclipse and ant) after setting the same classpath worked without error.
I found the solution after some tests and debugging…
The problem was caused by ant. It loaded the implementation of the marshaller from the jdk (in the rt.jar), instead of the one of the jaxb-impl-2.1.6.jar lib. And this implementation didn’t support the « com.sun.xml.bind.namespacePrefixMapper » property.
I solved it by putting explicitely jaxb-impl-2.1.6.jar at the beginning of the CLASSPATH used by ant, or by putting jaxb-impl-2.1.6.jar in the lib directory of ant.
I think it can be helpfull for the users of the Java2easyWSDL ant task…
Mathias
Bulletins (RSS)